You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Srineel Mazumdar <sm...@gmail.com> on 2012/11/18 20:36:29 UTC

Issue with entry in Struts.xml

Hi,

Please help.

*This particular entry is working fine*

<action name="signon" class="signonAction">
<result name="success">/WEB-INF/jsp/index.jsp</result>
</action>

*But this entry is not working*
*
*
 <action name="signon" class="signonAction"> <result
name="success">/shop/index.action</result>
</action>

*struts.xml*
*
*
<?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" />
<constant name="struts.action.extension" value="action" />
<constant name="struts.devMode" value="true" />

<package name="shop" extends="struts-default" namespace="/shop">

<default-interceptor-ref name="defaultStack" />
<global-results>
<result name="failure">/WEB-INF/jsp/Error.jsp</result>
<result name="unknown-error">/WEB-INF/jsp/Error.jsp</result>
<result name="global-signon">/WEB-INF/jsp/SignonForm.jsp</result>
</global-results>


<action name="addItemToCart" class="addItemToCartAction">
<result name="success">/WEB-INF/jsp/Cart.jsp</result>
</action>

<action name="checkout" class="viewCartAction">
<result name="success">/WEB-INF/jsp/Checkout.jsp</result>
</action>


<action name="editAccount" class="editAccountAction">
<result type="redirect-action">index</result>
<result name="input">/WEB-INF/jsp/EditAccountForm.jsp</result>
</action>


<action name="editAccountForm" class="editAccountFormAction">
<result name="success">/WEB-INF/jsp/EditAccountForm.jsp</result>
</action>

<action name="index" class="doNothingAction">
<result name="success">/WEB-INF/jsp/index.jsp</result>
</action>

<action name="listOrders" class="listOrdersAction">
<result name="success">/WEB-INF/jsp/ListOrders.jsp</result>
</action>

<action name="newAccount" class="editAccountAction">
<result type="redirect-action">index</result>
<result name="input">/WEB-INF/jsp/NewAccountForm.jsp</result>
</action>


<action name="newAccountForm" class="newAccountFormAction">
<result name="success">/WEB-INF/jsp/NewAccountForm.jsp</result>
</action>

<action name="newOrder" class="newOrderAction">
<result name="confirm">/WEB-INF/jsp/ConfirmOrder.jsp</result>
<result name="shipping">/WEB-INF/jsp/ShippingForm.jsp</result>
<result name="success">/WEB-INF/jsp/ViewOrder.jsp</result>
</action>

<action name="newOrderForm" class="newOrderFormAction">
<result name="success">/WEB-INF/jsp/NewOrderForm.jsp</result>
</action>

<action name="removeItemFromCart" class="removeItemFromCartAction">
<result name="success">/WEB-INF/jsp/Cart.jsp</result>
</action>

<action name="searchProducts" class="searchProductsAction">
<result name="success">/WEB-INF/jsp/SearchProducts.jsp</result>
</action>

<action name="signon" class="signonAction">
<result name="success">/WEB-INF/jsp/index.jsp</result>
</action>

<!-- <action name="signon" class="signonAction"> <result
name="success">/shop/index.action</result>
</action> -->

<action name="signonForm" class="doNothingAction">
<result name="success">/WEB-INF/jsp/SignonForm.jsp</result>
</action>

<action name="updateCartQuantities" class="updateCartQuantitiesAction">
<result name="success">/WEB-INF/jsp/Cart.jsp</result>
</action>

<action name="viewCart" class="viewCartAction">
<result name="success">/WEB-INF/jsp/Cart.jsp</result>
</action>


<action name="newAccount" class="editAccountAction">
<result type="redirect-action">index</result>
<result name="input">/WEB-INF/jsp/index.jsp</result>
</action>

<action name="viewItem" class="viewItemAction">
<result name="success">/WEB-INF/jsp/Item.jsp</result>
</action>

<action name="viewOrder" class="viewOrderAction">
<result name="success">/WEB-INF/jsp/ViewOrder.jsp"</result>
</action>

<action name="viewProduct" class="viewProductAction">
<result name="success">/WEB-INF/jsp/Product.jsp</result>
</action>


<action name="viewCategory" class="viewCategoryAction">
<result type="redirect-action">index</result>
<result name="success">/WEB-INF/jsp/Category.jsp</result>
</action>

</package>
</struts>

Regards,
Srineel

Re: Issue with entry in Struts.xml

Posted by Srineel Mazumdar <sm...@gmail.com>.
Thanks Dave.You got it right.

So you are saying that if I want to forward the output of an action to
another  action , I should use redirect action?? I will search for the
filter option.

Regards,
Srineel


On Mon, Nov 19, 2012 at 1:13 AM, Dave Newton <da...@gmail.com> wrote:

> > This entry is working:
> >
> > <action name="signon" class="signonAction">
> >   <result>/WEB-INF/jsp/index.jsp</result>
> > </action>
> >
> > This entry is not:
> >
> > <action name="signon" class="signonAction">
> >   <result>/shop/index.action</result>
> > </action>
>
> It's not entirely clear what the question is, but in case the
> statement is actually "why", I'll answer.
>
> The first result forwards to a JSP. The second attempts to forward to an
> action.
>
> You can set it so forwards are processed by the filter (I forget the
> exact configuration, something in web.xml, it's searchable), or you
> can redirect to the action by name, e.g.:
>
> <result type="redirectAction">index</result>
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Issue with entry in Struts.xml

Posted by Dave Newton <da...@gmail.com>.
> This entry is working:
>
> <action name="signon" class="signonAction">
>   <result>/WEB-INF/jsp/index.jsp</result>
> </action>
>
> This entry is not:
>
> <action name="signon" class="signonAction">
>   <result>/shop/index.action</result>
> </action>

It's not entirely clear what the question is, but in case the
statement is actually "why", I'll answer.

The first result forwards to a JSP. The second attempts to forward to an action.

You can set it so forwards are processed by the filter (I forget the
exact configuration, something in web.xml, it's searchable), or you
can redirect to the action by name, e.g.:

<result type="redirectAction">index</result>

Dave

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