aspose file tools*
The moose likes Struts and the fly likes Passing parameters to different view Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Passing parameters to different view" Watch "Passing parameters to different view" New topic
Author

Passing parameters to different view

Siddharth kumar
Greenhorn

Joined: Jun 07, 2006
Posts: 6
Hello all,
I have a Login.jsp Page having login information. After validating, I am forwarded to the "Main_Page.jsp"
In Main_Page.jsp I have some links to different Jsp pages.

Now, in these Jsp Pages i want my "login_id" in Login.jsp to be available in all these Jsp pages. How can I do this?
Action Mappings are in session scope.
And one thing is that I am not submitting the "Main_Page.jsp". It is through html:links that i am forwarded to these Jsp pages. So how can i get the Login information.
Pls, suggest?
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
When a person is sucessfully logging in, store the information in session scope and retrieve whereever you want
Siddharth kumar
Greenhorn

Joined: Jun 07, 2006
Posts: 6
Hello Vidya Sagar,
That is what i am asking - How to get the information.???
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
I have a Login.jsp Page having login information. After validating, I am forwarded to the "Main_Page.jsp"


Once you sucessfully validating the login(hope you have username and otherinfo related to user for validating), then store username and other related information in the session scope.use where ever you need

Hope now you are clear.
Siddharth kumar
Greenhorn

Joined: Jun 07, 2006
Posts: 6
Hello Vidya Sagar,
As a beginner, i am asking how to store the username in session scope. I mean the syntax for that?

Regards
Siddharth
[ June 12, 2006: Message edited by: Siddharth kumar ]
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
As a beginner, i am asking how to store the username in session scope. I mean the syntax for that?


For setting in session:
request.getSession().setAttribute("username",actualusername); -- servlet
session.setAttribute("username",actualusername); -- in jsp

For retrieving from session:
request.getSession().getAttribute("username"); -- in servlet
session.getAttribute("username"); -- in jsp
Siddharth kumar
Greenhorn

Joined: Jun 07, 2006
Posts: 6
Thanks a lot
From siddharth
 
Consider Paul's rocket mass heater.
 
subject: Passing parameters to different view