aspose file tools*
The moose likes Struts and the fly likes Struts2 valuestack error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 valuestack error" Watch "Struts2 valuestack error" New topic
Author

Struts2 valuestack error

Vallaru smitha
Ranch Hand

Joined: Aug 19, 2008
Posts: 87

Hi,

I am using struts2 and hibernate




when i try to edit i am getting an errror
[ERROR] [jsp] - Servlet.service() for servlet jsp threw exception <tag 'push', field 'value': You must specify a value to push on the stack. Example: person - [unknown location]>tag 'push', field 'value': You must specify a value to push on the stack. Example: person - [unknown location]
at org.apache.struts2.components.Component.fieldError(Component.java:230)
at org.apache.struts2.components.Component.findValue(Component.java:351)
at org.apache.struts2.components.Push.start(Push.java:128)


following an example:http://www.vaannila.com/struts-2/struts-2-example/struts-2-crud-example-1.html

if any one have idea please let me know

thanks
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
Sounds like Struts2 can't find "user" on your stack. Does it have the appropriate getters and setters in your action class? Are you sure your action class is being called?
Vallaru smitha
Ranch Hand

Joined: Aug 19, 2008
Posts: 87



yeah getter/setter methods are set properly. If I remove that stack it works good. Users is my actionclass



could you please let me know if something is wrong..

Thanks
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
I'm a bit confused. From your jsp, it looks like you are trying to push an object named "user" to the top of your stack. The most convetional way to do this is to have a private object in your action class (seeing your struts.xml file might clear things up a little) called "user" and a getter method for user. If your Users class is your action class, I don't think the push will work since I don't see a private object called "user" and its getter (I also don't see a method that would return the result string, but your srtuts.xml file might clear that up as well).

When you say

If I remove that stack it works good.


I assume you mean removing the push. That makes sense if Users is your action class, since it will already be on top of the stack and there for id, name, gender, country, and aboutYou are already accessible as names. If its working the way you want with out the push, why are you putting the push in the jsp?
Vallaru smitha
Ranch Hand

Joined: Aug 19, 2008
Posts: 87

Thanks Tom,

I was doing a blunder. I declared my view as Users and for push i was using user .

san mani
Greenhorn

Joined: Jun 06, 2012
Posts: 2
Dude put setters and getters for your bean class in your action class and that will resolve your issue.
Hope this helps!
 
 
subject: Struts2 valuestack error