jsp实验报告 - 图文

更新时间:2024-04-13 12:26:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

教务系统

班级:12级计本2班

姓名:于海涛

时间:2014年06月08日

教务系统

实验目的:

1、了解简单的HTML标记 2、掌握链接标记的使用 3、掌握表格标记的使用 4、掌握表格嵌套的使用

5、简单的HTML





ser01.java

package pack01;

import java.io.IOException; import java.io.PrintWriter;

import javax.servlet.ServletException; import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession;

public class ser01 extends HttpServlet { /** * Constructor of the object. */ public ser01() { super(); } /** * Destruction of the servlet.
*/ public void destroy() { super.destroy(); // Just puts \ // Put your code here } /** * The doGet method of the servlet.
* * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(\ response.setCharacterEncoding(\ PrintWriter out = response.getWriter();

}

String code = request.getParameter(\HttpSession session = request.getSession();

String randStr = (String)session.getAttribute(\

if(!code.equals(randStr)){ response.sendRedirect(\} else{ out.print(\验证通过,正在跳转\ response.sendRedirect(\}

out.flush(); out.close();

private void alert(String string) { // TODO Auto-generated method stub }

/**

* The doPost method of the servlet.
*

* This method is called when a form has its tag value method equals to post. *

* @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */

public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { }

this.doGet(request, response);

/**

* Initialization of the servlet.
*

* @throws ServletException if an error occurs */

public void init() throws ServletException {

}

}

// Put your code here

serdowload.java

import java.io.IOException; import java.io.PrintWriter;

import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;

public class serdownload extends HttpServlet { /** * Constructor of the object. */ public serdownload() { super(); } /** * Destruction of the servlet.
*/ public void destroy() { super.destroy(); // Just puts \ // Put your code here } /** * The doGet method of the servlet.
* * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

}

}

String filename = request.getParameter(\

response.setHeader(\response.setContentType(\

RequestDispatcher rd = request.getRequestDispatcher(\

rd.forward(request, response);

/**

* The doPost method of the servlet.
*

* This method is called when a form has its tag value method equals to post. *

* @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */

public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { }

this.doGet(request, response);

/**

* Initialization of the servlet.
*

* @throws ServletException if an error occurs */

public void init() throws ServletException { // Put your code here }

code.jsp

<%@ page language=\<%@ page import=\

<%@ page import=\<%@ page import=\

<% %>

response.setHeader(\int width=60,height=20;

BufferedImage image = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);

Graphics g= image.getGraphics(); g.setColor(new Color(200,200,200)); g.fillRect(0, 0, width, height);

Random rnd = new Random();

int randNum = rnd.nextInt(8999)+1000; String randStr = String.valueOf(randNum);

session.setAttribute(\g.setColor(Color.black);

g.setFont(new Font(\g.drawString(randStr, 10, 17);

for(int i=0;i<100;i++){ int x = rnd.nextInt(width); int y = rnd.nextInt(height); g.drawOval(x, y, 1, 1); }

ImageIO.write(image, \

out.clear();

out = pageContext.pushBody();

chengji.jsp

<%@ page language=\

2012-2013 1

neizhuye.jsp

<%@ page language=\

xuanke.jsp

<%@ page language=\

src=https://www.bwwdw.com/plus/\当前位置-----------课程安排

本文来源:https://www.bwwdw.com/article/15sp.html

Top