<%@ page contentType="text/html;charset=gb2312"%>
<%@ page language="java" import="java.sql.*,java.io.*" %>
<%!//声明变量和方法
public String getStr(String str);
{
try
{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("ISO8859-1");
String temp=new String(temp_t);
return temp;
}
catch(Exception e)
{
};
return "null";
}
%>
<%!String sortID, patentName,patentID,Inr,email1,province,Addre,linkMan, Tel,Fax;//定义非必须填写的项目
String url,email2,unit,important,indata,picture1,picture2
%>
<%
sortID=request.getParameter("sortID");
if(sortID.trim().equals("")){
sortID=null;
}
patentName=request.getParameter("patentName");
if(patentName.trim().equals("")){
patentName=null;
}
patentID=request.getParameter("patentID");
Inr=request.getParameter("Inr");
email1=request.getParameter("email1");
province=request.getParameter("province");
Addre=request.getParameter("Addre");
linkMan=request.getParameter("linkMan");
Tel=request.getParameter("Tel");
Fax=request.getParameter("Fax");
url=request.getParameter("url");
email2=request.getParameter("email2");
unit=request.getParameter("unit");
important=request.getParameter("important");
//indata=request.getParameter("indata");
picture1=request.getParameter("picture1");
picture1=request.getParameter("picture2");
%>
<%
sortID = getStr(sortID);
patentName = getStr(patentName);
patentID = getStr(patentID);
Inr= getStr(Inr);
email1 = getStr(email1);
email2 = getStr(email2);
province= getStr(province);
Addre= getStr(Addre);
linkMan = getStr(linkMan);
Tel = getStr(Tel);
Fax= getStr(Fax);
url = getStr(url);
unit = getStr(unit);
important = getStr(important);
// indata = getStr(indata);
picture1= getStr(picture1);
picture2= getStr(picture2);
%>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:patentp","patentp","patentp");
Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
%>
<%
String sqlinsert="insert into zhongjs(sortID ,patentName,patentID,Inr,email1,email2,province,Addre,linkMan,Tel,Fax,url,unit,important,indata,picturel1,picturel2) values('"+sortID+"','"+patentName+"','"+patentID+"','"+Inr+"','"+email1+"','"+email2+"','"+province+"','"+Addre+"','"+linkMan+"','"+Tel+"','"+Fax+"','"+url+"','"+unit+"','"+important+"','"+picturel+"','"+picture2+"')";
stmt.executeUpdate(sqlinsert);
//out.print(sqlinsert);
response.sendRedirect("fabuGR.htm");
%>
这个就是源代码
我是刚学的jsp
请帮帮忙