Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Know technique for dynamic URL change

 
Ramesh Sengani
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am working on real estate forum site where person can add there personal opinions , questions ,solutions etc.

I want to make that site SEO friendly.for that i need topic's Subject/title in url .
for coderanch Eg. http://www.coderanch.com/t/572347/Servlets/java/Servlet-Asynchronous-Operations

http://www.coderanch.com/t/572113/Web-Services/java/SOAP-REST-tightly-loosely-coupled

above url changing for each topic.how this i make possible by using java ,servlet ?
 
Dhaval J. Patel
Ranch Hand
Posts: 90
Eclipse IDE Java Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Google search URL rewriting.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only required part is everything up to the thread ID (http://www.coderanch.com/t/572113/), everything behind that is not significant and can be chosen at will (or left out altogether). So there's no "rewriting" going on here.
 
Ramesh Sengani
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i agree with Marshal.. But In my servlet code i make that possible.? i am not getting any idea
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Making what possible? Creating URLs that contain parts which your web app simply ignores?
 
Ramesh Sengani
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need that technique in my project. how do i make that possible in project. Suggest with some good example if you can. I am using Servlet + struts2
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Making what possible?

It's a URL to which you append whatever strikes your fancy when you display it someplace. Are you asking how to do string concatenation?
 
Ramesh Sengani
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need in struts2. Is possible for you to give some small example on it
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An example of what? What, specifically, are you struggling with to implement?
 
Wayan Saryada
Ranch Hand
Posts: 105
IntelliJ IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think what Ramesh want is how he can create or implement a SEO friendly url in his Struts application.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But there's nothing to it. If "http://www.coderanch.com/t/572113/" is the integral URL, all you need to do is to set up whatever code handles "/t" URLs to extract the ID from the URL and ignore everything that comes after it.
 
Ramesh Sengani
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for understanding my need Wayan..

Ulf Dittmer you are right but how can i cancat title or subject of topic before fetch. As per your suggestion "http://www.coderanch.com/t/572113/" based on 572113 id i will fetch topic from db. but i need url like this http://www.coderanch.com/t/572347/Servlets/java/Servlet-Asynchronous-Operations ,which is not possible before fetching..


Sorry i am stretching this topic but solution is really helpful for me
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "fetching", and what does a DB have to do with non-functional parts of an URL? Wherever you want to display the URL, just append whatever you want appended, and then ignore it when interpreting it on the server. That has no bearing on how the page that's behind the URL is stored or retrieved.
 
John McCall
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys, this post helped me a lot, I was going to ask about this issue but I found that Ramesh already asked it

I appreciate your efforts..

Thanks again
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic