jsp数据更新代码
<script language="javascript">
function form1_onsubmit()
{
if (document.form1.SiteName.value=="")
{
window.alert("请输入站点名称");
return false;
}
}
// 修改编辑栏高度
function Textarea_Size(num,objname)
{
var obj=document.getElementById(objname)
if (parseInt(obj.rows)+num>=3) {
obj.rows = parseInt(obj.rows) + num;
}
if (num>0)
{
obj.width="90%";
}
}
</script>
</head>
<%
String Aforder=(String)session.getAttribute("Aforder");
%>
<body>
<br />
<a href="SiteConfig_Info.jsp">站点信息</a><% if(Aforder.equals("1")){ %> | <a href="SiteConfig_Update.jsp">信息修改</a><% } %>
<hr color="#0099FF" size="1" />
<%
if (request.getParameter("SiteName") != null)
{
String SiteName=new String(request.getParameter("SiteName").getBytes("iso-8859-1"));
String SiteUrl=new String(request.getParameter("SiteUrl").getBytes("iso-8859-1"));
String SiteTitle=new String(request.getParameter("SiteTitle").getBytes("iso-8859-1"));
String ftel=new String(request.getParameter("ftel").getBytes("iso-8859-1"));
String ffax=new String(request.getParameter("ffax").getBytes("iso-8859-1"));
String address=new String(request.getParameter("address").getBytes("iso-8859-1"));
String fcode=new String(request.getParameter("fcode").getBytes("iso-8859-1"));
String email=new String(request.getParameter("email").getBytes("iso-8859-1"));
String MetaKeywords=new String(request.getParameter("MetaKeywords").getBytes("iso-8859-1"));
String MetaDescription=new String(request.getParameter("MetaDescription").getBytes("iso-8859-1"));
Statement stmt_ConfigUpdate=conn.createStatement();
String Sql_U="update hl_SiteConfig set fSiteName='"+SiteName+"',fSiteUrl='"+SiteUrl+"',fSiteTitle='"+SiteTitle+"',ftel='"+ftel+"',ffax='"+ffax+"',address='"+address+"',email='"+email+"',fcode='"+fcode+"',fMetaKeywords='"+MetaKeywords+"',fMetaDescription='"+MetaDescription+"' where ID=1";
int gai=stmt_ConfigUpdate.executeUpdate(Sql_U);
stmt_ConfigUpdate.close();
if (gai>0)
{
out.print("<p align='center'>["+ SiteName +"]网站配置修改成功</p>");
}
}
Statement stmt_SiteConfig=conn.createStatement();
String Sql="Select * from hl_SiteConfig";
ResultSet RsSiteConfig=stmt_SiteConfig.executeQuery(Sql);
RsSiteConfig.next();
%>
<form id="form1" name="form1" method="post" action="" onsubmit="return form1_onsubmit()">
<table width="700" border="0" align="center">
<tr>
<td width="120" align="right">网站名称:</td>
<td><input name="SiteName" type="text" value="<%=RsSiteConfig.getString("fSiteName")%>" size="40"/></td>
</tr>
<tr>
<td align="right">网站网址:</td>
<td><input name="SiteUrl" type="text" value="<%=RsSiteConfig.getString("fSiteUrl")%>" size="30"/>
* 输入 http:// </td>
</tr>
<tr>
<td align="right">公司名称:</td>
<td><input name="SiteTitle" type="text" value="<%=RsSiteConfig.getString("fSiteTitle")%>" size="40" /></td>
</tr>
<tr>
<td align="right">公司电话:</td>
<td><input name="ftel" type="text" value="<%=RsSiteConfig.getString("ftel")%>" size="20" /></td>
</tr>
<tr>
<td align="right">公司传真:</td>
<td><input name="ffax" type="text" value="<%=RsSiteConfig.getString("ffax")%>" size="20" /></td>
</tr>
<tr>
<td align="right">公司邮箱:</td>
<td><input name="email" type="text" value="<%=RsSiteConfig.getString("email")%>" size="30" /></td>
</tr>
<tr>
<td align="right">公司地址:</td>
<td><input name="address" type="text" value="<%=RsSiteConfig.getString("address")%>" size="30" /></td>
</tr>
<tr>
<td align="right">邮 编:</td>
<td><input name="fcode" type="text" value="<%=RsSiteConfig.getString("fcode")%>" size="15" /></td>
</tr>
<tr>
<td align="right">站点关键字:</td>
<td><textarea name="MetaKeywords" cols="60" rows="6" id="MetaKeywords"><%=RsSiteConfig.getString("fMetaKeywords")%></textarea>
<a href="javascript:Textarea_Size(-5,'MetaKeywords')" title="减小编辑区">
<font face="Wingdings" size="3" color="#0000FF">ñ</font></a>
<a href="javascript:Textarea_Size(5,'MetaKeywords')" title="增高编辑区">
<font face="Wingdings" size="3" color="#0000FF">ò</font></a>
</td>
</tr>
<tr>
<td align="right">站点描述:</td>
<td>
<textarea name="MetaDescription" cols="60" rows="6" id="MetaDescription"><%=RsSiteConfig.getString("fMetaDescription")%></textarea>
<a href="javascript:Textarea_Size(-5,'MetaDescription')" title="减小编辑区">
<font face="Wingdings" size="3" color="#0000FF">ñ</font></a>
<a href="javascript:Textarea_Size(5,'MetaDescription')" title="增高编辑区">
<font face="Wingdings" size="3" color="#0000FF">ò</font></a>
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="Submit" value="修 改" />
<input type="reset" name="Reset" value="重 置" /></td>
</tr>
</table>
</form>
<p> </p>
</body>
</html>
<%
RsSiteConfig.close();
stmt_SiteConfig.close();
conn.close();
%>