Note that there are some explanatory texts on larger screens.

plurals
  1. POStruts1.2 action class is not called
    primarykey
    data
    text
    <p>Here i am giving my code i am not getting output but action is called but action class is not called. what i suppose to do please help me. and what i am getting in url is</p> <pre><code>http://vpcl014:8080/StrutsExamples/loginPojoClass.do </code></pre> <p>but my file is not displaying and the actioncalss is not calling. what i should do :( PojoClass.</p> <pre><code>import org.apache.struts.action.ActionForm; public class LoginPojo extends ActionForm { /** * */ private static final long serialVersionUID = 962636910569104889L; private String username; private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } </code></pre> <p>Action Class:</p> <pre><code>import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; // action mapping class for the action. public class Pojoaction extends Action { // method for the mapping the action. public ActionForward execute(ActionForm form, ActionMapping mapping, HttpServletRequest request, HttpServletResponse response) throws Exception { System.out.println("Action is called..:D"); LoginPojo loginPojo = new LoginPojo(); loginPojo.setUsername("Username"); loginPojo.setPassword("Password"); return mapping.findForward("success"); } } </code></pre> <p>struts-cfg.xml file is here.</p> <p></p> <pre><code>&lt;form-beans&gt; &lt;form-bean name="LoginPojo" type="com.kishan.modelPojo.LoginPojo"&gt;&lt;/form-bean&gt; &lt;form-bean name="LoginPojoSuccess" type="com.kishan.modelPojo.LoginPojo.LoginPojoSuccess"&gt;&lt;/form-bean&gt; &lt;/form-beans&gt; &lt;action-mappings&gt; &lt;action path="/Forword" forward="/LoginPojo.jsp"&gt;&lt;/action&gt; &lt;action name="LoginPojo" path="/loginPojoClass" scope="session" type="com.kishan.modelPojo.Pojoaction" input="/LoginPojo.jsp" validate="false"&gt; &lt;forward name="success" path="/LoginPojoSuccess.jsp" redirect="true"&gt; &lt;/forward&gt; &lt;/action&gt; &lt;/action-mappings&gt; &lt;message-resources parameter="com.kishan.struts.ApplicationResources" /&gt; </code></pre> <p></p> <p>my jsp file where i am calling that method. </p> <pre><code> &lt;body&gt; &lt;html:form action="/loginPojoClass"&gt; Username:&lt;html:text property="username"&gt;&lt;/html:text&gt; &lt;br /&gt; Password:&lt;html:password property="password"&gt;&lt;/html:password&gt; &lt;br/&gt;&lt;html:submit value="Submit"&gt;&lt;/html:submit&gt; &lt;/html:form&gt; This is my JSP page. &lt;br&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>finally my index.jsp where i am putting my first forward action</p> <pre><code> &lt;html&gt; &lt;head&gt; &lt;base href="&lt;%=basePath%&gt;"&gt; &lt;title&gt;My JSP 'index.jsp' starting page&lt;/title&gt; &lt;meta http-equiv="pragma" content="no-cache"&gt; &lt;meta http-equiv="cache-control" content="no-cache"&gt; &lt;meta http-equiv="expires" content="0"&gt; &lt;meta http-equiv="keywords" content="keyword1,keyword2,keyword3"&gt; &lt;meta http-equiv="description" content="This is my page"&gt; &lt;!-- &lt;link rel="stylesheet" type="text/css" href="styles.css"&gt; --&gt; &lt;/head&gt; &lt;body&gt; &lt;html:link action="/Forword.do"&gt;GOTO FORM&lt;/html:link&gt; &lt;br&gt; &lt;/body&gt; &lt;/html&gt; </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