Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Action not being called in struts

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Which version of struts you are using?
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its working fine now..

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

Thankss a ton!!

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic