MyEclipse Forums
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
aceventura18
Post subject: Getting my bean property from a servlet  PostPosted: Aug 27, 2010 - 07:25 AM



Joined: Sep 03, 2009
Posts: 4

I have used a Java bean for setting and getting userName/id,password and its login process.
Look at here :

<h:inputText id="userName" value="#{UserBean.userName}"></h:inputText>

The above code creates an instance of UserBean and sets the property userName to the entered value.

Note:

<h:commandButton value="Login" action="#{UserBean.login}" type="submit"></h:commandButton>

This calls the login() in UserBean which updates the database about login status directly using DAO's.

But Now i need to have a log out(which is a hyperlink) redirecting to a logout servlet.
//com.servlet.logout.java
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
session.invalidate();
response.sendRedirect(request.getContextPath()+"/loginForm.faces");
}

How do i get now update the database using the DAO thats available for updation that I did using the bean(previously did for login)?.

Two issues that i face now:
1) If I use servlet to invalidate request, how do I then use logout method in DAO?
2) As I have to call the DAO's updateLog(String userName,String logStatus) from where could I get userName from?

_________________
Regards,
Karthik.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits