Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet keeps reloading html page

 
Bill Vai
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using a BufferedReader to load my pages from a text file for which holds my haml pages. In IE everything works fine but in NetScape it keeps reloading the page.
Has anyone run into this before.
thanks
 
Marilyn de Queiroz
Sheriff
Posts: 9065
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never seen this. I think it is extremely unlikely that it is related to the use of BufferedReader.
 
Bill Vai
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marilyn,
I don't really think it's related to the BufferedReader. The code I am using is
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.net.*;

public class PageServer3 extends HttpServlet {
public void init(ServletConfig config) throws ServletException {
super.init(config);
}

public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {

String pageName = req.getParameter("pageName").trim();
res.setContentType("text/html");
PrintWriter out = res.getWriter();

HtmlTop1 ht = new HtmlTop1("Alien Web Production ", "Links.js'", "MyStyles.css", "text/html; charset=ISO-8859-1", "", "");

StringBuffer sb = new StringBuffer();
// sb.append(ht.doHtmlTop()); //set up page HTML,HEAD,TITLE and ending TITLE tags
sb.insert(0, ht.doHtmlTop());
HtmlBody1 hb = new HtmlBody1();
sb.append(hb.doBodyTag());

URL url = getServletContext().getResource("/sitePages/"+pageName+".txt");

InputStream is = url.openStream();

if (is != null) {
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String s ;
while ((s = br.readLine()) != null) {
sb.append(s);
}
br.close(); //Close the BufferedReader
is.close(); // Close the InputStream
}
sb.append(ht.endHtml());
out.println(sb); //************* prints out entire page in one shot
sb.delete(0, sb.length());
out.close();
} //End doPost

public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
doPost(req, res);
}

}
Really
[ December 20, 2002: Message edited by: Bill V ]
[ December 20, 2002: Message edited by: Bill V ]
 
Bill Vai
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it figured out thanks
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what did you figure out?
And, um...
Welcome to JavaRanch, Bill V!
Please change your display name to comply with The JavaRanch Naming Policy. Thanks pardner. Hope to see you 'round the Ranch!
 
DC Dalton
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just so everyone knows (and doesnt think this is a servlet or container problem) Bill was using some sample code off of my site that included some HTML creation objects & he mistakenly set the meta refresh tag in the constructor, Since it had no value set IE ignored it but good old Netscape, going by the letter of the law refresh the page in a quasi infinate loop.
 
Bill Vai
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks DC. Haven't had a chance to get back here been really busy with the holiday's.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic