wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "servlet keeps reloading html page" Watch "servlet keeps reloading html page" New topic
Author

servlet keeps reloading html page

Bill Vai
Greenhorn

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.
thanks
Marilyn de Queiroz
Sheriff

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


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

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

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

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
Greenhorn

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: http://aspose.com/file-tools
 
subject: servlet keeps reloading html page
 
Similar Threads
Paging Results
IE session gets cleared
cannot open localhost:8080
Ajax slideshow
servlet reloads