Win a copy of Terraform in Action this week in the Cloud 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

Probably a very simple Spring problem?

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using Spring 2

I have 2 JSP pages both have SimpleFormControllers behind them -

public class LoginController extends SimpleFormController{
....

public class ListReturnsController extends SimpleFormController{
....


what I want to do is when the Login button is pressed on login.jsp control passes to listreturns.jsp and methods like ListReturnsController's referenceData() get called to prepopulate it etc... BEFORE the actual listreturns.jsp is displayed?

I thought this would very simple but as a newbie it's not to be!

So basically my login.jsp looks like this -

<form:form method="POST" action="login.htm" commandName="login">
...
<input type="submit" name="_login" value="Login" />

In LoginController - onSubmit() I'm doing this -

protected ModelAndView onSubmit(HttpServletRequest request, ..........) throws Exception
{
......
if (WebUtils.hasSubmitParameter(request, "_cancel"))
{
return new ModelAndView("listreturns");
}
......

but listreturns.jsp is opened WITHOUT referenceData() being called!

Can anyone help? - I know it's bound to be sonething stupid I'm doing/not doing but just can't see it at the moment?

my config file looks like this -

<beans>
<bean id="loginController"
class="uk.gov.ea.gor.controller.LoginController">
<property name="formView" value="login" />
<property name="successView" value="listreturns" />
</bean>

<bean id="listReturnsController"
class="uk.gov.ea.gor.controller.ListReturnsController">
<property name="formView" value="listreturns" />
<property name="successView" value="changepassword" />
</bean>

<bean id="changePasswordController"
class="uk.gov.ea.gor.controller.ChangePasswordController">
<property name="formView" value="changepassword" />
<property name="successView" value="listreturns" />
</bean>

<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/login.htm">loginController</prop>
<prop key="/listreturns.htm">listReturnsController</prop>
<prop key="/changepasssword.htm">changePasswordController</prop>
</props>
</property>
</bean>

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.JstlView</value>
</property>
<property name="prefix">
<value>/WEB-INF/jsp/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans>

thanks in advance & hope I've explained this properly!

harry
 
A Harry
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in fact just noticed in the logging output I get this -

<Rendering view with name 'listreturns' with model null and static attributes {}>

surely the model should be an object not null?
 
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