This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to pass implicitobject(out) in the methods?
 
Similar Threads
Calling the Java Store Method in JSP
Can I use JRun to run JSP
how to use ssi in servlets using apache web server and jserv
servlet Map help
whitspaces