Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong><a href="http://www.rameshsengani.in/vaannila/struts/struts-tutorial/struts-tutorial.html" rel="nofollow">BEST LINK TO LEARN</a></strong></p> <p>register.jsp</p> <pre><code> &lt;form name="myform"&gt; // other inputs going here &lt;input type="button" name="add" value="add" id="add" onclick="submitAction(this)"&gt; &lt;input type="button" name="update" value="update" id="update" onclick="submitAction(this)"&gt; &lt;input type="button" name="delete" value="delete" id="delete" onclick="submitAction(this)"&gt; &lt;/form&gt; </code></pre> <p>javascript:</p> <pre><code>function submitAction(actType) { document.myform.action = actType.id; document.myform.submit(); } &lt;action name="MyUpdateAction" type="test.MyUpdateAction" path="/update" input="/register.jsp"&gt; &lt;forward name="success" path="/updated.jsp" /&gt; &lt;forward name="failure" path="/failure.jsp" /&gt; &lt;/action&gt; &lt;action name="MyAddAction" tepe="test.MyAddAction" path="/add" input="/register.jsp"&gt; &lt;forward name="success" path="/added.jsp" /&gt; &lt;forward name="failure" path="/failure.jsp" /&gt; &lt;/action&gt; &lt;action name="MyDeleteAction" type="test.MyDeleteAction" path="/delete" input="/register.jsp"&gt; &lt;forward name="success" path="/deleted.jsp" /&gt; &lt;forward name="failure" path="/failure.jsp" /&gt; &lt;/action&gt; </code></pre> <p>Struts Actions in package test:</p> <pre><code> public class MyUpdateAction extends org.apache.struts.action.Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { //do update Stuff... if () { return mapping.findForward("success"); } else { return mapping.findForward("failure");} } public class MyAddAction extends org.apache.struts.action.Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { //do add Stuff... if () { return mapping.findForward("success"); } else { return mapping.findForward("failure");} } public class MyDeleteAction extends org.apache.struts.action.Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { //do delete Stuff... if () { return mapping.findForward("success"); } else { return mapping.findForward("failure");} } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload