struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Pratt <thechrispr...@gmail.com>
Subject Re: Url rewriting of .action to .jsp
Date Sun, 22 Sep 2013 07:36:03 GMT
Put the following in your struts.xml configuration file:

 <constant name="struts.action.extension" value="jsp"/>

I actually prefer:

  <constant name="struts.action.extension" value="html"/>

since it hides the underlying technology just a bit better and makes a tiny
bit harder for someone to guess how to hack it.  It's not high security,
but every little bit helps.
  (*Chris*)



On Sat, Sep 21, 2013 at 10:44 PM, Serdyn du Toit <dutoitns@gmail.com> wrote:

> 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 :)
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message