• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring MVC problem with AbstractWizardFormCOntroller

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try making _target1 a separate form field, instead of part of the submit button:



This has been working for me.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic