I am quite new to JSP, and I am having some troubles. I am using CKEditor with my JSP code. Everything seems to be okay with CKEditor, but it is when I go to save the HTML in the CKEditor's textarea to the DataBase, it fails and I do not see it in the exception. Or possibly it is not allowing the SQL script enter of '<html>....'? Name is the name of the file, and template is the html I am inputting into the database, ( i.e. <html><head><body> ). Here is a snippet of the rf_data.jsp Code: <% String name = request.getParameter("name"); String editor = request.getParameter("editor1"); try { String connectionURL = "jdbc:mysql://localhost/rems"; Connection connection = null; Class.forName("com.mysql.jdbc.Driver").newInstance(); connection = DriverManager.getConnection(connectionURL, "root", "root"); if(!connection.isClosed()){ } Statement stmt = connection.createStatement(); ResultSet rs; String sql = "'INSERT INTO template VALUES ('" + name + "','" + editor + "')"; rs = stmt.executeQuery(sql); connection.close(); } catch (Exception e) { out.println(e.toString()); } %> Thanks. Manifest
I have figured it out. It seems that I have to put in < and > for the < and > tags. It is not exactly being posted in the database though, but at least I have solved the error I was having. Unfortunately there is still an error in the connection. Hmmm.
Sorry for tripple posting, but I could not edit. Though good news. I have found out my problem. The problem was the SQL string, I have fixed it to the following: Code: String sql = "INSERT INTO template ( name, template ) VALUES ('" + name + "','" + editor +"')"; Thanks for your help, anyways.