一个JSP的用户注册表的摸板,里面有一个单选按纽组,分别表示“男”、“女”,当我从数据库中读取数据时如何正确显示“男”的单选按纽 <option value="0" <%if("0".equals(數據庫中抓出的邊量名))out.println("selected");%>>本科</option> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 那你不如在SQL语句里处理,select 文化=case 文化程度 when '1' then '本科' when '2' then '大专' ...end from ..但是如能更改表结构最好在建一个字典表,来对应 文化程度 这样易于扩充 首先你要建立个FormBean先啦,属性为数据类型的,在前台jsp中:<html:multibox property="属性名" value="提交或者根据值显示的" /> answer:<form name="login" action="check.jsp" method="post">用户名:<input type="text" name="username" size="7"> 密码:<input type="password" name="password" size="7"><input type="radio" name="education" checked value="0" />no<input type="radio" name="education" value="1" />bachelor<input type="radio" name="education" value="2" />college<input type="radio" name="education" value="3" />high school</form>-------------check.jsp-----------<%String name=request.getParameter("username");String pass=request.getParameter("password");String edu=request.getParameter("education");%><%int educhoice=Integer.parseInt(edu); String sql;String condition;switch(educhoice){case 0: condition="edu='no'"; break;case 1: condition="edu='bachelor'"; break;....}sql="select * from user where user='"+name+"' and pass='"+pass+"' and "+condition+";";.........//query database here!%> js解析json数据.....在线等。。 openfire+flex的即时聊天项目。急!!!!! IBatis封装成MAP时,为什么把从数据库取回值的小数点部分取消了? windows7和xp页面效果不同 eclipse3.3+myeclipse6.0.1配置错误?--求助! 我写了个JSP的登录页面,老是提交不过去,大家帮忙看看了谢谢 求租,java编写webService客户端 新手提问 集群多线程问题 关于几个JSP操作数据库的菜问题,请各位老大帮忙! 嗷嗷菜!嗷嗷急???? 请教:关于replaceAll函数的问题!!!
select 文化=case 文化程度 when '1' then '本科' when '2' then '大专' ...end from ..但是如能更改表结构最好在建一个字典表,来对应 文化程度 这样易于扩充
<html:multibox property="属性名" value="提交或者根据值显示的" />
<form name="login" action="check.jsp" method="post">
用户名:<input type="text" name="username" size="7">
密码:<input type="password" name="password" size="7">
<input type="radio" name="education" checked value="0" />no
<input type="radio" name="education" value="1" />bachelor
<input type="radio" name="education" value="2" />college
<input type="radio" name="education" value="3" />high school
</form>
-------------check.jsp-----------
<%
String name=request.getParameter("username");
String pass=request.getParameter("password");
String edu=request.getParameter("education");
%>
<%int educhoice=Integer.parseInt(edu);
String sql;String condition;
switch(educhoice){
case 0:
condition="edu='no'";
break;
case 1:
condition="edu='bachelor'";
break;
....
}
sql="select * from user where user='"+name+"' and pass='"+pass+"' and "+condition+";";
.........
//query database here!
%>