StringBuffer og servlet
Hej Eksperter,Jeg kan ikke se hvorfor det her er forkert. Det er tilsyneladende scriptet som kokser. Det virker i øvrigt fint hvis jeg dropper Stringbuffer og bare bruger out.println
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class Start extends HttpServlet
{
public void doGet (HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
PrintWriter out;
// response.setContentType("text/html; charset=ISO-8859-1");
out = response.getWriter();
StringBuffer buffer = new StringBuffer();
buffer.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">");
buffer.append("<html><head><title>Start</title>");
buffer.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../style/styles.css\">");
buffer.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">");
buffer.append("</head>");
buffer.append("<body onload=\"self.focus();\">");
buffer.append("<table style=\"width:700px;height:400px;background-image: url(../jpg-filer/basis.jpg);margin: auto;\">");
buffer.append("<tr>");
buffer.append("<td style=\"height:77px;\">");
buffer.append("</td>");
buffer.append("</tr>");
buffer.append("<tr>");
buffer.append("<td style=\"height:33px;text-align:left;\">");
buffer.append("<table style=\"width:100%;\"><tr><td>");
buffer.append("<script type=\"text/javascript\"><!--");
buffer.append(" var width = window.screen.availWidth -10;");
buffer.append(" var height = window.screen.availHeight -150;");
buffer.append("document.write(\"<input type=\\\"button\\\" style=\\\"width:165px;background-color:transparent;border:0;cursor:hand;\\\" onClick=\\\"window.open('../servlet/Startbeauty','Beauty' ,'toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes,width=\"+width+\",height=\"+height+\",top=0,left=0')\\\">\");");
buffer.append("--></script>");
buffer.append("</td>");
// buffer.append("<td><input type=\"button\" style=\"width:165px;background-color:transparent;border:0;cursor:hand;\" onClick=\"window.open('../servlet/Startbeauty','Beauty')\"></td>");
buffer.append("<td style=\"width:50px;\"></td>");
buffer.append("<td><input type=\"button\" style=\"width:75px;\" class=\"button\" name=\"News\" value=\"News\" onmouseover=\"this.className = 'buttonHover';\" onmouseout=\"this.className = 'button';\" onclick=\"parent.frames['content'].location.href='Showdata?pageID=news'\"></td>");
buffer.append("<td><input type=\"button\" style=\"width:75px;\" class=\"button\" name=\"Mrtlz\" value=\"Mrtlz\" onmouseover=\"this.className = 'buttonHover';\" onmouseout=\"this.className = 'button';\" onclick=\"parent.frames['content'].location.href='Showdata?pageID=mrtlz'\"></td>");
buffer.append("<td><input type=\"button\" style=\"width:100px;\" class=\"button\" name=\"Credits\" value=\"Credits\" onmouseover=\"this.className = 'buttonHover';\" onmouseout=\"this.className = 'button';\" onclick=\"parent.frames['content'].location.href='Showdata?pageID=credit'\"></td>");
buffer.append("<td><input type=\"button\" style=\"width:100px;\" class=\"button\" name=\"Contact\" value=\"Contact\" onmouseover=\"this.className = \'buttonHover';\" onmouseout=\"this.className = 'button';\" onclick=\"parent.frames['content'].location.href='Showdata?pageID=contact'\"></td>");
buffer.append("<td><input type=\"button\" style=\"width:135px;\" class=\"button\" name=\"Community\" value=\"Community\" onmouseover=\"this.className = \'buttonHover';\" onmouseout=\"this.className = 'button';\" onclick=\"parent.frames['content'].location.href='Showdata?pageID=community'\"></td>");
buffer.append("</tr></table>");
buffer.append("</td></tr>");
buffer.append("<tr><td style=\"vertical-align:top;height:250px;;\">");
buffer.append("<iframe name=\"content\" src =\"Showdata\" frameborder=\"0\" scrolling=\"auto\" style=\"width:100%;height:100%\">");
buffer.append("</iframe>");
buffer.append("</td></tr>");
buffer.append("<tr><td style=\"height:40px;\"></td></tr></table>");
buffer.append("<script type=\"text/javascript\">");
buffer.append("ie6 = (navigator.appVersion.indexOf(\"MSIE 6\") != -1) ? true : false;");
buffer.append("ns6 = (document.getElementById && !document.all) ? true : false;");
buffer.append("ns4 = (document.layers) ? true : false;");
buffer.append("ie5 = (!ie6 && document.getElementById && document.all) ? true : false;");
buffer.append("ie4 = (!ie5 && document.all) ? true : false;");
buffer.append("op = (navigator.appName == \"Opera\") ? true : false;");
buffer.append("if ((ie6 == true) || (ie5 == \"true\") || (ie4 == \"true\")){");
buffer.append("document.all.content.allowTransparency = true;");
buffer.append("}");
buffer.append("</script>");
buffer.append("</body>");
buffer.append("</html>");
out.println(buffer.toString());
out.close();
}
}
