Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know if a JSP file is beeing included by another one?

Tags:

java

jsp

I have x.jsp that can either be served as the whole response, or being included in several other jsp files.

So how can I know inside x.jsp if it is being included by another file or not?

like image 294
Paolo Avatar asked Nov 27 '25 14:11

Paolo


1 Answers

You can check the value of the attribute javax.servlet.include.request_uri in your x.jsp page. If set, the jsp page was included.

Further details here: Java HttpServletRequest get URL in browsers URL bar

like image 176
Laurent Legrand Avatar answered Nov 30 '25 04:11

Laurent Legrand



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!