• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

execute method not being called

 
Juliette White
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic