mit JSP erzeugtes Hello Servlet
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
//die Seite hies hello1.jsp
public class _hello1_xjsp extends HttpServlet{
public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
BufferedReader in = request.getReader();
out.println("<HTML>");
out.println("<HEAD><TITLE>Hello</TITLE></HEAD>");
out.println("<BODY>");
out.println("<H1>");
if (request.getParameter("name") == null){
out.println("Hello World");
}
else {
out.println("Hello, " + request.getParameter("name"));
}
out.println("</H1>");
out.println("</BODY></HTML>");
}
}
[ Seminar Linux und Apache ]
[JSP-Seite]
[zurück]