Thank you all very much:

I have another question:

I need to do a submit in javascript like this:
    
   <s:form method="post">
           <s:select name="country" label="Country" emptyOption="true" 
            list="#application.countries" 
            onchange="this.form.submit()" /> 
   </s:form>

 Only to refresh the form, and make visible another form options:

         <c:choose>
            <c:when test="${country == 'spain'}">
                <s:select ...>
            </c:when>
            <c:otherwise>
                <s:select ...>
            </c:otherwise>
        </c:choose>

Could i use an action defined like this, to call a method that only returns
a success? :

       <action name="refreshForm" class="com.MyAction" method="refresh">
            <result name="success">/WEB-INF/pages/myForm.jsp</result>
        </action>

     
        ...
       public class MyAction extends BaseAction {

        [...]

           public String refresh() throws IOException {
                return SUCCESS;
            }
       }

And could I add a javascript like this?:

     <s:form method="post">
           <s:select name="country" label="Country" emptyOption="true" 
            list="#application.countries" 
            onchange="sending()" /> 

      </s:form>

          <script type="text/javascript">
              function sending() {
                       this.form.action = 'refreshForm';
                       this.form.submit();
             }
             </script>

Sorry if it's a redundant question, i am reading as quick as i can about
struts 2, i'm reading lot of books, and watching lots of examples, but i
haven't found about this exact question yet, or I am a dumb and I can't
understand about relations beetween forms and actions.

Greetings.

-- 
View this message in context: 
http://n4.nabble.com/Javascript-and-Struts2-tp1596342p1748529.html
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to