Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display JSP on custom URL

 
Glen Iris
Ranch Hand
Posts: 172
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am developing (design stage) a web application. I would like to display each page in the app on its own custom URL. For example, Facebook allows users to have their own sub-url (facebook.com/users-custom-url). I would like my application to do the same but mine will be automated, my page URL's will be auto generated depending on the page content and this URL will be stored in a database.

Any suggestions that you have which would allow me to achieve this would be appreciated, for example, is this something the Spring framework offers?

Thanks,

G
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65105
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a Front Controller that gets called for all "custom" URLs (though not for images, scripts and other resources). This is easier if there is a specific prefix used for all "custom" pages.

The Front Controller can look up the association with the actual page for the "custom" suffix, and forward to that location. The URL in the browser will remain unchanged.

Could also be done with a filter.
 
Glen Iris
Ranch Hand
Posts: 172
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Marshal! I will use that as a starting point for my research. If anybody else has suggestions / ideas, I'd love to hear them too.

G
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic