在textarea中包含html页面(Include html page in textarea)
我正在尝试创建一个管理平台,有人可以编辑html文件的文本。
为此,我创建了另一个页面,我想我可以将整个html文件加载到textarea中。
我正在使用Thymeleaf和Spring。 我不希望在textarea中呈现html文本(在stackoverflow中大多数关于此问题的想要渲染html)。
这是一个例子:
页面(文本)我想要在文本区域内:
index.html的:<!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org"> <head> <title>Login</title> <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}" href="../../static/public/css/bootstrap.min.css" /> </head> <body onload="document.f.username.focus();"> <div class="container"> <div class="navbar"> <div class="navbar-inner"> <a class="brand" href="http://www.thymeleaf.org"> Thymeleaf - Plain </a> <ul class="nav"> <li><a th:href="@{/}" href="home.html"> Home </a></li> </ul> </div> </div> <div class="content"> <p th:if="${param.logout}" class="alert">You have been logged out</p> <p th:if="${param.error}" class="alert alert-error">There was an error, please try again</p> <h2>Login with Username and Password</h2> <form id="login" name="login" th:action="@{/j_spring_security_check}" action="/doLogin" method="POST"> <fieldset> <input type="text" name="username" value="" placeholder="Username" /> <input type="password" name="password" placeholder="Password" /> </fieldset> <input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}" /> <input type="submit" id="login" value="Login" class="btn btn-primary" /> </form> </div> </div> </body>
我希望用户能够完全编辑,所以我想在texarea中包含这样的文本,如下所示:
<div class="content"> <h1>Editing page index.html</h1> <h2>HTML code: </h2> <textarea th:text="${param.clic[0]}">//Here is where i need help </textarea> </div>
有可能做我想做的事吗?
谢谢你的帮助! 如果您需要更多细节,我将很乐意给予他们
I'm trying to make an administrative platform where someone can edit the text of an html file.
For this I made another page in which I'm thinking I could load the whole html file into a textarea.
I'm using Thymeleaf and Spring for this. and I DON'T want the html text to be rendered inside the textarea (most questions about this in stackoverflow want to render the html).
Here's an example:
Page (text) I want to be inside the text area:
index.html:<!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org"> <head> <title>Login</title> <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}" href="../../static/public/css/bootstrap.min.css" /> </head> <body onload="document.f.username.focus();"> <div class="container"> <div class="navbar"> <div class="navbar-inner"> <a class="brand" href="http://www.thymeleaf.org"> Thymeleaf - Plain </a> <ul class="nav"> <li><a th:href="@{/}" href="home.html"> Home </a></li> </ul> </div> </div> <div class="content"> <p th:if="${param.logout}" class="alert">You have been logged out</p> <p th:if="${param.error}" class="alert alert-error">There was an error, please try again</p> <h2>Login with Username and Password</h2> <form id="login" name="login" th:action="@{/j_spring_security_check}" action="/doLogin" method="POST"> <fieldset> <input type="text" name="username" value="" placeholder="Username" /> <input type="password" name="password" placeholder="Password" /> </fieldset> <input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}" /> <input type="submit" id="login" value="Login" class="btn btn-primary" /> </form> </div> </div> </body>
And I want the user to be able to edit exactly that so I want to include that text in a texarea like this:
<div class="content"> <h1>Editing page index.html</h1> <h2>HTML code: </h2> <textarea th:text="${param.clic[0]}">//Here is where i need help </textarea> </div>
Is it possible to do what I'm trying to do?
Thank you for you help! If you need any more details I'll be happy to give them
原文:https://stackoverflow.com/questions/35304089