Reputation: 1376
I am setting the context path in jsp page but it is showing error while running the jsp page.
as shown below.
<c:set var="path" value="${pageContext.request.contextPath}"/>
<% urlName='<c:out value="${path}"/>/tran/handleTransactionResults.do'; %>
${path} is not showing the context path.
Upvotes: 0
Views: 1564
Reputation: 17535
You cannot use JSP tags within a scriptlet. Do it like this:
<c:set var="path" value="${pageContext.request.contextPath}"/>
<% urlName= request.getAttribute("path") + "/tran/handleTransactionResults.do"; %>
Or even easier:
<% urlName= request.getContextPath() + "/tran/handleTransactionResults.do"; %>
If you simply want to output your path, you can use the <%= %>
shortcut:
<%= request.getContextPath() + "/tran/handleTransactionResults.do"; %>
Upvotes: 3