struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john lee <sh_thorn_b...@yahoo.com.INVALID>
Subject struts2 s:url call action method
Date Fri, 27 Jun 2014 20:34:33 GMT


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>
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message