How to Forward a Client Request to HTML, JSP File and Servlet for Processing

JSP File Request Forward for Another File

The
<jsp:forward>
tag forwards the request object sent to the JSP file to another file for processing. The JSP engine does not process any of the remainder of the JSP file. If the output from the compiled JSP file is buffered by using a page directive with the default value or an explicit size set for buffer, the buffer is cleared before the request is forwarded. If the output is not buffered if you used a page directive with buffer=none, and if anything has been written to the buffer, using
<jsp:forward>
results in an
IllegalStateException


JSP File Request Forward Syntax
<jsp:forward page="{ relativeURL | <%= expression %> }" />


JSP HTTP Request Forward Code Example
<jsp:forward page="/servlet/login" />


JSP File Request Forward Command Attributes
page="{ relativeURL | <%= expression %> }"
A String or an expression representing the relative URL of the file to which you are forwarding the request. The relative URL looks like a path; it cannot contain a protocol name, port number, or domain name. The URL can be absolute or relative to the current JSP file. If it is absolute (beginning with a /), the path is resolved by your Web or Application Server


Related Topic Struts FAQs
Client Side Validation using Validator Framework Work in Struts
What is Struts Validator Framework?
JSP Interview Questions & Answers
Servlet Interview Questions & Answers Part 3

nScraps.com 2011   Privacy Policy  Terms of Service  Feedback