On Tuesday 14 April 2009 17:22:25 john lee wrote:
> Yes, i need to further do variable processing at scriptlet(jsp) page, the
> reason is to do different kind of summary etc...
> but how? can i still use Context...same as i did in Struct 1.X's example?
>
> tks
>
> john
>
There is a way to get it, I can't remember off the top of my head. The action
instance is somewhere in one of the contexts... Anyhow, to expand on Dave's
question, I would suggest just adding another method to your action...
...
private String variable;
// other getters/setters/execute method, etc.
public String getVariableProcessed() {
// do your processing here and then return the further processed variable
}
Then, in your JSP, do another <s:property value="variableProcessed"/>
It has the added advantage of keeping the Java code in a Java source file, as
well as keeping you from dumping processing logic into your view layer. In
case you are mixing scriptlet and HTML, take a minute to see if you rethink
the problem into a clean separation before you intentionally create the
spaghetti code that someone will eventually have to chop up to make changes.
-Wes
--
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]