You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by hezjing <he...@gmail.com> on 2007/06/21 06:56:45 UTC
How to invoke actions in different configuration packages
Hi!
When we have the Struts configuration below:
<package name="person" extends="struts-default">
<action name="list" method="execute" class="personAction">
<result>pages/persons.jsp</result>
</action>
</package>
We can invoke the action by /list.action.
Why do we want to create a package like the above?
But can we have multiple packages like the following?
<package name="person" extends="struts-default">
<action name="list" method="execute" class="personAction">
<result>pages/persons.jsp</result>
</action>
</package>
<package name="product" extends="struts-default">
<action name="list" method="execute" class="productAction">
<result>pages/products.jsp</result>
</action>
</package>
How do we invoke the list action for person and product?
--
Hez
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
答复: 答复: How to invoke actions in different configuration packages
Posted by chenshibing <ch...@lifeisgreat.com.cn>.
I have no idea. Actually, Struts2 will prefix url with the namespace.
陈仕兵
GIMS, IT Application Development
Great Eastern Life Assurance (China) Co. Ltd.
Tel: 86-023-6805-3128
Fax: 86-023-68053154
Mbl: 86-023-66101533
-----邮件原件-----
发件人: hezjing [mailto:hezjing@gmail.com]
发送时间: 2007年6月21日 14:11
收件人: Struts Users Mailing List
主题: Re: 答复: How to invoke actions in different configuration packages
Thank you, it works!
However, we also required to move WEB-INF/pages/persons.jsp
to WEB-INF/user/pages/persons.jsp and WEB-INF/pages/products.jsp
to WEB-INF/product/pages/products.jsp
Is there a way to keep all JSPs in WEB-INF/pages without moving them?
On 6/21/07, chenshibing <ch...@lifeisgreat.com.cn> wrote:
> You should add a name space for person and product package, as following:
>
> <package name="person" extends="struts-default" namespace="/person">
> <action name="list" method="execute" class="personAction">
> <result>pages/persons.jsp</result>
> </action>
> </package>
> <package name="product" extends="struts-default" namespace="/product">
> <action name="list" method="execute" class="productAction">
> <result>pages/products.jsp</result>
> </action>
> </package>
>
> And invoke action using /person/list.action, /product/list.action.
>
> 陈仕兵
> GIMS, IT Application Development
> Great Eastern Life Assurance (China) Co. Ltd.
> Tel: 86-023-6805-3128
> Fax: 86-023-68053154
> Mbl: 86-023-66101533
>
> -----邮件原件-----
> 发件人: hezjing [mailto:hezjing@gmail.com]
> 发送时间: 2007年6月21日 12:57
> 收件人: struts-users
> 主题: How to invoke actions in different configuration packages
>
> Hi!
>
> When we have the Struts configuration below:
>
> <package name="person" extends="struts-default">
> <action name="list" method="execute" class="personAction">
> <result>pages/persons.jsp</result>
> </action>
> </package>
>
>
> We can invoke the action by /list.action.
>
> Why do we want to create a package like the above?
>
>
> But can we have multiple packages like the following?
>
> <package name="person" extends="struts-default">
> <action name="list" method="execute" class="personAction">
> <result>pages/persons.jsp</result>
> </action>
> </package>
> <package name="product" extends="struts-default">
> <action name="list" method="execute" class="productAction">
> <result>pages/products.jsp</result>
> </action>
> </package>
>
>
> How do we invoke the list action for person and product?
>
>
> --
>
> Hez
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Hez
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: 答复: How to invoke actions in different configuration packages
Posted by hezjing <he...@gmail.com>.
Thank you, it works!
However, we also required to move WEB-INF/pages/persons.jsp
to WEB-INF/user/pages/persons.jsp and WEB-INF/pages/products.jsp
to WEB-INF/product/pages/products.jsp
Is there a way to keep all JSPs in WEB-INF/pages without moving them?
On 6/21/07, chenshibing <ch...@lifeisgreat.com.cn> wrote:
> You should add a name space for person and product package, as following:
>
> <package name="person" extends="struts-default" namespace="/person">
> <action name="list" method="execute" class="personAction">
> <result>pages/persons.jsp</result>
> </action>
> </package>
> <package name="product" extends="struts-default" namespace="/product">
> <action name="list" method="execute" class="productAction">
> <result>pages/products.jsp</result>
> </action>
> </package>
>
> And invoke action using /person/list.action, /product/list.action.
>
> 陈仕兵
> GIMS, IT Application Development
> Great Eastern Life Assurance (China) Co. Ltd.
> Tel: 86-023-6805-3128
> Fax: 86-023-68053154
> Mbl: 86-023-66101533
>
> -----邮件原件-----
> 发件人: hezjing [mailto:hezjing@gmail.com]
> 发送时间: 2007年6月21日 12:57
> 收件人: struts-users
> 主题: How to invoke actions in different configuration packages
>
> Hi!
>
> When we have the Struts configuration below:
>
> <package name="person" extends="struts-default">
> <action name="list" method="execute" class="personAction">
> <result>pages/persons.jsp</result>
> </action>
> </package>
>
>
> We can invoke the action by /list.action.
>
> Why do we want to create a package like the above?
>
>
> But can we have multiple packages like the following?
>
> <package name="person" extends="struts-default">
> <action name="list" method="execute" class="personAction">
> <result>pages/persons.jsp</result>
> </action>
> </package>
> <package name="product" extends="struts-default">
> <action name="list" method="execute" class="productAction">
> <result>pages/products.jsp</result>
> </action>
> </package>
>
>
> How do we invoke the list action for person and product?
>
>
> --
>
> Hez
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Hez
答复: How to invoke actions in different configuration packages
Posted by chenshibing <ch...@lifeisgreat.com.cn>.
You should add a name space for person and product package, as following:
<package name="person" extends="struts-default" namespace="/person">
<action name="list" method="execute" class="personAction">
<result>pages/persons.jsp</result>
</action>
</package>
<package name="product" extends="struts-default" namespace="/product">
<action name="list" method="execute" class="productAction">
<result>pages/products.jsp</result>
</action>
</package>
And invoke action using /person/list.action, /product/list.action.
陈仕兵
GIMS, IT Application Development
Great Eastern Life Assurance (China) Co. Ltd.
Tel: 86-023-6805-3128
Fax: 86-023-68053154
Mbl: 86-023-66101533
-----邮件原件-----
发件人: hezjing [mailto:hezjing@gmail.com]
发送时间: 2007年6月21日 12:57
收件人: struts-users
主题: How to invoke actions in different configuration packages
Hi!
When we have the Struts configuration below:
<package name="person" extends="struts-default">
<action name="list" method="execute" class="personAction">
<result>pages/persons.jsp</result>
</action>
</package>
We can invoke the action by /list.action.
Why do we want to create a package like the above?
But can we have multiple packages like the following?
<package name="person" extends="struts-default">
<action name="list" method="execute" class="personAction">
<result>pages/persons.jsp</result>
</action>
</package>
<package name="product" extends="struts-default">
<action name="list" method="execute" class="productAction">
<result>pages/products.jsp</result>
</action>
</package>
How do we invoke the list action for person and product?
--
Hez
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org