You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dave Newton <da...@gmail.com> on 2014/06/27 22:57:24 UTC

Re: struts2 s:url call action method

Do you have dynamic method invocation turned on?


On Fri, Jun 27, 2014 at 4:34 PM, john lee <sh...@yahoo.com.invalid>
wrote:

>
>
> I try to use s:url to call action's method, but not works, please advise
>
> from the executed link, it shows
> http://omega3.neucoinc.com/ecommerce/CartAction.action!additem?partid=1508,
> but logfile no method shows executed.
>
> i executed/tested manually by
> http://localhost/CartAction.action!add?partid=1508, shows no resource is
> available
>
> so, what is the correct way/syntax to use s:url tag to call action's
> method ?
>
> thanks in advnce
>
> john
>
> ***************************************************************************
>
> 3 files  (  CartAction.java, Cart.jsp, Struts.xml )
>
> Struts.xml
>            <action name="CartAction" class="CartAction"  method="add">
>                     <result name="success">Success.jsp</result>
>              </action>
>
> CartAction.java
>       public class CartAction extends ActionSupport {
>                      public String add() throws Exception {
>             ....
>       }
>
> Cart.jsp
>        <s:url action="CartAction" var="cartTag" method="add"
> escapeAmp="false">
>               <s:param name="partid"> <s:property value="partid"/>
> </s:param>
>        </s:url>
>        <s:a href="%{cartTag}">Add to Cart</s:a>




-- 
e: davelnewton@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton <https://twitter.com/dave_newton>
b: Bucky Bits <http://buckybits.blogspot.com/>
g: davelnewton <https://github.com/davelnewton>
so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>

Re: struts2 s:url call action method

Posted by Dave Newton <da...@gmail.com>.
On Fri, Jun 27, 2014 at 5:08 PM, john lee <sh...@yahoo.com.invalid>
wrote:

> How to verify ?
>

Check to see if you set ` struts.enable.DynamicMethodInvocation = true`
anywhere, preferably in struts.xml (instead of struts.properties).



-- 
e: davelnewton@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton <https://twitter.com/dave_newton>
b: Bucky Bits <http://buckybits.blogspot.com/>
g: davelnewton <https://github.com/davelnewton>
so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>

Re: struts2 s:url call action method

Posted by john lee <sh...@yahoo.com.INVALID>.

Hi Dave,

How to verify ?

thanks in advance

John 


On Friday, June 27, 2014 4:04 PM, Dave Newton <da...@gmail.com> wrote:
  


Do you have dynamic method invocation turned on?



On Fri, Jun 27, 2014 at 4:34 PM, john lee <sh...@yahoo.com.invalid>
wrote:

>
>
> I try to use s:url to call action's method, but not works, please advise
>
> from the executed link, it shows
> http://omega3.neucoinc.com/ecommerce/CartAction.action!additem?partid=1508,
> but logfile no method shows executed.
>
> i executed/tested manually by
> http://localhost/CartAction.action!add?partid=1508,shows no resource is
> available
>
> so, what is the correct way/syntax to use s:url tag to call action's
> method ?
>
> thanks in advnce
>
> john
>
> ***************************************************************************
>
> 3 files  (  CartAction.java, Cart.jsp, Struts.xml )
>
> Struts.xml
>            <action name="CartAction" class="CartAction"  method="add">
>                     <result name="success">Success.jsp</result>
>              </action>
>
> CartAction.java
>       public class CartAction extends ActionSupport {
>                      public String add() throws Exception {
>             ....
>       }
>
> Cart.jsp
>        <s:url action="CartAction" var="cartTag" method="add"
> escapeAmp="false">
>               <s:param name="partid"> <s:property value="partid"/>
> </s:param>
>        </s:url>
>        <s:a href="%{cartTag}">Add to Cart</s:a>




-- 
e: davelnewton@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton <https://twitter.com/dave_newton>
b: Bucky Bits <http://buckybits.blogspot.com/>
g: davelnewton <https://github.com/davelnewton>
so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton
>