This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic