You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Chris <ch...@yahoo.fr> on 2015/09/09 09:50:16 UTC

GitHub example annotations with 2 differents files named index.jsp

Hello, 
2 differents files named index.jsp, exist in annotations example.
But they are differents, and not in the same directoryDo we need this sendRedirect ?
GitHub  apache/struts-examples/annotations/
1 ) src/main/webapp/index.jsp

2 ) src/main/webapp/WEB-INF/content/index.jsp
<% response.sendRedirect("/index.jsp"); %>

Re: GitHub example annotations with 2 differents files named index.jsp

Posted by Lukasz Lenart <lu...@apache.org>.
2015-09-10 17:54 GMT+02:00 Chris <ch...@yahoo.fr>:
> Thank you. I see.
>  But , Is not that a bit dangerous to let the user change the link? I prefer when Struts2 intercept the modification without error.

I don't understand what do you mean

>  Anyway, the line in the jsp index.jsp
>  <% Response.sendRedirect ("/ index.jsp"); %>
>  does not work for me, because it refers to
>  http: // localhost: 8080 / index.jsp (a blank page )And because I work with the link
> http://localhost:8080/st2_ex_16_annotations/
>
>  On my PC, I change "/index.jsp"
> into "index.jsp" or "./index.jsp "
>
>  see
>  <% Response.sendRedirect ("index.jsp"); %>
>  or
>  <% Response.sendRedirect ("./ index.jsp"); %>
>  and redirection works well. toward http: // localhost: 8080 / st2_ex_16_annotations / index.jsp

You are right but you are using a different context than the example
app: /st2_ex_16_annotations vs /


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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


Re: GitHub example annotations with 2 differents files named index.jsp

Posted by Chris <ch...@yahoo.fr>.
Thank you. I see.
 But , Is not that a bit dangerous to let the user change the link? I prefer when Struts2 intercept the modification without error.

 Anyway, the line in the jsp index.jsp
 <% Response.sendRedirect ("/ index.jsp"); %>
 does not work for me, because it refers to
 http: // localhost: 8080 / index.jsp (a blank page )And because I work with the link 
http://localhost:8080/st2_ex_16_annotations/

 On my PC, I change "/index.jsp" 
into "index.jsp" or "./index.jsp "

 see
 <% Response.sendRedirect ("index.jsp"); %>
 or
 <% Response.sendRedirect ("./ index.jsp"); %>
 and redirection works well. toward http: // localhost: 8080 / st2_ex_16_annotations / index.jsp 


     Le Jeudi 10 septembre 2015 8h26, Lukasz Lenart <lu...@apache.org> a écrit :
   

 2015-09-09 9:50 GMT+02:00 Chris <ch...@yahoo.fr>:
> Hello,
> 2 differents files named index.jsp, exist in annotations example.
> But they are differents, and not in the same directoryDo we need this sendRedirect ?
> GitHub  apache/struts-examples/annotations/
> 1 ) src/main/webapp/index.jsp

It's a welcome-page defined in web.xml

> 2 ) src/main/webapp/WEB-INF/content/index.jsp
> <% response.sendRedirect("/index.jsp"); %>

It's used by Convention's Index action
https://github.com/apache/struts/blob/master/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java#L1041

so you can navigate to url like http://localhost:8080/index.action and
it will work (you will be redirected back to /index.jsp)


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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


  

Re: GitHub example annotations with 2 differents files named index.jsp

Posted by Lukasz Lenart <lu...@apache.org>.
2015-09-09 9:50 GMT+02:00 Chris <ch...@yahoo.fr>:
> Hello,
> 2 differents files named index.jsp, exist in annotations example.
> But they are differents, and not in the same directoryDo we need this sendRedirect ?
> GitHub  apache/struts-examples/annotations/
> 1 ) src/main/webapp/index.jsp

It's a welcome-page defined in web.xml

> 2 ) src/main/webapp/WEB-INF/content/index.jsp
> <% response.sendRedirect("/index.jsp"); %>

It's used by Convention's Index action
https://github.com/apache/struts/blob/master/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java#L1041

so you can navigate to url like http://localhost:8080/index.action and
it will work (you will be redirected back to /index.jsp)


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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