From: Felix Schumacher Date: Thu, 26 Aug 2010 16:56:35 +0000 (+0200) Subject: changed userbean to UserBean and made valid a private field X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=7cdc8387e99b2e2a968362edb0dfca87807b2d1e;p=problems.git changed userbean to UserBean and made valid a private field --- diff --git a/WebContent/main.jsp b/WebContent/main.jsp index b09c176..de4881a 100644 --- a/WebContent/main.jsp +++ b/WebContent/main.jsp @@ -18,7 +18,7 @@ <% - userbean usr = (userbean) session.getAttribute("user"); + UserBean usr = (UserBean) session.getAttribute("user"); String login_path = request.getContextPath() + "/index.jsp"; if (usr == null) { session.invalidate(); diff --git a/WebContent/menu.jsp b/WebContent/menu.jsp index ea01ca0..4bce7e5 100644 --- a/WebContent/menu.jsp +++ b/WebContent/menu.jsp @@ -21,23 +21,23 @@ -<% - 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()); - */ +<% + 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()); + */ %> diff --git a/src/org/mcb/services/UserBean.java b/src/org/mcb/services/UserBean.java new file mode 100644 index 0000000..117db99 --- /dev/null +++ b/src/org/mcb/services/UserBean.java @@ -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; + } +} diff --git a/src/org/mcb/services/loginmanager.java b/src/org/mcb/services/loginmanager.java index d7745d1..f861411 100644 --- a/src/org/mcb/services/loginmanager.java +++ b/src/org/mcb/services/loginmanager.java @@ -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); diff --git a/src/org/mcb/services/udac.java b/src/org/mcb/services/udac.java index fd79b9d..c4b4369 100644 --- a/src/org/mcb/services/udac.java +++ b/src/org/mcb/services/udac.java @@ -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 index d692a66..0000000 --- a/src/org/mcb/services/userbean.java +++ /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; - } -}