wood burning stoves*
The moose likes JSP and the fly likes how to pass implicitobject(out) in the methods? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to pass implicitobject(out) in the methods?" Watch "how to pass implicitobject(out) in the methods?" New topic
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)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to pass implicitobject(out) in the methods?
 
Similar Threads
Calling the Java Store Method in JSP
servlet Map help
whitspaces
how to use ssi in servlets using apache web server and jserv
Can I use JRun to run JSP