Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ContextPath in Struts 1.2

Status
Not open for further replies.

pajarokillo

Programmer
May 3, 2004
30
ES
Hi, i want to know as i can to obtain the value of the context path of my application in javascript through struts. Now, i obtain the value through JSTL, with the following code

<%@ taglib uri=" prefix="req" %>

<req:request id="req"/>

contextPath = "<jsp:getProperty name="req" property="contextPath" />";

There is other way to obtain the same result with other code more easy?
 
You can do it with just JSP expression without without Struts:

contextPath = '<%= request.getContextPath() %>';
 
ok, but there isn't difference of efficiency to do it between JSP JSTL?
 
ok, but there isn't difference of efficiency to do it between JSP or JSTL?
 
JSTL ( or tag library in general) just encapsulates some of the the core functionality by as simple tags. However, eventually, once those tags got complied into Java code, it ends up the same(similar) Java code as you would do normally with JSP code. I would say JSTL(Tag Linrary) is more efficient in coding in most cases (key functionality are defined by tags, you can reuse the code by calling the tag), but it not will not increase the speed of the page at all.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top