• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2 valuestack error

 
Vallaru smitha
Ranch Hand
Posts: 87
Firefox Browser Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 87
Firefox Browser Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 87
Firefox Browser Hibernate Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tom,

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

 
san mani
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dude put setters and getters for your bean class in your action class and that will resolve your issue.
Hope this helps!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic