• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

spring mvc

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello I m creating a spring mvc web project using intellijiee IDE and tomcat 9 server every thing going perfect
I m facing problem with my urls

If I put all my jsp files inside WEB_INF->VIEW->index.jsp,about.jsp

on starting my server 404 error is there but if I put index.jsp under Webapp it works perfect

but problem is when I hit url like localhost:8080/about it works because I configure it in controller
but when I hit localhost:8080/ 404 error is found because my index page is not now inside VIEW folder

below all jsps are under WEB_INF->VIEW->about.jsp,help.jsp,contact.jsp but my index is not under it because on starting server I face 404
when I hit /home index.jsp not runs It shows 404 but a little trick works If I put index.jsp inside VIEW as well and webapp folder too then my problem solves
What Should I do?
 
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about adding "" to @RequestMapping. If you prefer not to use any relative URL, then add this blank. The URL will be localhost:8080/ to access to index.
 @RequestMapping({"", "/home"})
public String home(){
 
 
   return "index";
}
 
obaid abbassi
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks a lot, it worked.

Now please tell me can we use any other technology for frontend with same project instead of index.jsp like react app.js etc please guide me
can spring mvc handle data from react and send it in db like mysql?
 
Himai Minh
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe Spring MVC supports different frontend technologies such as Thymeleaf.

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic