How to get direct information in JSTL / EL, being an attribute containing a point

This question shows that when sending information in the request object is updated to reflect the new file. For example, when:

user requests "/ abc" -> servlet is called> forward in /def.jsp

Then in def.jsp ${request.requestURI} will be /def.jsp , not /abc . If you want to get the original requested URI (or any other information such as servlet path, etc.):

 request.getAttribute("javax.servlet.forward.request_uri"); 

Everything is fine, but how can I access this through JSTL. ${javax.servlet.forward.request_uri} does not work. A point is considered an operator, not part of a name. In other cases, this is solved by putting the name in square brackets and quoting it. But there is no map object here, and ${['javax.servlet...']} does not work.

So how?

(I can put it in the β€œaimless” attribute in the servlet, but this is a workaround)

+4
source share
1 answer

As far as I remember, this is something like this:

 ${requestScope["javax.servlet.forward.request_uri"]} 
+15
source

Source: https://habr.com/ru/post/1332410/


All Articles