I am bignner and I am trying to write simple spring example which takes name and surname input from jsp file and call the controller . Its initially showing jsp page proper but after click on submit button i am not getting success page, as i dig out the code i come to know its not calling controller properly. Please let me know where is the problem exactly. 1.<bean id="beanNameUrlMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"> <property name="order"><value>0</value></property> </bean>
Thanks for reply,I added doSubmitAction(Object command) method in my controller class but still the same problem i am not getting succesor page..its repetedly showling me only initial view page.As i observe its not reaching up to controller cause its not printing even Controller's construtor print statement.
I am giving here my complete controller class Thanks in advance
1.public class CreateContactController extends SimpleFormController{
private ContactService contactService;
public void setContactService(ContactService contactService) { this.contactService = contactService; } public CreateContactController() { System.out.println("this is CreateContactController CreateContactController()"); setCommandClass(Contact.class); } //public ModelAndView onSubmit(Object command) throws ServletException { // System.out.println("done"); //Contact contact=(Contact) command; // ContactService.createContact(contact); //return new ModelAndView(new RedirectView(getSuccessView())); // }
public void doSubmitAction(Object command){ System.out.println("this is CreateContactController doSubmitAction"); Contact contact = (Contact)command; ContactService.createContact(contact); } }
Rob Bradley
Greenhorn
Joined: Oct 10, 2003
Posts: 1
posted
0
Nuri Jain wrote:Thanks for reply,I added doSubmitAction(Object command) method in my controller class but still the same problem i am not getting succesor page..its repetedly showling me only initial view page. As i observe its not reaching up to controller cause its not printing even Controller's construtor print statement.
I don't know if you still visit these forums Nuri but I was wondering if you ever managed to resolve this issue? I am having exactly the same problem right now, no matter what I do neither onSubmitAction nor doSubmitAction are ever getting called.
Check the workflow again in the API docs referenced above... Step 4:
If no errors occurred, the controller will call onSubmitAction...
One or more errors are being thrown before getting to onSubmitAction - probably form validation.
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Tanvi Narula
Greenhorn
Joined: Sep 30, 2008
Posts: 9
posted
0
Hi,
I am also facing the same issue. Can anybody let me know how to check the errors that are being thrown. Because as such I am not using any form validations
jay anandan
Greenhorn
Joined: Apr 01, 2011
Posts: 2
posted
0
check your form method whether it is "GET" or "POST". By default, only POST is treated as form submission. you can override the method "isFormSubmission" in your controller and decide when form submission should happen.