Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

jsp:useBean Session scope - newbie

843840May 28 2008 — edited May 28 2008
Hey,

Quick question, i have 2 jsp pages, Welcome.jsp, and ProcessLogin.jsp.

Welcome.jsp displays the text boxes for the login form once the submit button is hit i call ProcessLogin.jsp and set the username and password values in LoginUser.java via this ProcessLogin.jsp.

Using the following code in ProcessLogin.jsp i instanciate LoginUser.java with a scope of "session"

Code:
<%@ page import="java.util.*" %>
<%! 
ResourceBundle bundle =null;
public void jspInit() {
bundle = ResourceBundle.getBundle("login");
}
%>
<%@ page session="true"%> 
<jsp:useBean id="user_login" class="user_login.login_user" scope="session">
<jsp:setProperty name="user_login" property="*"/>
</jsp:useBean>

<% 
if (user_login.validateUserLogin()) {
%>
<jsp:forward page="<%=bundle.getString(\"login.successfullLogin\")%>"/>
<%
} else {
%>
<jsp:forward page="<%=bundle.getString(\"login.unsuccessfullLogin\")%>"/>
<%
}
%
Now this process is working fine for me, however i want to change the login.successfullLogin page so it directs the user back to the Welcome.jsp page, there is a little bit of logic on the welcome page that checks if the user is logged in, and this is where my problem lies. The user information/status is kept in the LoginUser.java object.

If this has been instanciated in the ProcessLogin.jsp how do i access this object from the welcome.jsp page?


I may not be explaining this as well as possible, so let me know if you need anything else.

Thanks
Rob
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 25 2008
Added on May 28 2008
4 comments
897 views