Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get page name using jsp or JSTL ?
05-18-2009, 11:38 AM (This post was last modified: 05-18-2009 11:40 AM by naruponk.)
Post: #1
How to get page name using jsp or JSTL ?
How to get page name using jsp or JSTL ?
I'm now using <c:out value="${pageContext.request.requestURL}"/>
it return a path, how can I get only file name ?
Visit this user's website Find all posts by this user
Quote this message in a reply
05-18-2009, 02:44 PM
Post: #2
RE: How to get page name using jsp or JSTL ?
Try the following code.

Code:
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<c:set var="reqUrl" value="${pageContext.request.requestURL}" />

URL : ${fn:substringAfter(reqUrl, "http://localhost:8080/WebTest/")}

Here http://localhost:8080/WebTest/ is your starting serveraddress with context name.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: