百度富文本编辑器

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

然后解压 ,放到webContent目录下    

<%@ 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>

 

 

 

接下来,配置

<%@ 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 here</title>

</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 here</title>

</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);

     }

}

 

 

 

 

 

 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值