网页完整代码作业jsp
时间: 2023-12-11 07:00:53 浏览: 29
网页完整代码作业jsp如下:
```jsp
<!DOCTYPE html>
<html>
<head>
<title>学生信息</title>
</head>
<body>
<h1>学生信息</h1>
<%
String name = request.getParameter("name");
String id = request.getParameter("id");
String age = request.getParameter("age");
if (name != null && id != null && age != null) {
%>
<p>学生姓名: <%= name %></p>
<p>学生编号: <%= id %></p>
<p>学生年龄: <%= age %></p>
<%
} else {
%>
<p>请输入学生信息</p>
<%
}
%>
<form method="post" action="student.jsp">
<label for="name">姓名:</label>
<input type="text" id="name" name="name"><br>
<label for="id">编号:</label>
<input type="text" id="id" name="id"><br>
<label for="age">年龄:</label>
<input type="text" id="age" name="age"><br>
<input type="submit" value="提交">
</form>
</body>
</html>
```
上述代码是一个简单的学生信息页面,使用JSP编写。页面中包括一个输入表单,用来输入学生的姓名、编号和年龄。当用户提交表单时,会通过request.getParameter()方法获取表单中输入的值,并在页面上显示学生的信息。如果用户尚未输入信息,则页面提示用户输入学生信息。