This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts s:property tag not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts s:property tag not working" Watch "Struts s:property tag not working" New topic
Author

Struts s:property tag not working

Shobb Bob
Greenhorn

Joined: Dec 18, 2008
Posts: 4
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 ]
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
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

Joined: Dec 18, 2008
Posts: 4
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.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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.
 
wood burning stoves
 
subject: Struts s:property tag not working