• 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

Session Issue

 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had declared scope="session" in my struts_Config.xml file. But when I come to my JSP page unless I specify scope="session" in bean:write I am not getting the data.


<action
path="/editRequest"
attribute="RequestForm"
name="RequestForm"
scope="session"
input="/jsp/ViewRequest.jsp"
type="com.abc.xyz.ijk.action.request.EditRequestAction">
<forward name="success" path="/jsp/request/jsp/Request.jsp" />
</action>

JSP page

<bean:write name="RequestForm" property="requestOriginator" scope="session"/>



If I explicitly use session.setAttribte("RequestForm") in my EditRequestAction then it is working perfectly without specify scope="session" in struts_Config

Please let me know how to do it with scope="session" struts_Config and without explicitly setting the session attribute in action class and using scope="session" in jsp page.

[ September 01, 2007: Message edited by: Vishnu Prakash ]
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's important to realize that session is the default scope for a Struts action, so whether you specify scope="session" or simply omit the scope attribute, the result will be the same.

As to why your bean:write doesn't show anything unless you specify scope="session", I have no idea. A bean write tag will search all scopes for the name you give, and will display it if it's found.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic