利用jsp完成一个网上测试程序
文章目录
思考
利用jsp技术写一个简单网上测试程序,程序包含填空题、多选题、单选题和判断题,要实现在线测试,刷新题目,以及在线评分
我们用到了netbeansIDE编程软件
一、首先写一个登录界面(index.html)
代码如下:
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div>欢迎登陆系统</div>
<form method="post" action="Main.jsp">
<label>用户名</label>
<input type="text" name="userID" value="小李">
<label>密码</label>
<input type="password" name="password" value="123">
<input type="submit" name="tj" value="提交">
<input type="reset" name="reset" value="重置">
</form>
</body>
</html>
在这个代码中我们用post方法将用户名和密码提交到Main.jsp中
所以我们要创建一个main.jsp文件
二、写一个main.jsp文件
代码如下:
<%--
Document : Main
Created on : 2023-4-10, 21:21:00
Author : Admin
--%>
<%@page import="java.util.Random"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>在线测试</title>
</head>
<body>
<%
Random rd =new Random();
int a = rd.nextInt(2);//在0和1之

最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



