Go4Expert (http://www.go4expert.com/)
-   JSP (http://www.go4expert.com/forums/jsp/)
-   -   CKEditor and JSP GET problems (http://www.go4expert.com/forums/ckeditor-jsp-t21406/)

ManifestX 18Mar2010 13:08

CKEditor and JSP GET problems
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: JSP

String name = request.getParameter("name");
String editor = request.getParameter("editor1");
try {
String connectionURL = "jdbc:mysql://localhost/rems";
Connection connection = null;
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);
catch (Exception e)


ManifestX 18Mar2010 13:54

Re: CKEditor and JSP GET problems
I have figured it out.
It seems that I have to put in &lt; and &gt; 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.

ManifestX 18Mar2010 14:16

Re: CKEditor and JSP GET problems
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: JSP

String sql = "INSERT INTO template ( name, template ) VALUES ('" + name + "','" + editor +"')";

Thanks for your help, anyways. :)

All times are GMT +5.5. The time now is 19:14.