Win a copy of Rust Web Development this week in the Other Languages 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic