• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to set distinct URL for every user?

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Is there any way to set a distinct URL for every users without making new jsp or passing a parameter(user ids) along with url.

Lets imagine this my project "http://hostname:portnumber/project". Any one can register here then i have to show the user's page like "http://hostname:portnumber/project/user1".

I tried in another way "http://hostname:portnumber/project/userpage.jsp?userid=1233"; its working also. But client need distinct url what i mentioned above ("http://hostname:portnumber/project/user1";).

Any idea?

Thanks in advance!
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to modify url like "http://hostname:portnumber/project/user/user1"; , where 'user1' I'm considering as user's registered name.
 
Venki Ananth
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sagar!

Could you please explain me little clear! What is "user"? and how can i get "user1" in my page to identify a user so i can show his/her data alone!

 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here, "user/user1" is part of url which maps to the servlet for user action. In DD, you define something like this,

[Please dig up little about how to use the wild card '*'.]

In UserServlet, you can extract the part of request url, which gives you 'user1', and you can do what ever you want to do with that user. This idea is implemented here on JR, like 'My Posts' [See URL].
 
Venki Ananth
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cool! Got clear idea! Thanks Sagar.
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My pleasure
    Bookmark Topic Watch Topic
  • New Topic