• 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 question

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hell,
I am having issues with a Simple Spring app.The formView page shows up.On submit of the page,the successView page does not show up.I get the message-"page not found".I am pretty sure that the path which I specified is correct in the xml file is correct.

Below is the code in the xml file:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

<!-- the application context definition for the springapp DispatcherServlet -->


<bean name="/hello.htm" class="stockmvc.web.HelloController">
<property name="formView" value="/jsp/newStock.jsp"/>
<property name="successView" value="/jsp/stockList.jsp"/>


</bean>


</beans>

The code in the controller class is as follows:


public class HelloController extends SimpleFormController {


public HelloController() {
setCommandClass(Stock.class);
}



public ModelAndView onSubmit(Object command) throws ServletException {

Stock stock = (Stock)command;

return new ModelAndView(new RedirectView(getSuccessView()));

}

}
I guess it can't get simpler than this.

Please advise.

Thanks
Richard
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It can, however, get easier to read ;)

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.
 
Richard Ellison
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok.Here is the formatted piece of code:



Hope this makes it clearer.

Thank you

Richard
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

i too newbie in spring mvc.
when looking your code and found the mistake in

actual code is

we need to set "contextRelative" to true.

Thanks & Regards,
Vijayaraja Varatharajan.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic