+ -
当前位置:首页 → 问答吧 → 在web上写入信息到Mysql服务器

在web上写入信息到Mysql服务器

时间:2011-10-06

来源:互联网

JSP下和Mysql已经可以连接,并且可以,只是怎么也不能从文本框中获得数据,给个提示。

作者: hcl_001   发布时间: 2011-10-06

文本框填好值,再发送表单,然后在action的页面进行接收文本框的值,再把这个值放到SQL语句里插入到MYSQL中就行了.

作者: huangchenliang   发布时间: 2011-10-06

在insert.jsp中: 
<% 
String opernName= " "; 
%> 

<form name= "form1 " method= "post " action= "act.jsp?opernName= <%=opernName%> " onSubmit= "return check_form(this) "> 

曲谱: <INPUT type= "text " name= "opernName " size= "20 " maxlength= "30 " value= <%=opernName%> > </P> 

在act.jsp中: 
String opernName=request.getParameter( "opernName "); 
就在这里提取不到值。 

作者: hcl_001   发布时间: 2011-10-06

在insert.jsp你的opernName定义为空了 在act.jsp中获得也是空呀 
还有FORM 
<form name= "form1 " method= "post " action= "act.jsp " onSubmit= "return check_form(this) "> 

曲谱: <INPUT type= "text " name= "opernName " size= "20 " maxlength= "30 " value= <%=opernName%> > </P> 
action里面不用加参数了 下面的TEXT已经传递opernName到act.jsp了。要有 
<INPUT type= "sumbit "...> 才能提交。

作者: huangchenliang   发布时间: 2011-10-06

在服务器上输出一下(Systemout.println(opernName)),看是否有输出,如果有的话,那就表示接受到了,没有的话检测按钮类型是否是submit。

作者: ggg957432   发布时间: 2011-10-06