/*我正好有一个servlet版 99乘法表,送你了,需要安Tomcat*/
/*web.xml内容
<?xml version="1.0" encoding="utf-8" ?>
- <web-app 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_3_0.xsd" version="3.0" metadata-complete="true">
- <servlet>
<servlet-name>DB</servlet-name>
<servlet-class>DB</servlet-class>
</servlet>
- <servlet-mapping>
<servlet-name>DB</servlet-name>
<url-pattern>/ss</url-pattern>
</servlet-mapping>
</web-app>
*/
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class DB extends HttpServlet
{
public static void main(String args[])
{
}
public void doPost(HttpServletRequest req,HttpServletResponse resp)
throws ServletException,IOException
{
}
public void doGet(HttpServletRequest req,HttpServletResponse resp)
throws ServletException,IOException
{
//String dno=req.getParameter("no");
resp.setContentType("text/html;charset=gb2312");
PrintWriter out=resp.getWriter();
out.println("<html>");
out.println("<meta http-equiv=\"content-type\" content=\"text/html; charset=gb2312\">");
out.println("<head><title></title>");
out.println("</head><body>");
for(int i=1;i<10;i++)
{
for(int j=1;j<=i;j++)
out.print(j+"*"+i+"="+i*j+" ");
out.println("<br />");
}
out.println("</body></html>");
out.close();
}
}
|