• 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 Attribute from the struts tags

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following code written in the Struts Action class


String var = "test";
HttpSession session = request.getSession(false);
session.setAttribute("nameval",variable);


How can I ge the attribute from the JSP.

I tried this

<bean:define id="nameval" scope="session" type="java.lang.String" name="nameval"/>

and got error

webapp: Servlet error javax.servlet.jsp.JspException: Cannot find bean nameval in scope session

I know nameval is not a bean, But I just tried and don't know the alternate way.


Thanks
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sankar,

Welcome to JavaRanch !
Please put your code stuff inside code tag.

Why are you defining a bean in this page? The error is self explanatory , as container could not find bean with nameval name. You can try


Please try this and let us know.
For all ranchers correct me if I am wrong.

 
sankar raja
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Edwards,

It Worked.

Thanks
 
girl power ... turns out to be about a hundred watts. But they seriuosly don't like being connected to the grid. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic