百度富文本编辑器

首先自己要去官网下载 https://ueditor.baidu.com/website/

然后解压 ,放到webContent目录下    

百度富文本编辑器_第1张图片

<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>百度富文本编辑器title>

<script type="text/javascript" src="utf8-jsp/ueditor.config.js">script>

<script type="text/javascript" src="utf8-jsp/ueditor.all.min.js">script>

<link rel="stylesheet" href="utf8-jsp/themes/default/css/ueditor.css">

head>

<body>

    <div align="center">

        <form action="/Demouedit/wenjian" method="post">

            <textarea id="editor" name="editor">textarea>

            <input type="submit" value="提交"/>

        form>

        <script type="text/javascript">

            var editor=new baidu.editor.ui.Editor();

            editor.render('editor');

        script>

    div>

body>

html>

 

 

 

接下来,配置

百度富文本编辑器_第2张图片百度富文本编辑器_第3张图片

<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Insert title heretitle>

head>

<body>

    <c:forEach var="file" items="${list }">

       ${file.content }

    c:forEach> 

body>

html>

 

 

 

<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Insert title heretitle>

head>

<body>

    <form action="/Demouedit/show" method="post">

        <input type="submit" value="显示"/>

    form>

body>

html>

 

 

package uedit.servlet;

 

import java.io.IOException;

import java.util.List;

 

import javax.servlet.ServletException;

import javax.servlet.annotation.WebServlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

 

import uedit.impl.editimpl;

import uedit.impl.dao.Iedit;

 

@WebServlet("/show")

public class show extends HttpServlet{

   private Iedit edit;

   @Override

    public void init() throws ServletException {

        // TODO Auto-generated method stub

        edit=new editimpl();

    }

   @Override

    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        // TODO Auto-generated method stub

        req.setCharacterEncoding("UTF-8");

        resp.setContentType("text/html;charset=UTF-8");

        List list=edit.list();

    

        req.setAttribute("list", list);

        req.getRequestDispatcher("/putsh.jsp").forward(req, resp);

    }

}package uedit.servlet;

 

import java.io.IOException;

 

import javax.security.auth.message.callback.PrivateKeyCallback.Request;

import javax.servlet.ServletException;

import javax.servlet.annotation.WebServlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

 

import uedit.domain.wenjian;

import uedit.impl.editimpl;

import uedit.impl.dao.Iedit;

@WebServlet("/wenjian")

public class cotent extends HttpServlet{

 

    /**

     *

     */

    

    private static final long serialVersionUID = 1L;

    

    

    @Override

    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        // TODO Auto-generated method stub

        req.setCharacterEncoding("UTF-8");

        resp.setContentType("text/html;charser=UTF-8");

        String content = req.getParameter("editor");

        System.out.println(content);

        Iedit con=new editimpl();

        wenjian wen=new wenjian(content);

       

        con.insertdata(wen);

     }

}package uedit.servlet;

 

import java.io.IOException;

 

import javax.security.auth.message.callback.PrivateKeyCallback.Request;

import javax.servlet.ServletException;

import javax.servlet.annotation.WebServlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

 

import uedit.domain.wenjian;

import uedit.impl.editimpl;

import uedit.impl.dao.Iedit;

@WebServlet("/wenjian")

public class cotent extends HttpServlet{

 

    /**

     *

     */

    

    private static final long serialVersionUID = 1L;

    

    

    @Override

    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        // TODO Auto-generated method stub

        req.setCharacterEncoding("UTF-8");

        resp.setContentType("text/html;charser=UTF-8");

        String content = req.getParameter("editor");

        System.out.println(content);

        Iedit con=new editimpl();

        wenjian wen=new wenjian(content);

       

        con.insertdata(wen);

     }

}

 

 

 

 

package uedit.servlet;

 

import java.io.IOException;

 

import javax.security.auth.message.callback.PrivateKeyCallback.Request;

import javax.servlet.ServletException;

import javax.servlet.annotation.WebServlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

 

import uedit.domain.wenjian;

import uedit.impl.editimpl;

import uedit.impl.dao.Iedit;

@WebServlet("/wenjian")

public class cotent extends HttpServlet{

 

    /**

     *

     */

    

    private static final long serialVersionUID = 1L;

    

    

    @Override

    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        // TODO Auto-generated method stub

        req.setCharacterEncoding("UTF-8");

        resp.setContentType("text/html;charser=UTF-8");

        String content = req.getParameter("editor");

        System.out.println(content);

        Iedit con=new editimpl();

        wenjian wen=new wenjian(content);

       

        con.insertdata(wen);

     }

}

 

 

 

 

 

 

 

你可能感兴趣的:(百度富文本编辑器)