Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@page contentType="text/html"%>
- <%@page language="java" %>
- <%@page import="java.sql.*"%>
- <html>
- <head>
- <title>TinyMCE Test</title>
- <script language="javascript" type="text/javascript"
- src="../jscripts/tiny_mce/tiny_mce.js"></script>
- <script language="javascript" type="text/javascript">
- tinyMCE.init({
- mode : "textareas",
- theme : "advanced",
- plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
- theme_advanced_buttons1_add_before : "save,separator",
- theme_advanced_buttons1_add : "fontselect,fontsizeselect",
- theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
- theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
- theme_advanced_buttons3_add_before : "tablecontrols,separator",
- theme_advanced_buttons3_add : "emotions,iespell,flash,advhr,separator,print",
- theme_advanced_toolbar_location : "top",
- theme_advanced_toolbar_align : "left",
- theme_advanced_statusbar_location : "bottom",
- plugin_insertdate_dateFormat : "%Y-%m-%d",
- plugin_insertdate_timeFormat : "%H:%M:%S",
- extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
- external_link_list_url : "example_data/example_link_list.js",
- external_image_list_url : "example_data/example_image_list.js",
- flash_external_list_url : "example_data/example_flash_list.js"
- });
- tinyMCE.triggerSave(false, false);
- tinyMCE.execCommand("mceAddControl", true, "content");
- function saveMethod() {
- alert("Hello");
- //var ed = tinyMCE.get('editor1');
- //var ed = tinyMCE.get('content');
- document.myform1.storeVal.value=tinyMCE.getContent();
- alert(document.myform1.storeVal.value);
- }
- </script>
- </head>
- <body>
- <!-- form sends content to moxiecode's demo page -->
- <form method="post" name="myform1">
- <INPUT TYPE=HIDDEN NAME="storeVal" />
- <textarea name="content" id="content" cols="50" rows="15">
- This is some content that will be editable with TinyMCE.</textarea>
- <input type="submit" value="Save" onclick="saveMethod()" />
- </form>
- <%
- String str=request.getParameter("storeVal");
- System.out.println("str((((((((((())))))))"+str);
- if(str!=null)
- {
- try{
- Connection conn = null;
- Statement stmt = null;
- ResultSet rs = null;
- String DBName="test";
- String username="root";
- String pwd = "";
- Class.forName("com.mysql.jdbc.Driver").newInstance();
- conn = DriverManager.getConnection("jdbc:mysql://localhost/test?user=" + username + "&password=" +pwd);
- String sql = "INSERT INTO Sample (ID,Content) VALUES(?,?)";
- PreparedStatement pstmt = conn.prepareStatement(sql);
- pstmt.setInt(1, 500);
- pstmt.setString(2, str);
- pstmt.executeUpdate();
- }catch(Exception e){
- e.printStackTrace();
- }
- }
- %>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement