1 Star 1 Fork 87

hp / layui-form-render

forked from adminj / layui-form-render 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
browse.jsp 1.55 KB
一键复制 编辑 原始数据 按行查看 历史
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.io.ByteArrayOutputStream,java.io.File" %>
<%@ page import="java.io.FileInputStream" %>
<%@ page import="java.io.IOException" %>
<%! private static String readTextFile(File file, String encode) {
StringBuilder sbf = new StringBuilder();
FileInputStream in = null;
ByteArrayOutputStream out = null;
try {
in = new FileInputStream(file);
if (in == null) return "";
out = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len = 0;
while ((len = in.read(buffer)) != -1) {
out.write(buffer, 0, len);
}
byte[] data = out.toByteArray();
return new String(data, encode);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
}
}
if (out != null) {
try {
out.close();
} catch (IOException e) {
}
}
}
return sbf.toString();
}%>
<%
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
String html=request.getParameter("resHtml");
if(html==null)html="";
String path=request.getRealPath("/");
String txt=readTextFile(new File(path+"editor_base.html"),"utf-8");
txt=txt.replaceAll("<!--code-->",html);
%>
<%=txt%>
JavaScript
1
https://gitee.com/ez2020/layui-form-render.git
git@gitee.com:ez2020/layui-form-render.git
ez2020
layui-form-render
layui-form-render
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891