include « Forward « JSP-Servlet Q&A





1. JSP forward or include?    coderanch.com

When you use forward the invoker will not have an access to request any longer ( request & the control will be forwarded to destination ). If you use include, request object thus the control will return to the invoker that calls include after the destination is done with processing the request.

2. include vs forward    coderanch.com

pooja, The action enables you to forward the request to a static HTML file, a servlet, or another JSP. The JSP that contains the action stops processing, clears its buffer, and forwards the request to the target resource. Note that the calling JSP should not write anything to the response prior to the action. You ...

3. forward() VS include()    coderanch.com

4. A forward in a include page?    coderanch.com

Hi All This is my case: I have a top.jsp file which I include in every page. It not only has all the stuff of the page header and all the links it also contains a part which does a security check. Meaning if someones session is expired or for any other reason does not have a valid session to view ...

5. jsp:forward and jsp:include    coderanch.com

6. How to forward to other JSP when we use include    coderanch.com

You have to decide what to display before you display anything. In your case, you aren't sure what to display, but you are including a file then deciding what you really wanted was to redirect. This may still not be what you need, but it removes that conflict. String sStatus = (String) req.getAttribute("Status"); String name= ""; if (!sStatus.equals("OK")){ res.sendRedirect(sStatus); } else ...

9. About Forward and Include method in Servlet    coderanch.com

Hi sharma, its very simple... see forward -- request goes to another resource from current position ,you cant print anything after this statement.if you do so it throws an exception where as include : you are processing another resource with in your page .. you can print anything after this statement.no problems i think you understand clearly...