Works: type="redirect" ${'any.action'} (-> any.action)
Fails: type="chain" and type="velocity" ${'any.action'}
And here's the proof for type="velocity" case:
org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '/${'any.action'}'
So it seems that using ognl expression in the result.location only works with the redirect result type.
I have tested with the latest from cvs.
/Jonas
Robert Douglass wrote:
Works: <result name="success" type="dispatcher"> <param name="location">test.html</param> </result>
Fails: <result name="success" type="dispatcher"> <param name="location">${'test.html'}</param> </result>
-RD
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Pat Lightbody Sent: Monday, September 29, 2003 3:41 AM To: [EMAIL PROTECTED] Subject: Re: [OS-webwork] Hyperlink best practices - use of actions
Robert, I haven't tested this functionality in a while, but I don't think it's gone anywhere :) Scott is right that a result type of "redirect" is not what you want. Since you were using <jsp:forward/>, you'd want to use the result type of "dispatcher".
Try working backwards... see if you can dispatch to a hardcoded page (foo.jsp) and then try a simple Ognl expression (${'foo.jsp'}), etc.
-Pat
----- Original Message ----- From: "Robert Douglass" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, September 28, 2003 10:39 AM Subject: RE: [OS-webwork] Hyperlink best practices - use of actions
Thanks Scott, I hadn't noticed the difference between Jason's and Pat's posts on the matter. However, contrary to my earlier assertion, I'm now convinced that this syntax isn't resolving to an OGNL expression like it should. In my browse.action, I explicitely set a private field 'templatePath'. It has getter and setter methods, but either the stack isn't visible to xwork.xml like it should be, or I'm not referencing the variable correctly. I know
it
is there because this <ww:property value="templatePath"/> turns out right
in
the jsp.
I built the latest from the CVS today. Has anyone tested this
functionality
since it came up on the list a couple of days ago? Or am I doing something wrong??
-Robert
--From xwork.xml <action name="browse" class="com.webs4.Browse"> <result name="success" type="dispatcher"> <param name="location">${templatePath}</param> </result> </action>
I also tried the following with the same result. <action name="browse" class="com.webs4.Browse"> <result name="success">${templatePath}</result> </action>
--From browse.java private String templatePath;
public void setTemplatePath(String path) { templatePath = path; } public String getTemplatePath() { return templatePath; } public String execute() throws Exception { File templateFile = Webs4.getBestMatchTemplate(doc, template); templatePath = StringUtil.removeDocumentRoot(templateFile.toURI());// breakpoint here shows correct result return SUCCESS; // I've tested with and without leading '/' }
--HTTP response: type Status report message /${templatePath} description The requested resource (/${templatePath}) is not available.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Scott Farquhar Sent: Sunday, September 28, 2003 4:37 PM To: [EMAIL PROTECTED] Subject: Re: [OS-webwork] Hyperlink best practices - use of actions
Robert,
Without following the whole thread (so this could be off base), I think that the problem is that redirect does exactly that - a redirect. A redirect is a new request, therefore you don't have the stack setup.
Why don't you just do this:
<result name="success">${templatePath}</result>
Instead of the redirect?
Cheers, Scott
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork