Programming Tools: WSAD5.1 Create a JSP page in WebContent
JSP page:
HelloWorld.jsp
p> form> body> html>
Create a servlet in the Javasoure directory. Create a servlet in this package.
servlet:
HelloWorld.java
Package com.bcb.mywork;
Import java.io.ioException; import java.io.printwriter; import java.util.hashmap
Import javax.servlet.servlet; import javax.servlet.servletException;
Import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletRequest; import javax.servlet.http.httpservletResponse; import javax.servlet.jsp.jspexception;
/ ** * @Version 1.0 * @Author * / public class helloworld extends httpservlet imports servlet {
/ ** * @see javax.servlet.http.HttpServlet # void (javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) * / public void doGet (HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
}
/ ** * @see javax.servlet.http.HttpServlet # void (javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) * / public void doPost (HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {String OUT = "HelloWorld!"; int hw = new integer (Req.getParameter ("n"))). INTVALUE (); System.err.Print ("hw"); printwriter output = Resp.GetWriter (); for (int) i = 1; i