• 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

Struts s:property tag not working

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys

I have a action class which gets data from a form, see code below:



If the form input is successful it will forward to my success.jsp page. The problem is I am trying to use <s roperty value="name"> to get the value of the variable name in the action class, but when I run the code it returns as empty. Does anyone know where I am going wrong?

[ December 18, 2008: Message edited by: Shobb Bob ]
[ December 18, 2008: Message edited by: Shobb Bob ]
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code looks right, are you sure that the "name" property in your action class is getting set to something? The s roperty tag may display nothing because "name" is never set to anything.
 
Shobb Bob
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, here is my struts.xml file:



If I change "<result type="redirect-action">FaultReport</result>" with "<result>/main/site/page.jsp</result>" it will work. But I would prefer to use the first method since then I can specify a custom name for the URL.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you use redirectAction it redirects--so the current action is lost and a new one is instantiated, meaning that the current value of the "name" property will be lost.
reply
    Bookmark Topic Watch Topic
  • New Topic