st.executeUpdate("REPLACE insertlist SET Id="+Id+",Title="+Title+",StartElement="+StartElement+",EndElement="+EndElement+",Content="+Content+",FileList="+FileList+" WHERE Id="+Id+"");在sql语句中,字符型的数据要用单引号括起来。写成这样:
st.executeUpdate("REPLACE insertlist SET Id='"+Id+"',Title='"+Title+"',StartElement='"+StartElement+"',EndElement='"+EndElement+"',Content='"+Content+"',FileList='"+FileList+"' WHERE Id="+Id+"");
st.executeUpdate("REPLACE insertlist SET Id='"+Id+"',Title='"+Title+"',StartElement='"+StartElement+"',EndElement='"+EndElement+"',Content='"+Content+"',FileList='"+FileList+"' WHERE Id="+Id+"");
对那几个request.getParameter();中可能包含中文的字符串转换下编码试试。
我加了单括号
新的错误是org.apache.jasper.JasperException: Syntax error or access violation: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE Id=1' at line 1还是没有写入数据库啊
st.executeUpdate("REPLACE insertlist SET Id='"+Id+"',Title='"+Title+"',StartElement='"+StartElement+"',EndElement='"+EndElement+"',Content='"+Content+"',FileList='"+FileList+"' WHERE Id='"+Id+"'");