File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes execute method not being called Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "execute method not being called" Watch "execute method not being called" New topic
Author

execute method not being called

Juliette White
Greenhorn

Joined: Oct 12, 2007
Posts: 1
I've just had a project at work handed over to me that uses Struts 1.2 - I'm not really a Java programmer, so sorry if this is very much a beginner question! If somebody can give me some advice here, I promise to go and try and answer questions on the things on the less Java-orientated forums here that I do know about :-)

I've got a login form that is posted to Login.do when it's submitted.

In my struts-config.xml file I have:



But the execute method in the LoginAction class doesn't seem to be being called when the form is submitted. Struts seems to be working fine on the other pages of the site that I can actually get to. The LoginAction class extends Action and the excute method has the right arguments etc.

I'm not quite sure what I should be checking or where to start debugging this - does anybody have any hints?

Thanks,
Juliette
John Simpson
Greenhorn

Joined: Sep 10, 2007
Posts: 25
Make sure that the form name in the .jsp matches the 'name' attribute of the struts-config.xml file.

Are you getting any error?

???
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Show us the <html:form> or <form> tag from your JSP.

If you're using JDK 1.5 or above, one good way to check that you have the right signature for your execute method is to place the annotation @Override above the method. This will cause the compiler to check and make sure the method has the same signature as the one in the superclass.


Merrill
Consultant, Sima Solutions
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Also...I see that your action mapping has validate set to true. Do you have any validation rules defined? If validation fails then your execute method will never get called. Instead Struts will redirect to back to login.jsp (as specified by your input attribute).

- Brent
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: execute method not being called