mpark
mpark

Reputation: 113

How do I get a HttpServletRequest object when loading a JSP page?

I have a HTML page that allows me to use JSP code. I was able to print some output using some basic Java. But How do I obtain a HttpServletRequest object so I can print some of its properties onto the HTML page?

Upvotes: 4

Views: 14469

Answers (1)

Juvanis
Juvanis

Reputation: 25950

Just use the request variable (HttpServletRequest instance). It is one of implicit objects in JSP. Check properties here: http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html

<%
    request.getHeader();
%>

Upvotes: 4

Related Questions