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

How to generate custom user URL ?

 
Hatem Alimam
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody ...

I wonder how can I generate a custom user URL in java ?

I mean when a user registers in my website I want to generate a custom profile page url example : http//mydomain/username >>>>this url takes the user to his profile page

regards ))
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's pretty easy with URL mapping if your URL can have a few more parts, For example:

http://www.something.com/contextpath/profile/username

The contextpath is necessary for identifying the application (but can be omitted if the app is the root application), and profile can be a servlet mapping that invokes a servlet that will look up the user's profile and forward to a JSp for displaying it.

Within the servlet, the username part of the URL can be retrieved using the path info methods on the request.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic