File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Action not being called in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Action not being called in struts" Watch "Action not being called in struts" New topic

Action not being called in struts

Vijaya Parvathaneni

Joined: Nov 29, 2012
Posts: 3
HI All,
I am trying to write a simple code in struts. The folowing are what I did
- Configured action in web.xml



- Configured Form and Action in struts-config.xml file

<form-bean name="helloWorldForm" type="com.uhg.HelloWorldForm"></form-bean>
<action path="/helloWorld" type="com.uhg.HelloWorldAction" name="helloWorldForm">
<forward name="succes" path="/jsp/sucess.jsp"/>
<forward name="fail" path="/jsp/failure.jsp"/>


- 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.
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368

Which version of struts you are using?

Vanessa Danin
Ranch Hand

Joined: Oct 04, 2004
Posts: 34
It looks like Vijaya is using Struts 1. Vijaya, two issues I noticed were:
1) The Struts Action class has an execute method defined with these parameters in this order: (ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res). However, your execute method has the ActionForm parameter declared first followed by the ActionMapping parameter.
2) You haven't shown your view using a path mapped to your Action class (i.e. does the jsp you are using to invoke this Action class have the form action value set to
Vijaya Parvathaneni

Joined: Nov 29, 2012
Posts: 3
Its working fine now..

The only change made was the sequence of the execute method parameters.

Thankss a ton!!

subject: Action not being called in struts