
index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>select beer color</h1>
<form action="advice.jsp">
<select name="color1">
<option>light</option>
<option>brown</option>
<option>dark</option>
</select>
<br>
<input type="submit">
</form>
</body>
</html>
advice.jsp
<%@ page language="java" contentType="text/html;charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h2>brand:</h2>
<%=request.getAttribute("beerBrand")%><br>
if you have ant question, pls email me, my email is:<%=request.getAttribute("email")%>
</body>
</html>
此博客介绍了如何在HTML中创建一个下拉菜单选择啤酒颜色,并通过Java后端进行数据处理。表单提交后,会显示预设的品牌和联系方式。

1万+

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



