Patrick Lorio
Patrick Lorio

Reputation: 5668

Java Servlet execute method before serving page

I want to be able to have a method between getting the HTTP request and sending the webpage. A close equivalent to what I want is having some code on top of every jsp file.

Example:

<%
    some.package.staticMethod();
%>

Does this make sense?

I believe ASP.net has a method Page_Load similar to what I want.

Upvotes: 0

Views: 322

Answers (1)

Vikdor
Vikdor

Reputation: 24124

If this is applicable to all the responses for incoming HTTP requests, then you are talking about a Servlet Filter.

Upvotes: 2

Related Questions