struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maurizio Cucchiara <maurizio.cucchi...@gmail.com>
Subject Re: Redirect & RedirectAction forwarding to localhost:8080 if no protocol mentioned in namespace
Date Thu, 20 Jan 2011 14:57:24 GMT
Hard url? I didn't suggest you to hard code url inside namespace. You
should use namespace defined in your package declaration.
<package name="yourPackageName" extends="struts-default"
namespace="/YOUR_NAMESPACE">
   <action name="userLogin" class="com.UserAction" method="login">
   <result name="success">home.jsp</result>
<result name="login-failed" type="redirectAction">
<param name="actionName">loadLogin</param>
<param name="namespace">YOUR_NAMESPACE</param>
<param name="prependServletContext">true</param>
<param name="loginFailed">true</param>
</result>
</action>
<action name="loadLogin" class="com.UserAction" method="loadLogin">
<result name="success">login.jsp</result>
</action>

</package>
2011/1/20 Harsh Grover <harsh.grover@gmail.com>:
> yup, setting a hard url in namespace works, however, I have multiple
> development & test instances, each having their own unique url and I would
> want to avoid having to change the url in every build. I'm using maven &
> svn, and right now, i download the code from svn, I can run it without
> making any code changes. I'd like to keep it that way.
>
> Is there any way I could add parameters to struts.xml to be read from some
> properties file?
>
> On Thu, Jan 20, 2011 at 1:14 AM, Maurizio Cucchiara <
> maurizio.cucchiara@gmail.com> wrote:
>
>> Location is for the simply redirect result.
>> Did you try instead to set namespace parameter for redirectAction result?
>>
>> 2011/1/20 Mohamed SIDI <mhm.sidi@gmail.com>:
>> > I think your configuration miss some parameters like "location"
>> >
>> > you may have more details in this page
>> >
>> http://struts.apache.org/2.0.14/struts2-core/apidocs/org/apache/struts2/dispatcher/ServletRedirectResult.html#prependServletContext
>> >
>> > thank
>> >
>> > 2011/1/20 Harsh Grover <harsh.grover@gmail.com>
>> >
>> >> small correction, the request goes to
>> >> http://localhost:8080/test/actions/loadLogin.<
>> >> http://localhost:8080/test/actions/loadLogin.jsp>
>> >> action.
>> >>
>> >> On Wed, Jan 19, 2011 at 7:33 PM, Harsh Grover <harsh.grover@gmail.com
>> >> >wrote:
>> >>
>> >> > here it is.
>> >> >
>> >> > <action name="userLogin" class="com.UserAction" method="login">
>> >> > <result name="success">home.jsp</result>
>> >> >  <result name="login-failed" type="redirectAction">
>> >> > <param name="actionName">loadLogin</param>
>> >> >  <param name="prependServletContext">true</param>
>> >> > <param name="loginFailed">true</param>
>> >> >  </result>
>> >> > </action>
>> >> > <action name="loadLogin" class="com.UserAction" method="loadLogin">
>> >> >  <result name="success">login.jsp</result>
>> >> > </action>
>> >> >
>> >> > if login succeeds, i'm taking the user to the home page. However, if
>> >> login
>> >> > fails, I'm redirecting the user back to the login page with a query
>> >> param:
>> >> > loginFailed=true. However, it is forwarding to
>> >> > http://localhost:8080/test/actions/loadLogin.jsp, and bypassing the
>> >> apache
>> >> > instance in front of it completely, even if the request comes from
>> >> > http://abc.com/test/actions/userLogin.action.
>> >> >
>> >> > Thanks
>> >> >
>> >> > On Wed, Jan 19, 2011 at 1:49 AM, Mohamed SIDI <mhm.sidi@gmail.com>
>> >> wrote:
>> >> >
>> >> >> can you put out your configuration in struts.xml?
>> >> >>
>> >> >>
>> >> >>
>> >> >> 2011/1/18 Harsh Grover <harsh.grover@gmail.com>
>> >> >>
>> >> >> > I'm using redirectAction to send the user to another action
using
>> >> >> > redirectAction. However, if the namespace is not provided,
the
>> request
>> >> >> is
>> >> >> > getting forwarded to localhost:8080 (my server instance).
I'm using
>> >> >> apache
>> >> >> > in front of my app server, and this is breaking my flow. Is
there
>> any
>> >> >> > configuration I need to change? I cant put the complete url
in my
>> >> >> namespace
>> >> >> > since I have multiple environments.
>> >> >> >
>> >> >> > Any help on this is highly appreciated.
>> >> >> >
>> >> >> > Thanks.
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >>
>> >> >>
>> >> >> Cordialement
>> >> >>
>> >> >> Mohamed
>> >> >>
>> >> >
>> >> >
>> >>
>> >
>> >
>> >
>> > --
>> >
>> >
>> > Cordialement
>> >
>> > Mohamed
>> >
>>
>>
>>
>> --
>> Maurizio Cucchiara
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>



-- 
Maurizio Cucchiara

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message