1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

CKEditor and JSP GET problems

Discussion in 'JSP' started by ManifestX, Mar 18, 2010.

  1. ManifestX

    ManifestX New Member

    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

    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) 
  2. ManifestX

    ManifestX New Member

    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.
  3. ManifestX

    ManifestX New Member

    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:

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

    Thanks for your help, anyways. :)

Share This Page