Ashes Ashes - 2 months ago 9
Java Question

Difference between various Actions in programming

i have been studying about Struts2 and come across a question in my mind that what is the major difference between using various form actions

like we have action in our scripting language

javascript
we have action in
jquery


also in
struts2
we have action attribute in form and in submit also
so what is the basic purpose and the best used place for them .hope an example would clear all the difference.

<s:form name="xyz" action="xyz" method="post">


and

<s:submit action="xyz" />


and

document.getElementById("myForm").action="form_action.jsp";


although i know the advantage of using javascripts and jquery but wanted to know this so that net time i'll chose according to my need.

Answer

The main and major difference between then is that the Struts tags are JSP tags and run on server side, while HTML and javascript run on client side (in the browser). First action is an attribute of the Struts tag that accepts OGNL expressions to parse for URL. The second is just a static text referencing a JSP in the current context.

Comments