怎么从JSP页面获取SELECT中value的值
2个回答
展开全部
给你一个列子test.jsp:
<%@ page contentType="text/html;charset=GB2312" %>
<%
String video = request.getParameter("video");
if (video == null) {
video = "没有提交";
} else {
try {
video = new String(video.getBytes("iso-8859-1")); //解决中文乱码
} catch (Exception e) {
video = "值错误";
}
}
%>
<html><body>
<form method="post" action="">
<select name="video">
<option value="a.wmv">茉莉花</option>
<option value="b.avi">飞翔的鸽子</option>
<option value="动画.wmv">动画片</option>
</select>
<input type="submit" value="提交" />
</form>
您提交的值是:
<input type="text" value="<%=video%>" />
</body></html>
<%@ page contentType="text/html;charset=GB2312" %>
<%
String video = request.getParameter("video");
if (video == null) {
video = "没有提交";
} else {
try {
video = new String(video.getBytes("iso-8859-1")); //解决中文乱码
} catch (Exception e) {
video = "值错误";
}
}
%>
<html><body>
<form method="post" action="">
<select name="video">
<option value="a.wmv">茉莉花</option>
<option value="b.avi">飞翔的鸽子</option>
<option value="动画.wmv">动画片</option>
</select>
<input type="submit" value="提交" />
</form>
您提交的值是:
<input type="text" value="<%=video%>" />
</body></html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询