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

Struts action ognl setters and getters

E Robb
Ranch Hand

Joined: Aug 27, 2010
Posts: 111
I have a struts action & when it fails I want to return a value and collect the value with OGNL.

The JSP page contains:
<s:property value="%{#parameters.result}"/>

In my struts xml I have:


The action contains:


All the system.out.prints in the action appear to be correct but I cant collect the variable with OGNL it always returns blank.

What am I missing that I cant collect the result value with OGNL?

Thanks,
Earl

Anbarasu Aladiyan
Ranch Hand

Joined: Jun 02, 2009
Posts: 182

Check the getter method. It cant have parameters.


A.A.Anbarasu
E Robb
Ranch Hand

Joined: Aug 27, 2010
Posts: 111
Maybe Im asking the wrong question. The variable "result" will be dependent on which failure happens in execute(). So "result" could be 1, 2 or 3 depending on which type of failure is found. If I shouldnt dynamically change within execute() how do I put a key,value on the default stack so that it can be collected and evaluated on failure by <s:property value="%{#result}"/>

Thanks
Anbarasu Aladiyan
Ranch Hand

Joined: Jun 02, 2009
Posts: 182

E Robb wrote:Maybe Im asking the wrong question. The variable "result" will be dependent on which failure happens in execute(). So "result" could be 1, 2 or 3 depending on which type of failure is found. If I shouldnt dynamically change within execute() how do I put a key,value on the default stack so that it can be collected and evaluated on failure by <s:property value="%{#result}"/>

Thanks
Everything's are fine in your code. But ONGL expects a getter method without any parameter.
If the variable name is result, then
Setter method must beand the getter method must beIn your case there is no public String getResult() method; because it has overloaded version.
E Robb
Ranch Hand

Joined: Aug 27, 2010
Posts: 111
DOH!!! Thank you so much
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts action ognl setters and getters