aspose file tools*
The moose likes Other Application Frameworks and the fly likes Spring MVC problem with AbstractWizardFormCOntroller Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Spring MVC problem with AbstractWizardFormCOntroller" Watch "Spring MVC problem with AbstractWizardFormCOntroller" New topic
Author

Spring MVC problem with AbstractWizardFormCOntroller

murwath ali
Greenhorn

Joined: Dec 24, 2008
Posts: 4
I am putting my code,


spring-servlet.xml
____________________

<?xml version="1.0"?>
<!DOCTYPE beans PUBLIC
"-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

<bean name="/controller.spring" class="controller">
<property name="pages">
<list>
<value>courseFeedback</value>
<value>materialProvided</value>
</list>
</property>
</bean>


<!-- code of internalresourceviewresolver -->
<bean id="..."/>
<property name="suffix">
<value>.jsp</value>
</property>
</beans>


coursename.jsp :
________________

/* CourseName.jsp */
<form action="controller.spring">
CourseName :
<input type="text" name="courseName"/>
<input type="submit"/>
</form>


coursefeedback.jsp :
____________________

/* courseFeedback.jsp */
<form action="controller.spring">
CourseFeedback :
<input type="text" name="courseFeedback"/>
<input type="submit" value="Next" name="_target1">
<input type="submit" value="Cancel" name="_cancel">
<input type="submit" value="Finish" name="_finish">
</form>


/* materialProvided.jsp */
______________________


<form action="controller.spring">
MaterialProvided :
<input type="text" name="materialProvided"/>
<input type="submit" value="Back" name="_target0">
<input type="submit" value="Finish" name="_finish">
<input type="submit" value="Cancel" name="_cancel">
</form>

/* controller.java */
________________
import packages.....;

public class controller extends AbstractWizardFormController
{
public controller()
{
setCommandClass(bean.class);
}

protected ModelAndView processFinish(HttpServletRequest request,
HttpServletResponse response, Object command,
BindException errors) throws Exception {
bean b=(bean)command;
System.out.println(b.getCourseName()+" "+b.getCourseFeedback()+" "+b.getMaterialProvided());
return new ModelAndView("success");
}


protected ModelAndView processCancel(HttpServletRequest request,
HttpServletResponse response, Object command,
BindException bindException) throws Exception {
return new ModelAndView("/CourseName.jsp");
}
}



bean.java :
__________

/* bean.java */
public class bean
{
String courseName,courseFeedback,materialProvided;
public void setCourseName(String courseName)
{
this.courseName=courseName;
}
public String getCourseName()
{
return courseName;
}


public void setCourseFeedback(String courseFeedback)
{
this.courseFeedback=courseFeedback;
}
public String getCourseFeedback()
{
return courseFeedback;
}


public void setMaterialProvided(String materialProvided)
{
this.materialProvided=materialProvided;
}
public String getMaterialProvided()
{
return materialProvided;
}}


The problem is when i deploy my app.. in server and lookup the coursename.jsp ,it comes and later goes to controller and later goes to

coursefeedback.jsp and if i click 'next' button present in coursefeedback.jsp , i am not able to navigate to any other page and i am redirected to same coursefeedback.jsp ,The actual page that must be displayed is materialprovided.jsp
Elie Hirschman
Ranch Hand

Joined: Dec 15, 2005
Posts: 37
Try making _target1 a separate form field, instead of part of the submit button:



This has been working for me.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Spring MVC problem with AbstractWizardFormCOntroller
 
Similar Threads
Spring Commons Validation with AbstractWizardFormController
AbstractWizardFormController: teasing command object
Neither BindingResult nor plain target object for bean name 'user' available as request attribute
AbstractWizardFormController: java.lang.NullPointerException at processFinish(...)
Problem in using multiaction controller in spring