在form里提交后,就可以用request取到值了啊,然后再往数据库里写!
解决方案 »
- 如何初始化接口
- 求助 nutch1.2文件配置,找N多教程后无果 WIn7 cygwin
- 如何取得复选框中的VALUE值
- 帮忙写个正则表达式程序。 谢谢。
- 用jsp做网站开发的专业人士值得关注!!!!!!!
- eclipse 调试时单步执行速度非常慢
- struts配置问题--有些莫名奇妙
- 为什么 有的时候 从session里面取出对象 并对其赋值后 session里面对象的值会改变而有的时候不行?就是从session里面getAttribute出来的
- 打开两个记录集?
- 在中文NT的JSP中输出中文有乱码问题吗?
- 怎样在一个网页里像IE打开文件一样,可以显示不同类型的文件?
- (急)如何得到我网站的根目录?
String month =request.getParameter("month");
String day=request.getParameter("day");
那就把你的年月日的值取得,然后拼成yyyy/mm/dd的形式存就可以了
Connection con;
Statement sql;
ResultSet rs;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException event)
{
}
try
{
con=DriverManager.getConnection("jdbc:odbc:数据源");
sql=con.createStatement();
String condition="insert into 表名 values"+"("+"'"+stryear+"')";
sql.executeUpdate(condition);
con.close();
}
catch(SQLException e)
{
}
<select name="mulSelect" size="1" multiple>
<option value="....">....
<option value="....">....
<option value="....">....
<option value="....">....
....
</select>提交后取值:
String[] strArray = request.getParameterValues("mulSelect");
if(strArray!=null && strArray.length>1){
for(int i=0;i<strArray.length;i++){
//生成SQL语句;
}
}
//执行数据库数据插入语句。
标签出怎墨写???我照 lynx1111(任我行)sgdb(神天月晓) 的话试了下返回null
另外;
从数据库中调用数据,如何在列表框中显示????
请高手赐教 !!!!
year:
<select size="1" name="D1">
<option value="1999">1999年</option>
<option value="2000">2000年</option>
</select>
month:
<select size="1" name="D2">
<option value="1">1月</option>
<option value="2">2月</option>
<option value="3">3月</option>
</select>date:<select size="1" name="D3">
<option value="1">1日</option>
<option value="2">2日</option>
<option value="3">3日</option>
</select><input type="submit" value="提交" name="B1"><input type="reset" value="全部重写" name="B2"></p>
</form>
用
String year=request.getParameter("D1");
String month =request.getParameter("D2");
String day=request.getParameter("D3");
就可以得到年、月、日啊!
————————————————————————————————
从数据库中调用数据,如何在列表框中显示????
用html代码和jsp循环代码嵌套在一起显示:
<form method="POST" action="--WEBBOT-SELF--">
year:
<select size="1" name="D1">、
<%
while rs.next()
{
%>
<option value=<%=rs.getstring("year")><%=rs.getstring("year")</option>
<%
}
%>
</select>
随手写的,仅做提示!
while(rs.next()){
out.print("日期:"+rs.getString"year");
out.print("-"+rs.getString"month");
out.println("-"+rs.getString"day");
}
//以上是伪代码,不可直接使用。
你的select控件不会没起名字吧??
lynx1111(任我行) 的做法是对的
ocde(酬英雄志,动儿女情) 你说返回null的话,
select控件的名字是不是没定义,或写错了。
例<select name="ssssss">