File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes servlet keeps reloading html page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "servlet keeps reloading html page" Watch "servlet keeps reloading html page" New topic

servlet keeps reloading html page

Bill Vai

Joined: Dec 07, 2002
Posts: 22
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.
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9056
I've never seen this. I think it is extremely unlikely that it is related to the use of BufferedReader.

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Bill Vai

Joined: Dec 07, 2002
Posts: 22
I don't really think it's related to the BufferedReader. The code I am using is
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class PageServer3 extends HttpServlet {
public void init(ServletConfig config) throws ServletException {

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

String pageName = req.getParameter("pageName").trim();
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();

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) {
br.close(); //Close the BufferedReader
is.close(); // Close the InputStream
out.println(sb); //************* prints out entire page in one shot
sb.delete(0, sb.length());
} //End doPost

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

[ December 20, 2002: Message edited by: Bill V ]
[ December 20, 2002: Message edited by: Bill V ]
Bill Vai

Joined: Dec 07, 2002
Posts: 22
Got it figured out thanks
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
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!

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
DC Dalton
Ranch Hand

Joined: May 28, 2001
Posts: 287
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

Joined: Dec 07, 2002
Posts: 22
Thanks DC. Haven't had a chance to get back here been really busy with the holiday's.
I agree. Here's the link:
subject: servlet keeps reloading html page
It's not a secret anymore!