user2022068
user2022068

Reputation:

Several JSP pages and requestURI

I use Apache Tiles to unite multiple jsp pages.What I want is to get the URI of the request that came from web client (from browser). However, when in my jsp page I use

${pageContext.request.requestURI} 

I get not web client uri but the local path of the jsp file. For example when web user enters http://company.com/something/ (I want to get /something/) I get /jsp/articles/index.jsp.

I tried requestScope.request.requestURI but it returns empty string. How can I get web client request URI

Upvotes: 0

Views: 623

Answers (1)

dReAmEr
dReAmEr

Reputation: 7196

As per your question,you said when you enter "http://company.com/something/" in the browser,you get /jsp/articles/index.jsp in JSP,it seems your original request has been forwarded to new one. You can try below to get the orginal URI in JSP page.

<% String originalUri = (String) request.getAttribute("javax.servlet.forward.request_uri"); %>

Upvotes: 1

Related Questions