This week's book giveaway is in the JDBC and Relational Databases forum.
We're giving away four copies of Murach's MySQL and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • 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

How to get s:hidden value to java class

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

i have one jsp called x.jsp and i that i have hidden variable as follows

<s:hidden name="xyz" value="%{x.y}"/>

when i have seen the "view source" i am getting the value here

Now i moving to other y.jsp by hitting the submit button in the x.jsp file

and i that Hidden.java action class(java class) i have kept getter and setter for this hidden variable "xyz"


and in y.jsp i have kept the hidden variable.

like this

<s:hidden name="xyz"/>

Problem.

1. i am not able to get the value of hidden variable in x.jsp to Hidden.java class (only the getter of xyz variable is been called and setter are not called at all when i tried to debug.).

2. if i will get the value to Hidden.java then how to send this.. next y.jsp file.
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. This sounds right in general, can you attach the actual JSP tags and getter and setter methods?

2. If your result is set up in your struts.xml file, the jsp should have access to the data in your action class when it runs. So this should work once you get the data from screen X into your action class.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You must be forgetting getter and setter method in your java class. Also coping values from java to jsp will be taken care by the getter and setter methods. Just remember to keep the name of the jsp variable and java variable same.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic