You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by hernan gonzalez <hg...@gmail.com> on 2010/09/13 20:46:16 UTC

Submit with several methods in Struts 2.2

This pattern ("submit" tag with method specified)
http://struts.apache.org/2.2.1/docs/html-form-buttons-howto.html
worked for me in my previous version (from Struts 2.1.6).
Now (in Struts 2.2.1), I can't make it work. It always calls "execute".
The only workaround I found was to set DynamicMethodInvocation=true (which
is discouraged in the docs, and was not necesary before).
Is this some documented change? Did I miss something?

Regards

Hernán

===================== sample code / configuration ================

public class TestMethodAction extends ActionSupport {
    private String param1 ="";

    public String myMethod() throws Exception {
        addActionMessage("Testing myMethod");
        return SUCCESS;
    }
    // setters / getters ....
}


and my Jsp:

<s:form>
 <s:textfield name="param1" label="Write something" />
 <s:submit value="Test" method="myMethod" />
 </s:form>
 <s:property value="param1"/>  <!-- for testing if the Param has been read
(this works ok)-->


Debug console info:


DEBUG [http-8080-1] org.apache.struts2.interceptor.FileUploadInterceptor
debug- Bypassing /test/TestMethod
DEBUG [http-8080-1]
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor
debug- Validating /test/TestMethod with method execute.

DEBUG [http-8080-1] org.apache.struts2.dispatcher.ServletDispatcherResult
debug- Forwarding to location /jsp/test/TestMethod.jsp
DEBUG [http-8080-1] org.apache.struts2.components.UIBean debug- Rendering
template /template/xhtml/actionmessage

struts.xml:

...
    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
    <constant name="struts.devMode" value="true" />
   ...
      <action name="TestMethod" class="myproject.struts2.TestMethodAction">
            <result>/jsp/test/TestMethod.jsp</result>
     </action>

==========================================================

Re: Submit with several methods in Struts 2.2

Posted by Ashlon Hill <cy...@ymail.com>.
I am using Struts 2 tags. Is there an easy way for me to "ghost" out one of the 
above textfields if the other one is clicked/selected? I can do it without using 
the struts 2 tags but how do you do it with them? 


<s:form name="exampleForm" action="exampleAction" > 
  <s:textfield name="txtName" label="Name" style="text-transform:uppercase" /> 
  <s:label value="OR" /> 
  <s:textfield name="txtEmail" label="Customer Email Address" /> 
    <tr> 
  <td>&nbsp;</td> 
  </tr> 
  <tr> 
  <td><input id="btnClear" type="button" width="50" value="Clear" 
  onclick="clearSearchParameters()" /></td> 
  <td><s:submit value="Submit" theme="simple" /></td> 
  </tr> 
  </s:form> 


      

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


Re: Submit with several methods in Struts 2.2

Posted by hernan gonzalez <hg...@gmail.com>.
Has it been included in the JIRA tracker?
https://issues.apache.org/jira/browse/WW
<https://issues.apache.org/jira/browse/WW>I don't see it


Hernán

On Tue, Sep 14, 2010 at 6:18 AM, Maqsud Mohammad <
maqsud.mohammad@ratedpeople.com> wrote:

> i raised this issue as a bug but havent got any updates from the struts2
> team yet.
>
>

Re: Submit with several methods in Struts 2.2

Posted by Maqsud Mohammad <ma...@ratedpeople.com>.
Hello Hernan

This was what i faced just a few days ago when we made a decision to
upgrade struts from 2.1.6 to 2.2.1 and we just followed the workaround
of setting the DynamicMethodInvocation=true, though it was discouraged,
i raised this issue as a bug but havent got any updates from the struts2
team yet.

If you have any updates can you please post it on the mailing list so it
will be useful to others.

cheers
Maqsud
On Mon, 2010-09-13 at 15:46 -0300, hernan gonzalez wrote:
> , I can't make it work. It always calls "execute".
> The only workaround I found was to set DynamicMethodInvocation=true
> (which
> is discouraged in the docs, and was not necesary before).
> Is this some documented change? Did I miss something?


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