aspose file tools*
The moose likes JSP and the fly likes problem in passing parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "problem in passing parameters " Watch "problem in passing parameters " New topic
Author

problem in passing parameters

Raj kalaria
Ranch Hand

Joined: Sep 08, 2005
Posts: 72
Hi

Right now our requirement is that, we should have a jsp page which will call a class which( has the logic to diplay the contents in Excell sheet)

Right now i am creating a jsp file as follow

------------------------------------******************---------------------
<%@ page import="javax.servlet.http.HttpServletResponse"%>
<%@ page import='alok.*' %>
<%
csv1 c = new csv1();
c.writefile(response,out);
%>
---------------------********************_-----------------------------

Now My java class is as follow
---------------------**********************------------------
package alok;
import java.util.*;
import java.io.IOException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.http.HttpServletResponse;
public class csv1 {


private static final String CONTENT_TYPE = "application/excel";

public void writefile(HttpServletResponse response, JspWriter out)throws IOException
// public void writefile()throws IOException
{
//HttpServletResponse response = null;
//JspWriter out = null;

StringBuffer buffer = new StringBuffer();
response.setHeader("Content-Disposition","inline; filename=\"mult-table.xls\"");
response.setContentType(CONTENT_TYPE);

buffer.append("<html><head></head><body>");
buffer.append("<Table border = 1><tr><th> Object Name </th><th> subject </th>");
buffer.append("</tr><tr><td>alok</td><td>cricket</td></tr><tr><td>slok1</td>");
buffer.append("<td>cricket1</td></tr></Table></body></html>");
out.print(buffer.toString());

}
}
------------------------------********************-----------------------

Now the above code is working fine

now what i want is

right now i am passin teh parameters public void writefile(HttpServletResponse response, JspWriter out)

I dont want to pass teh parameters,
so in the method writefile( ) inside thew class
when i decalred
HttpServletResponse response = null;
JspWriter out = null;

the code is not working
can u help me
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61661
    
  67

can u help me


JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.

I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.

Please read this for more information.

thanks,
bear
Forum Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in passing parameters