HTML browser - printwriter error
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   derrick_robertson
Posted On:   Friday, January 17, 2003 03:19 AM

I am currently working on a JSP page. The problem i am finding is that when I reload the page quickly, i am getting a null pointer error and also the HTML code is malformed. Looks like two printwriters have written code to hte same browser. Is this possible. The way I am testing this is by using internet explorer and pressing f5 for a reload so the JSP is constantly called. Here is a piece of my code. Once I get the printwriter, i then use it to create another class. I see you can use out instead of response.getwriter which is a printwriter is this true?? How do you do this. Here is the doGet where I call response.getWriter(); public void doGet(HttpServletRequest request, HttpS   More>>

I am currently working on a JSP page.
The problem i am finding is that when I reload the page quickly, i am getting a null pointer error and also the HTML code is malformed. Looks like two printwriters have written code to hte same browser. Is this possible.

The way I am testing this is by using internet explorer and pressing f5 for a reload so the JSP is constantly called.

Here is a piece of my code. Once I get the printwriter, i then use it to create another class.

I see you can use out instead of response.getwriter which is a printwriter is this true?? How do you do this.
Here is the doGet where I call response.getWriter();

			public void doGet(HttpServletRequest request,
			
HttpServletResponse response)
throws IOException, ServletException
{
this.response = response;
this.request = request;
response.setContentType("text/html");
writer = response.getWriter();
try{
//get the request parameters
theFunction = (request.getParameter("func")).trim();
arg1 = (request.getParameter("arg1"));
arg2 = (request.getParameter("arg2"));
arg3 = (request.getParameter("arg3"));
//writer.println(theFunction);
//create html helper object.
htmlHelper = new HtmlHelper(writer, this);
getConfiguration();
//delete the temp files
delTempFiles();
getIpSegmentation();
getMapIpToDesign();
getDesignFonts();
//Now deal with the function.
selectFunction();
//This initiates the call to FunctionHelper
//and passes in the printwriter as a variable
//Is this causing a problem
}
catch (Exception e)
{
System.out.println("Derrick - error in IntranetTV.doGet()");
}
}


			//And then
			
public void selectFunction()
{
functionHelper = new FunctionHelper(writer, htmlHelper, this);
if (theFunction.equals("CreateMainIndex"))
functionHelper.CreateMainIndex();
}


FunctionHelper does all the HTML writing to the Browser

   <<Less

Re: HTML browser - printwriter error

Posted By:   vinay_salehithal  
Posted On:   Friday, January 17, 2003 06:15 AM

I think the issue is, you are using instance variables without the SingleThread model. Hence, this is leading to yr instance variables being shared across different invocations.
About | Sitemap | Contact