register.jsp
action="show.jsp"把表单输入的数据交给show,jsp处理
<form action="show.jsp">
用户名:<input type="text" name="username" ><br/>
密码:<input type="password" name="userpassword"><br/>
<input type="submit" value="注册">
<input type="submit">
</form>
show.jsp,把servlet.java写在了jsp页面中
1.<%java代码%>
2.<%=%>称作jsp表达式,用于将已经声明的变量或者表达式输出到网页上面
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<% String username= request.getParameter("username");
System.out.println("用户名"+username);
String userpassword= request.getParameter("userpassword");
System.out.println("密码"+userpassword);%>
注册信息如下<br/>
用户名:<%=username %>
密码:<%=userpassword %>
</body>
</html>
本文介绍了一个简单的表单处理流程,使用JSP页面接收并显示从register.jsp提交的用户注册信息,包括用户名和密码。展示了如何利用request对象获取表单数据,并通过JSP表达式将这些数据输出到网页上。
2829

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



