<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Jsp Practice</title>
</head>
<script type="text/javascript" language="javascript">
</script>
<body>
<form id="form" method="post" action="test.jsp">
<input type="radio" name="radiobutton" value="OK"/>
<input type="submit" value="提交"/>
</form>
<br/>
以下是从from里面读取的值:
<br/>
<%
String show=request.getParameter("radiobutton");
System.out.println(show);//显示在控制台
out.println(show);//显示在页面,显示结果为 OK
%>
</body>
</html>
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Jsp Practice</title>
</head>
<script type="text/javascript" language="javascript">
</script>
<body>
<form id="form" method="post" action="test.jsp">
<input type="radio" name="radiobutton" value="OK"/>
<input type="submit" value="提交"/>
</form>
<br/>
以下是从from里面读取的值:
<br/>
<%
String show=request.getParameter("radiobutton");
System.out.println(show);//显示在控制台
out.println(show);//显示在页面,显示结果为 OK
%>
</body>
</html>
本文介绍了一个简单的JSP示例,演示如何使用HTML表单提交数据,并在JSP页面中通过request对象获取这些数据。该示例包括了表单元素的选择、提交方法的设置以及如何在服务器端读取表单数据。
585

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



