This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
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.
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).