• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to resolve URL issue while hosting?

 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I developed a couple of jsp pages now when I am uploading it I have to change URLs everywhere and its taking a lot of time. IN eclipse we have to give url as localhost:portNumber/appName/pageName but it gets changed when we host.

Please suggest the best practice which should be followed to avoid this cumbersome work.
[ November 24, 2008: Message edited by: Himanshu Gupta ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you hard-coding the domain into your URLs?
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes... Is their anything else that can be done.. like using property files???
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not be hard-coding the domain into your URLs. You should be using server-relative URLs or context-relative URLs (depending upon whether the reference is from the client or server, respectively). That way, the application works no matter where it is deployed.
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IS there any major difference between these two. Which one should be used? IS there any advantage of using one over other? Please help.
 
Sachin Kumar
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Benefit is over the problem you are facing as you move code from local to UI to CI to QA to Contigency To Prod, you don't need to change the jsp page.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You use server-relative addressing from the client. In other words, the URL's of images, style sheets, script files and the like.

You use context-relative addressing on the server: forwards and the like
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Sachin Kr", please check your private messages for an important administrative matter.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!