nitin
Mar 17th, 2005, 12:34 AM
Problem with AbstractWizardController..
i am not able to navigate from one page to the other using the AbstractWizardController
I think i am not providing the proper configuration parameters..
The config file is as follows:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="couponCommand" class="CouponCommand" />
<!-- ========================= CONTROLLER DEFINITIONS ========================= -->
<bean id="couponController" class="CouponController">
<property name="couponCommand">
<ref bean="couponCommand"/>
</property>
<property name="pages">
<list>
<value>couponAddEditFirstPageView</value>
<value>couponAddEditSecondPageView</value>
<value>couponAddEditThirdPageView</value>
<value>couponAddEditFourthPageView</value>
</list>
</property>
<property name="validator">
<bean class="CouponCommandValidator"/>
</property>
</bean>
</beans>
I am not sure wht the pages property should point to.. the jsp's??
How will the URL look like and whts the use of the form action parameter when we use variables like target1,target2 in the JSP html.
My controller file is as follows :
public class CouponController extends AbstractWizardFormController {
private CouponCommand couponCommand;
private CouponService couponService;
private final boolean SESSION_PARAM = true; //TODO set session param to
public CouponController() {
System.out.println("Inside Constructor...." + CouponCommand.class);
setCommandClass(CouponCommand.class);
//setPages(new String[] {"couponAddEditFirstPageView",
// "couponAddEditSecondPageView", "couponAddEditThirdPageView"});
}
protected int getTargetPage(HttpServletRequest request, Object command,
Errors errors, int currentPage) {
System.out.println("Inside Target Page");
if (currentPage == 0) {
return 1;
} else if (currentPage == 1) {
return 2;
} else {
return 3;
}
}
protected ModelAndView processFinish(HttpServletRequest request,
HttpServletResponse response, Object command, BindException errors)
throws Exception {
System.out.println("Inside Process Finish");
return new ModelAndView("coupon_add_edit_4.jsp");
}
protected Map referenceData(HttpServletRequest request, int page)
throws Exception {
System.out.println("referenceData method");
return null;
}
/**
* @param couponCommand
* The couponCommand to set.
*/
public void setCouponCommand(CouponCommand couponCommand) {
System.out.println("Inside Set Coupon Command");
this.couponCommand = couponCommand;
}
protected void validatePage(Object command, Errors errors, int page) {
System.out.println("Inside Validate Page");
}
}
I am going to the first page using a normal html href tag
a href= /admin/couponAddEdit1.coupon?_target0=submit
seems to be some problem in mapping.. can anyone shed light??????
i am not able to navigate from one page to the other using the AbstractWizardController
I think i am not providing the proper configuration parameters..
The config file is as follows:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="couponCommand" class="CouponCommand" />
<!-- ========================= CONTROLLER DEFINITIONS ========================= -->
<bean id="couponController" class="CouponController">
<property name="couponCommand">
<ref bean="couponCommand"/>
</property>
<property name="pages">
<list>
<value>couponAddEditFirstPageView</value>
<value>couponAddEditSecondPageView</value>
<value>couponAddEditThirdPageView</value>
<value>couponAddEditFourthPageView</value>
</list>
</property>
<property name="validator">
<bean class="CouponCommandValidator"/>
</property>
</bean>
</beans>
I am not sure wht the pages property should point to.. the jsp's??
How will the URL look like and whts the use of the form action parameter when we use variables like target1,target2 in the JSP html.
My controller file is as follows :
public class CouponController extends AbstractWizardFormController {
private CouponCommand couponCommand;
private CouponService couponService;
private final boolean SESSION_PARAM = true; //TODO set session param to
public CouponController() {
System.out.println("Inside Constructor...." + CouponCommand.class);
setCommandClass(CouponCommand.class);
//setPages(new String[] {"couponAddEditFirstPageView",
// "couponAddEditSecondPageView", "couponAddEditThirdPageView"});
}
protected int getTargetPage(HttpServletRequest request, Object command,
Errors errors, int currentPage) {
System.out.println("Inside Target Page");
if (currentPage == 0) {
return 1;
} else if (currentPage == 1) {
return 2;
} else {
return 3;
}
}
protected ModelAndView processFinish(HttpServletRequest request,
HttpServletResponse response, Object command, BindException errors)
throws Exception {
System.out.println("Inside Process Finish");
return new ModelAndView("coupon_add_edit_4.jsp");
}
protected Map referenceData(HttpServletRequest request, int page)
throws Exception {
System.out.println("referenceData method");
return null;
}
/**
* @param couponCommand
* The couponCommand to set.
*/
public void setCouponCommand(CouponCommand couponCommand) {
System.out.println("Inside Set Coupon Command");
this.couponCommand = couponCommand;
}
protected void validatePage(Object command, Errors errors, int page) {
System.out.println("Inside Validate Page");
}
}
I am going to the first page using a normal html href tag
a href= /admin/couponAddEdit1.coupon?_target0=submit
seems to be some problem in mapping.. can anyone shed light??????