• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Probably a very simple Spring problem?

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
Your mother was a hamster and your father was a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!