Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in passing parameters  RSS feed

Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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();

Now My java class is as follow
package alok;
import java.util.*;
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\"");

buffer.append("<Table border = 1><tr><th> Object Name </th><th> subject </th>");


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
Author and ninkuma
Posts: 66425
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.

Forum Bartender
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!