Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Providing BackArrow without having to Hard Code it

 
Eric Racin
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Servlet that needs to have a 'Back Arrow' to go from the Form Servlet results page back to the main Form page. Right now I hard code it: where sAbsoluteURL is the IP address of the Server and sEntryPage is the Form HTML page. I read in sAbsoluteURL and sEntryPage from a file when the Servlet starts. Is there a more elegant way to do this? I tried using but couldn't get it to work right.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A number of things:
  • Don't use absolute URLs. They're a bad idea as you already seem to know.
  • User server-relative addresses that begin with the context path of the web app. You showed that you know how to get that from the request.
  • Don't capitalize your HTML. That's a bad habit from the 1990s.
  • Why are you emitting HTML from a servlet? You should be forwarding to a JSP to create the view.


  • When you are having a problem, tell us more than that it didn't work.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic