changed userbean to UserBean and made valid a private field
authorFelix Schumacher <felix.schumacher@internetallee.de>
Thu, 26 Aug 2010 16:56:35 +0000 (18:56 +0200)
committerFelix Schumacher <felix.schumacher@internetallee.de>
Thu, 26 Aug 2010 16:56:35 +0000 (18:56 +0200)
WebContent/main.jsp
WebContent/menu.jsp
src/org/mcb/services/UserBean.java [new file with mode: 0644]
src/org/mcb/services/loginmanager.java
src/org/mcb/services/udac.java
src/org/mcb/services/userbean.java [deleted file]

index b09c176..de4881a 100644 (file)
@@ -18,7 +18,7 @@
 <link rel="stylesheet" type="text/css" href="css/default.css">
 </head>
 <%
-       userbean usr = (userbean) session.getAttribute("user");
+       UserBean usr = (UserBean) session.getAttribute("user");
        String login_path = request.getContextPath() + "/index.jsp";
        if (usr == null) {
                session.invalidate();
index ea01ca0..4bce7e5 100644 (file)
 <link rel="stylesheet" type="text/css" href="<%=css_path %>" />
 <script src="<%=script_path%>" type="text/javascript"></script>
 </head>
-<%
-       userbean usr = (userbean) session.getAttribute("user");
-       //if( (session.getAttribute("user_id") == null) | (session.getAttribute("user_id") == "" ) ){
-       if (usr == null) {
-               session.invalidate(); //request.getContextPath()+"/Index.jsp"
-               //      response.sendRedirect(login_path);
-               response.sendRedirect(response.encodeRedirectURL(login_path));
-       } else {
-               /*      String user_id      = (String) session.getAttribute("user_id");
-                String user_name    = (String) session.getAttribute("user_name");
-                //String user_pass    = (String) session.getAttribute("user_pass");
-                String role_id      = (String) session.getAttribute("role_id");
-                String role_name    = (String) session.getAttribute("role_desc");
-                String last_login   = (String) session.getAttribute("last_login");
-                // userbean usr        = (userbean) session.getAttribute("user");
-                //out.println("object value: "+usr.getName());
-                */
+<%\r
+       UserBean usr = (UserBean) session.getAttribute("user");\r
+       //if( (session.getAttribute("user_id") == null) | (session.getAttribute("user_id") == "" ) ){\r
+       if (usr == null) {\r
+               session.invalidate(); //request.getContextPath()+"/Index.jsp"\r
+               //      response.sendRedirect(login_path);\r
+               response.sendRedirect(response.encodeRedirectURL(login_path));\r
+       } else {\r
+               /*      String user_id      = (String) session.getAttribute("user_id");\r
+                String user_name    = (String) session.getAttribute("user_name");\r
+                //String user_pass    = (String) session.getAttribute("user_pass");\r
+                String role_id      = (String) session.getAttribute("role_id");\r
+                String role_name    = (String) session.getAttribute("role_desc");\r
+                String last_login   = (String) session.getAttribute("last_login");\r
+                // userbean usr        = (userbean) session.getAttribute("user");\r
+                //out.println("object value: "+usr.getName());\r
+                */\r
 %>
 <body>
 <span class="preload1"></span>
diff --git a/src/org/mcb/services/UserBean.java b/src/org/mcb/services/UserBean.java
new file mode 100644 (file)
index 0000000..117db99
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.mcb.services;
+
+/**
+ * 
+ * @author yawar.saeed
+ */
+public class UserBean {
+       private String userid;
+       private String password;
+       private String RoleDesc;
+       private String LastLogin;
+       private String Name;
+       private String Branch;
+       private String RoleId;
+       private boolean valid;
+
+       public String getName() {
+               return Name;
+       }
+
+       public void setName(String newName) {
+               Name = newName;
+       }
+
+       public String getBranch() {
+               return Branch;
+       }
+
+       public void setBranch(String newBranch) {
+               Branch = newBranch;
+       }
+
+       public String getRole() {
+               return RoleId;
+       }
+
+       public void setRole(String newRole) {
+               RoleId = newRole;
+       }
+
+       public String getRoleDesc() {
+               return RoleDesc;
+       }
+
+       public void setRoleDesc(String newRoleDesc) {
+               RoleDesc = newRoleDesc;
+       }
+
+       public String getLastLogin() {
+               return LastLogin;
+       }
+
+       public void setLastLogin(String newLastLogin) {
+               LastLogin = newLastLogin;
+       }
+
+       public String getPassword() {
+               return password;
+       }
+
+       public void setPassword(String newPassword) {
+               password = newPassword;
+       }
+
+       public String getUserId() {
+               return userid;
+       }
+
+       public void setUserId(String newUserId) {
+               userid = newUserId;
+       }
+
+       public boolean isValid() {
+               return valid;
+       }
+
+       public void setValid(boolean newValid) {
+               valid = newValid;
+       }
+}
index d7745d1..f861411 100644 (file)
@@ -40,7 +40,7 @@ public class loginmanager extends HttpServlet {
         */
        protected void processRequest(HttpServletRequest request,
                        HttpServletResponse response) throws ServletException, IOException {
-               userbean user = new userbean();
+               UserBean user = new UserBean();
                user.setUserId(request.getParameter("txt_userid"));
                user.setPassword(request.getParameter("txt_pass"));
                user = udac.login(user);
index fd79b9d..c4b4369 100644 (file)
@@ -16,7 +16,7 @@ public class udac {
                this.passwordservice = passwordservice;
        }
 
-       public userbean login(userbean user) {
+       public UserBean login(UserBean user) {
                // preparing some objects for connection
                Connection currentCon = null;
                ResultSet rs = null;
diff --git a/src/org/mcb/services/userbean.java b/src/org/mcb/services/userbean.java
deleted file mode 100644 (file)
index d692a66..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.mcb.services;
-
-/**
- * 
- * @author yawar.saeed
- */
-public class userbean {
-       private String userid;
-       private String password;
-       private String RoleDesc;
-       private String LastLogin;
-       private String Name;
-       private String Branch;
-       private String RoleId;
-       public boolean valid;
-
-       public String getName() {
-               return Name;
-       }
-
-       public void setName(String newName) {
-               Name = newName;
-       }
-
-       public String getBranch() {
-               return Branch;
-       }
-
-       public void setBranch(String newBranch) {
-               Branch = newBranch;
-       }
-
-       public String getRole() {
-               return RoleId;
-       }
-
-       public void setRole(String newRole) {
-               RoleId = newRole;
-       }
-
-       public String getRoleDesc() {
-               return RoleDesc;
-       }
-
-       public void setRoleDesc(String newRoleDesc) {
-               RoleDesc = newRoleDesc;
-       }
-
-       public String getLastLogin() {
-               return LastLogin;
-       }
-
-       public void setLastLogin(String newLastLogin) {
-               LastLogin = newLastLogin;
-       }
-
-       public String getPassword() {
-               return password;
-       }
-
-       public void setPassword(String newPassword) {
-               password = newPassword;
-       }
-
-       public String getUserId() {
-               return userid;
-       }
-
-       public void setUserId(String newUserId) {
-               userid = newUserId;
-       }
-
-       public boolean isValid() {
-               return valid;
-       }
-
-       public void setValid(boolean newValid) {
-               valid = newValid;
-       }
-}