Okay, I got the second result working:
<result name="success"
type="redirect">/admin/dashboard/dashboard.htm</result>
Now, just the first one I'm still having problems with as I don't want to
redirect
<result name="input">/admin/login/login-form.htm</result>
On Sun, Sep 22, 2013 at 11:16 PM, Serdyn du Toit <[email protected]> wrote:
> Thanks guys,
>
> Just having a bit of trouble getting it 100% - sorry for the trouble (my
> first Struts project)
>
> What I have now is as follows:
> <package name="login" namespace="/admin/login" extends="default">
> <default-interceptor-ref name="any" />
> <action name="login-form">
> <result name="success">/admin/login/login.jsp</result>
> </action>
> <action name="login"
> class="com.d6.admin.login.AdminUserLoginAction">
> <result name="input">/admin/login/login-form.htm</result>
> <result name="success">/admin/dashboard/dashboard.htm</result>
> </action>
> </package>
>
> The following part is just problematic - I'm struggling to find these
> resources. My browser tells me "the requested resources is not available",
> but when I hit the actions directly everything works 100%
> <result name="input">/admin/login/login-form.htm</result>
> <result name="success">/admin/dashboard/dashboard.htm</result>
>
> Using <constant name="struts.action.extension" value="htm" /> and having
> tried to define them in the xml file without the extension as well...
> (minor point, more worried now about the resources not being found)
>
> Regards,
> Serdyn du Toit
>
>
>
> On Sun, Sep 22, 2013 at 6:56 PM, Lukasz Lenart <[email protected]>wrote:
>
>> You should never ever allow to access JSPs directly! Thus can be
>> potential security risk!
>>
>> What you want to achieve are two actions:
>> - login-form.action to display login form
>> - login.action to submit login form to and perform validation/user login
>>
>> Instead thinking about JSPs behind, think about actions.
>>
>>
>> Regards
>> --
>> Łukasz
>> + 48 606 323 122 http://www.lenart.org.pl/
>>
>> 2013/9/22 Serdyn du Toit <[email protected]>:
>> > Hi,
>> >
>> > I have the following Struts action defined in Xml:
>> > <package name="login" namespace="/admin/login" extends="default">
>> > <default-interceptor-ref name="any" />
>> >
>> > <action name="login"
>> > class="com.d6.adminweb.login.AdminUserLoginAction">
>> > <result name="input">/admin/login/login.jsp</result>
>> > <result name="success"
>> > type="redirect">/admin/dashboard/frames.jsp</result>
>> > </action>
>> > </package>
>> >
>> > When I submit the page and validation fails my browser has the following
>> > Url:
>> > http://localhost:8080/webapp/admin/login/login.action<
>> http://localhost:8080/rf-adminweb/admin/login/login.action>
>> >
>> > How can I make it display
>> > http://localhost:8080/webapp/admin/login/login.j<
>> http://localhost:8080/rf-adminweb/admin/login/login.action>
>> > sp
>> >
>> > If I never see .action in the browser I'd be happy :)
>> >
>> > I want it to be login.jsp so that someone can bookmark the page even
>> after
>> > a failed form submission. Sure, one can bookmark login.action - but
>> then
>> > when you load the page you're going to see a lot of errors due to empty
>> > input fields (the Action's validation)
>> >
>> > Using a "redirect" worked for the second result type:
>> > <result name="success"
>> > type="redirect">/admin/dashboard/frames.jsp</result>
>> >
>> > But in this case if I do that then my errors are no longer displayed on
>> the
>> > page (guess it gets lost when I redirect)
>> >
>> > Any suggestions appreciated :)
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>