Meaningless Drivel is fun!*
The moose likes JSP and the fly likes shorter way to access context path using EL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "shorter way to access context path using EL" Watch "shorter way to access context path using EL" New topic
Author

shorter way to access context path using EL

Kantutan Tayo
Greenhorn

Joined: Oct 07, 2005
Posts: 22
is there a shorter (built-in) way to access the context path using EL
i.e. shorter version of ${pageContext.request.contextPath}?
just wondering. because i have too much on my pages. i know it can be done by assigning some constant string = request.getContextPath(), so don't suggest that idea. :\

NOTE: im looking for a built-in method.


SCJP
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60783
    
  65



Now you can use ${contextPath} on the rest of the page.

Otherwise, no.
[ October 07, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kantutan Tayo
Greenhorn

Joined: Oct 07, 2005
Posts: 22
yeah, im already doing that. so no other way, eh?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60783
    
  65

Not built in. You could also set up a scoped variable in the controller. Or, since it will be invariant throughout the web app's life cycle, store it as an application-scoped variable at web app startup.
 
jQuery in Action, 2nd edition
 
subject: shorter way to access context path using EL
 
Similar Threads
Context Root of WebApplication in javascript
Accessing servlet-config parameter through EL
EL Help...
When you are using EL, do we HAVE to explictly write servlet code?
Correct specification of javascript library location