Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP Best practice  RSS feed

 
vijay kumarg
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a j2ee tutorial I have seen the paths to the action attribute of a form have been specified by retrieving from pageContext implicit variable like below

<form action="${pageContext.request.contextPath}/orderForm" method=post>

Is it a best practice to do so?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it is.
Even if the application's root changes, your links won't be broken.
Waiting for some experts to bring light on that
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course it is. Otherwise the path gets hard-coded everywhere. How fragile.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!