----- Original Message ----- From: "Kevin A. Roll" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, February 06, 2004 11:03 PM Subject: [OS-webwork] How to dynamically change the view?
> > I'm trying to write an action that can arbitrarily specify the name of a > JSP as the resultant view. In the old days of WebWork one could call > ActionSupport.setResult() with the name of a page. It appears that this has > been removed and presumably replaced by the DynamicViewMapping class. I > haven't been able to figure out how this works from the code or > documentation; can someone give me a hint? Thanks. > You do this by using a special expression in your actions xml or properties file. To get a dynamic value you write: ${someWWExpression} and that expression will be looked up on the value stack. someWWExpression is just like any normal WW EL expression you use in your JSP etc. Example: <action name="myAction"> <view name="success">${nextView}</view> <view name="error">error.jsp</view> </action> This looks up the value nextView on the value stack. The last action executed before the mapping is in this case myAction so that will be the first action found on the stack for the lookup, so if it contains a getNextView() method then the result of that method will be the view used. You can use several dynamic expressions and you can use them anywhere, also for the action, so for example you could do: <action name="myAction"> <view name="success">${nextAction}.action?countryParam=${someCountry}</view> </action> Hope this helps. Cheers, Dick Zetterberg ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork