pressing "enter" gives a blank page for servletpressing "enter" gives
a blank page for servlet
I don't see why I'm getting a blank page for the following HTML &
servlet:
thufir@arrakis:~$
thufir@arrakis:~$
thufir@arrakis:~$ cat NetBeansProjects/lab3project/lab3/web/
kompozer.html <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title></title>
</head>
<body>
<br>
<br>
<br>
<form method="POST" action="/converted" name="dataEntry"><input
name="temp" value="99"><br>
</form>
</body>
</html>
thufir@arrakis:~$
thufir@arrakis:~$ cat NetBeansProjects/lab3project/lab3/src/java/
a00720398/lab3/Converted.java
package a00720398.lab3;
/*
<FORM ACTION="destination_url" METHOD=GET>
<INPUT TYPE=submit NAME=foo VALUE="Go to destination">
</FORM>
*/
import a00720398.lab3.view.*;
import a00720398.lab3.beans.*;
import java.io.*;
import java.util.ArrayList;
import javax.servlet.*;
import javax.servlet.http.*;
@SuppressWarnings({"unchecked", "serial"})
public class Converted extends HttpServlet {
@Override
public void doPost(HttpServletRequest in,
HttpServletResponse output)
throws ServletException, IOException {
doGet(in, output);
}
@Override
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
StringBuffer outputResponse = new StringBuffer();
String temp = "99";
temp = request.getParameter(temp); //how do I gather user
input?
int value = 999;
//value = Integer.parseInt(temp);
Temperature temperature = new Temperature(value,
Unit.CELSIUS);
outputResponse.append(temp);
outputResponse.append(HTMLManager.addPageHeader("solution"));
outputResponse.append(HTMLManager.addDataToOutput(new
Temperature(value, Unit.CELSIUS), new Temperature(32,
Unit.FAHRENHEIT)));
out.println(outputResponse.toString());
out.close();
}
}
thufir@arrakis:~$
thufir@arrakis:~$ cat NetBeansProjects/lab3project/lab3/web/WEB-INF/
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>What's the temp?</display-name>
<context-param>
<description>bcit ID number</description>
<param-name>author</param-name>
<param-value>A00720398</param-value>
</context-param>
<context-param>
<description>default page</description>
<param-name>home page</param-name>
<param-value>/temp</param-value>
</context-param>
<context-param>
<description>generic title</description>
<param-name>title</param-name>
<param-value>Lab 3</param-value>
</context-param>
<servlet>
<servlet-name>TempController</servlet-name>
<servlet-class>a00720398.lab3.Lab3</servlet-class>
</servlet>
<servlet>
<servlet-name>converted</servlet-name>
<servlet-class>a00720398.lab3.view.Converted</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TempController</servlet-name>
<url-pattern>/temp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>converted</servlet-name>
<url-pattern>/converted</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>kompozer.html</welcome-file>
</welcome-file-list>
</web-app>
thufir@arrakis:~$
thanks,
Thufir