- This topic has 3 replies, 2 voices, and was last updated 14 years, 2 months ago by davemeurer.
-
AuthorPosts
-
Greg SoulsbyMemberHave generated my first app and am adding my first function. The button to trigger the new function is working and it points to /appname/newfunction.
So I copied one of the @RequestMapping sections from within a controler, leaving the code the same except for changing the name and the @RequestMapping to /appname/newfunction. Closed MyEclipse and re-started.
But when I click the button I get “http status 404 the requested resource is not available.”
Can you explain to a newbee what the process is for a new @RequestMapping?
Thanks
Greg
davemeurerMemberHello Greg,
It sounds like you have the Controller setup correctly. The other piece that needs to be configured is the web.xml.
In the WEB-INF/web.xml of a ME4S scaffolded MVC application, you’ll notice several servlet-mapping entries that match the Controller Request Mapping URLs. The reason these are all referenced in the web.xml is so the web service knows to direct the request to the Servlet. Otherwise, the server thinks someone is browsing to a directory.
You can also use wildcards in the servlet-mappings. For instance, you’ll find a *.action servlet-mapping. This states that any URL ending with “.action” will go through the Servlet. So, if you renamed your RequestMapping URL to /appname/newfunction.action, it should work without any modification to the web.xml. Or just add /appname/newfunction as a new servlet mapping and you should be all set.
Let me know if this helps.
Kind regards,
=Dave
Greg SoulsbyMemberThat’s great, not only fixed it but built a little my understanding of how Spring hangs together, which I see is a big job.
Thanks
PS any way you could help me with this problem? https://www.genuitec.com/forums/topic/failure-to-test/ – had no response so far
davemeurerMemberSounds great, Greg. I’m glad it helped.
re: PS – sorry, I can’t help with that one… but I will ask around and see if someone can take a look.
-
AuthorPosts