You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mufaddal Khumri <mk...@allegrocentral.com> on 2008/01/09 17:16:53 UTC
Namespace issue for a particular result ...
I have a struts config file with the following:
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="authentication" namespace="/authentication"
extends="mypackage">
<action name="login" class="com.mypackage.authentication.LoginAction">
<result name="success" type="freemarker">${originalUrl}</result>
</action>
</package>
</struts>
In this case the LoginAction received the original url as: http://
localhost/mypackage/cr/test.action
When I execute this code I get an exception:
java.io.FileNotFoundException: Template /authentication/http://
localhost/mypackage/cr/test.action not found.
at freemarker.template.Configuration.getTemplate
(Configuration.java:489)
at freemarker.template.Configuration.getTemplate
(Configuration.java:459)
at
org.apache.struts2.views.freemarker.FreemarkerResult.doExecute
(FreemarkerResult.java:161)
So basically,
1. Can I forward to my original url in this manner? Or do i have to
specify a context relative path ?
2. How do I tell the Struts2 framework to not prepend the namespace
for this particular result?
Thanks.
Re: Namespace issue for a particular result ...
Posted by Mufaddal Khumri <mk...@allegrocentral.com>.
That was an oversight on my part .. I just changed the type to
redirect. Instead of the URL I send the action a
request.getRequestURI + request.getQueryString (if any) and that now
works good as a champ.
-Mufaddal.
On Jan 9, 2008, at 9:23 AM, Dave Newton wrote:
> --- Mufaddal Khumri <mk...@allegrocentral.com> wrote:
>> <struts>
>> <package name="authentication" namespace="/authentication"
>> extends="mypackage">
>>
>> <action name="login"
>> class="com.mypackage.authentication.LoginAction">
>> <result name="success" type="freemarker">${originalUrl}</result>
>> </action>
>>
>> </package>
>>
>> </struts>
>>
>> In this case the LoginAction received the original url as: http://
>> localhost/mypackage/cr/test.action
>>
>> When I execute this code I get an exception:
>>
>> java.io.FileNotFoundException: Template /authentication/http://
>> localhost/mypackage/cr/test.action not found.
>
> You've defined a FreeMarker result; it's going to try to get a
> template with
> the original URL as a name. This is almost certainly not what you
> want.
>
> Wouldn't you want a "redirect" result?
>
> d.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Namespace issue for a particular result ...
Posted by Dave Newton <ne...@yahoo.com>.
--- Mufaddal Khumri <mk...@allegrocentral.com> wrote:
> <struts>
> <package name="authentication" namespace="/authentication"
> extends="mypackage">
>
> <action name="login" class="com.mypackage.authentication.LoginAction">
> <result name="success" type="freemarker">${originalUrl}</result>
> </action>
>
> </package>
>
> </struts>
>
> In this case the LoginAction received the original url as: http://
> localhost/mypackage/cr/test.action
>
> When I execute this code I get an exception:
>
> java.io.FileNotFoundException: Template /authentication/http://
> localhost/mypackage/cr/test.action not found.
You've defined a FreeMarker result; it's going to try to get a template with
the original URL as a name. This is almost certainly not what you want.
Wouldn't you want a "redirect" result?
d.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org