JSP Data Update code

Source: Internet
Author: User
Tags reset

JSP Data Update code
<script language= "JavaScript" >

function Form1_onsubmit ()
{
if (document.form1.sitename.value== "")
{
Window.alert ("Please enter site name");
return false;
}
}

Modify the height of the edit bar
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>

<%
String aforder= (String) session.getattribute ("Aforder");
%>

<body>
<br/>
&nbsp; <a href= "siteconfig_info.jsp" > Site information </a><% if ( Aforder.equals ("1")) {%> |&nbsp; <a href= ' siteconfig_update.jsp ' > Information modification </a><%}%>

<%
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 + "] Site Configuration modification Success </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= "border=" "0" align= "center" >
<tr>
<TD width= "align=" "right" > website name:</td>
<td><input name= "SiteName" type= "text" value= "<%=rssiteconfig.getstring (" Fsitename ")%>" size= "" 40 "/ ></td>
</tr>
<tr>
<TD align= "right" > website URL:</td>
<td><input name= "SiteURL" type= "text" value= "<%=rssiteconfig.getstring (" Fsiteurl ")%>" size= "" 30 "/ >
&nbsp;&nbsp;* input http://</td>
</tr>

<tr>
&LT;TD align= "Right" > Company name:</td>
<td><input name= "Sitetitle" type= "text" value= "<%=rssiteconfig.getstring (" Fsitetitle ")%>" size= "40 /></td>
</tr>
<tr>
&LT;TD align= "Right" > Company Tel:</td>
<td><input name= "Ftel" type= "text" value= "<%=rssiteconfig.getstring (" Ftel ")%>" size= "/></ Td>
</tr>
<tr>
&LT;TD align= "Right" > Company Fax:</td>
<td><input name= "Ffax" type= "text" value= "<%=rssiteconfig.getstring (" Ffax ")%>" size= "/></ Td>
</tr>
<tr>
&LT;TD align= "Right" > Company email:</td>
<td><input name= "Email" type= "text" value= "<%=rssiteconfig.getstring (" email ")%>" size= "/>< /TD>
</tr>
<tr>
&LT;TD align= "Right" > Company address:</td>
<td><input name= "Address" type= "text" value= "<%=rssiteconfig.getstring (" Address ")%>" size= "/> </td>
</tr>
<tr>
&LT;TD align= "Right" > Zip:</td>
<td><input name= "FCode" type= "text" value= "<%=rssiteconfig.getstring (" FCode ")%>" size= "/>< /TD>
</tr>
<tr>
&LT;TD align= "right" > site keyword:</td>
<td><textarea name= "Metakeywords" cols= "6" rows= "id=" Metakeywords (" Fmetakeywords ")%></textarea>
<a href= "Javascript:textarea_size ( -5, ' metakeywords ')" title= "reduce edit area" >
<font face= "Wingdings" size= "3" color= "#0000FF" >& #241;</font></a>
<a href= "Javascript:textarea_size (5, ' metakeywords ')" title= "Increased editing area" >
<font face= "Wingdings" size= "3" color= "#0000FF" >& #242;</font></a>
</td>
</tr>
<tr>
&LT;TD align= "Right" > site description:</td>
<td>
<textarea name= "Metadescription" cols= "6" rows= "id=" Metadescription (" Fmetadescription ")%></textarea>

<a href= "Javascript:textarea_size ( -5, ' metadescription ')" title= "reduce edit area" >
<font face= "Wingdings" size= "3" color= "#0000FF" >& #241;</font></a>
<a href= "Javascript:textarea_size (5, ' metadescription ')" title= "Increased editing area" >
<font face= "Wingdings" size= "3" color= "#0000FF" >& #242;</font></a>
</td>
</tr>

 
    <tr>
      <td></td>
       <td><input type= "Submit" name= "Submit" value= "Modify"/>
         &nbsp;
      <input type= "reset" name= "reset" value= "reset"/></TD>
  & nbsp </tr>
  </table>
</form>
<p>&nbsp;</p>
</body>
< /html>
<%
Rssiteconfig.close ();
Stmt_siteconfig.close ();
Conn.close ();
%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.