• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Use of Struts2 tag in JSP

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everyone
I am trying to get my hands on Struts2, and started getting issues. The scenario is as follows :
1.) Entered a username and password from index.jsp
2.) Action class returns success and is navigated to welcome.jsp
3.) In welcome.jsp :
-- I extracted the username using <s:property value="name"/>
Question : What if i start a session in welcome.jsp and try to set an attribute in session scope . How would i do this ?
session.setAttribute("loggedusername", <s:property value="name"/>);
I know this is wrong but how would we do it ? As the logged in user name is fetched to this page using struts property tag.

Thanks!!!
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Tarun
Dont try to set username in jsp page. Your Action class should implements SessionAware interface and override a method setSession() method.



 
Praveen Reddy Somireddy
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Tarun
Dont try to set username in jsp page. Your Action class should implements SessionAware interface and override a method setSession() method.



 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic