HI All,
I am trying to write a simple code in
struts. The folowing are what I did
- Configured action in web.xml
<
servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
- Configured Form and Action in struts-config.xml file
<struts-config>
<form-beans>
<form-bean name="helloWorldForm" type="com.uhg.HelloWorldForm"></form-bean>
</form-beans>
<action-mappings>
<action path="/helloWorld" type="com.uhg.HelloWorldAction" name="helloWorldForm">
<forward name="succes" path="/jsp/sucess.jsp"/>
<forward name="fail" path="/jsp/failure.jsp"/>
</action>
</action-mappings>
</struts-config>
- The below is my Action class
public class HelloWorldAction extends Action {
public ActionForward execute(ActionForm form, ActionMapping mapping,
HttpServletRequest req, HttpServletResponse res) {
System.out.println("-----------Entered Action--------");
return mapping.findForward("success");
}
}
When I am trying to run the application on my server, the action is not being called. Its showing the logs as below and Action is not being called.
[11/30/12 10:53:24:802 IST] 00000017 ComposableReq I org.apache.struts.chain.ComposableRequestProcessor init Initializing composable request processor for module prefix ''
[11/30/12 10:53:24:833 IST] 00000017 CreateAction I org.apache.struts.chain.commands.servlet.CreateAction createAction Initialize action of type: com.uhg.HelloWorldAction
Please help me in showing me where I went wrong. Any small help is highly appreciable.
Thanks in Advance.