Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 struts.xml not redirecting

 
Fernando Dominguez
Ranch Hand
Posts: 108
Debian Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
When I try

http://localhost:8080/Mypage/Prepost

The application is redirected to the default action by?

Here is my struts.xml
<CODE>

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false"/>
<package name="Mypage" namespace="/" extends="struts-default">
<default-action-ref name="Home" />


<action name="Register" class="action.Register" method="execute">
<result name="success">/jsp/register_finish.jsp</result>
<result name="input">/jsp/register.jsp</result>
</action>

<action name="PrePost" class="action.PrePost" method="execute">
<result name="success">/jsp/submit.jsp</result>
<result name="error">/jsp/submit_unautoried.jsp</result>
</action>

<action name="Home" class="action.Home" method="execute">
<result name="success">/jsp/home.jsp</result>
</action>

<action name="Upload" class="action.Upload" method="execute">
<result name="success">/jsp/submit.jsp</result>
</action>

<action name="Post" class="action.Post" method="execute">
<result name="success">/jsp/post_finish.jsp</result>
<result name="error">/Mypage/Home</result>
<result name="input">/jsp/submit.jsp</result>
<interceptor-ref name="defaultStack">
<param name="fileUpload.allowedTypes">image/*</param>
<param name="fileUpload.maximumSize">10240</param>
</interceptor-ref>
</action>

<action name="Login" class="action.Login" method="execute">
<result name="success">/jsp/home.jsp</result>
</action>

</package>
</struts>

</CODE>

Why it's not being redirected the Prepost action?

Thanks in advance.


 
Nitin Surana
Ranch Hand
Posts: 129
Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try

http://localhost:8080/Mypage/Prepost.action

instead of

Fernando Dominguez wrote:Hello,

http://localhost:8080/Mypage/Prepost

 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nitin, but struts will add .action extension by default it doesn't make difference you are calling the action by it's name directly or by adding extension. After careful observation i got It's PrePost not Prepost
http://localhost:8080/Mypage/PrePost try this.
 
Fernando Dominguez
Ranch Hand
Posts: 108
Debian Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right.
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic