1 Star 0 Fork 90

Lonvoy/layui-form-render

forked from adminj/layui-form-render 
Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
browse.jsp 1.55 KB
Copy Edit Raw Blame History
<%@ 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%>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/emcodes/layui-form-render.git
git@gitee.com:emcodes/layui-form-render.git
emcodes
layui-form-render
layui-form-render
master

Search