• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

ModelAndView returning wrong JSP

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I am new to this forum and trying to learn Spring.
I have a problem with a ModelAndView in my controller
and was wondering if anyone can help me out.

I hava a simple Administrator login page, when the administrator
logged in succesfully he comes to a page with a link directing to
a list of products. When he clicks te link I pass the list in a ModelAndView
with the JSP path it needs to call, but it seems to look for a different path.

Here is the admin page:


And here is the controller code


I also use a prefix and suffix in my controller xml file as you can see here:


So when I click the link on the administrator page I expect it to look for
"/ChocoWereld/WEB-INF/JSP/administrator/productlijst.jsp", instead i get:
"The requested resource (/ChocoWereld/WEB-INF/JSP/administrator/producten.jsp) is not available.".

I must be making some mistake but I can't figure it out. Help would be much appreciated.
Thanks!
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you have should work. Try cleaning out the contents of your wptwebapps directory cleaning your workspace and republishing the code. Maybe something is not getting updated correctly on your application server. Also try setting a break point and starting in debug mode. Do you have another handler method that could be getting the request and returning a view name of producten?
 
Bruno Dovogja
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all I thank you for your reply. I don't find a wptwebapps directory anywhere on my system. I tried to
re install my tomcat server but I keep having the same problem. The only handler methods I have so far
are the ones in my controller I posted above. When I try to google my particular problem it also seems
I am the only person having this, it's really weird.

Now suddenly without any change to the code the administrator login page stopped working too,
when i try to login it looks for the url: "http://localhost:8080/ChocoWereld/administrator/administrator".
 
Bill Gorder
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have the dispatcher servlet mapped to / in the web.xml?
 
Bruno Dovogja
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I resolved the issue.
It was a wrong import in my controller.



Should be:



Thank you for your replies!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic