JSP standard actions use XML-style tags to include output, forward a request, pass parameters, and interact with JavaBeans. Understand their request-time behavior and prefer controllers plus JSTL/EL for modern application structure.
jsp:include invokes another resource during the current request and inserts its generated response. Because inclusion happens at request time, the included resource can produce dynamic output. The including page keeps control after the include finishes unless the response has failed.
jsp:forward transfers the request to another server resource and ends normal processing of the current page. Request attributes remain available. Forward before committing response output; buffered content may be cleared, but relying on late forwarding makes behavior fragile.
jsp:param is nested inside include or forward and adds a request parameter for the target resource. Parameters remain strings and may create multiple values when the original request already used the same name. The target must validate them just like client input.
Use request attributes instead when the controller is passing typed server data to a view. Parameters are best for the narrow compatibility cases where the target expects request parameter semantics.
jsp:useBean locates or creates a JavaBean in page, request, session, or application scope. jsp:setProperty writes bean properties and jsp:getProperty renders them. Automatic property population from request parameters is risky because it hides conversion, validation, and writable-field decisions.
In modern MVC code, construct and validate objects in Java, expose a read-only view model as a request attribute, and render it with EL. Recognize Bean actions in legacy pages, but do not use them to place domain mutation or database access in the view.
Use a static include directive for source fragments that should be combined at translation time, jsp:include for dynamic request-time fragments, a controller forward for rendering, and a redirect for a new client request. The choice affects URL, request attributes, buffering, and whether the target executes independently.
Included resources should not reset status or headers unexpectedly. Keep fragment contracts explicit: required attributes, allowed output, character encoding, and error behavior. Avoid chains of includes and forwards that hide which resource owns the response.
<main>
<h1>Account</h1>
<jsp:include page="/WEB-INF/views/fragments/account-summary.jsp">
<jsp:param name="mode" value="compact" />
</jsp:include>
</main>
<jsp:forward page="/WEB-INF/views/not-found.jsp">
<jsp:param name="source" value="catalog" />
</jsp:forward>
jsp:include executes the target for every request. The directive combines source during JSP translation.
No. It is a server-side transfer using the same request and response. A redirect tells the browser to make a new request.
Practice, interview questions, and compiler links for JSP Actions.
Finish the concept here, then reinforce it with hands-on coding, interview prep, or a tool that matches the topic.
Explore 500+ free tutorials across 20+ languages and frameworks.
Fresh tutorials, interview guides, and coding practice in your inbox.