| Author |
how to pass implicitobject(out) in the methods?
|
Neelima Paramsetty
Greenhorn
Joined: Jun 17, 2003
Posts: 16
|
|
hi , i have the following code <%@ page import="java.io.*" %> <HTML> <HEAD> <TITLE>MYOWNJSP</TITLE> </HEAD> <BODY> <H1>THE REULT IS </H1> <%! int add(int a,int b,HttpServletResponse res) throws IOException { PrintWriter out=res.getWriter(); out.println("hello Neelima"); return a+b; } %> <%= add(4,5,response) %> </BODY> </HTML> how i have to pass the out object to the method? Thanks in advance, Neelima
|
 |
Ron Newman
Ranch Hand
Joined: Jun 06, 2002
Posts: 1056
|
|
Using the response's PrintWriter interferes with buffering and can cause output to appear in the wrong order, as your example demonstrates. Instead, use the JspWriter "out":
|
Ron Newman - SCJP 1.2 (100%, 7 August 2002)
|
 |
 |
|
|
subject: how to pass implicitobject(out) in the methods?
|
|
|