It's not a secret anymore!
The moose likes Struts and the fly likes Struts 2  struts.xml not redirecting  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2  struts.xml not redirecting  " Watch "Struts 2  struts.xml not redirecting  " New topic

Struts 2 struts.xml not redirecting

Fernando Dominguez
Ranch Hand

Joined: Sep 01, 2006
Posts: 104

When I try


The application is redirected to the default action by?

Here is my struts.xml

<?xml version="1.0" encoding="UTF-8" ?>
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"

<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 name="PrePost" class="action.PrePost" method="execute">
<result name="success">/jsp/submit.jsp</result>
<result name="error">/jsp/submit_unautoried.jsp</result>

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

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

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

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



Why it's not being redirected the Prepost action?

Thanks in advance.

Nitin Surana
Ranch Hand

Joined: Jan 21, 2011
Posts: 129



instead of

Fernando Dominguez wrote:Hello,


Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

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.

ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Fernando Dominguez
Ranch Hand

Joined: Sep 01, 2006
Posts: 104

You are right.
subject: Struts 2 struts.xml not redirecting
It's not a secret anymore!