简体   繁体   English

如何在jsp页面的html标记中放入html标记

[英]How to put html tag inside html tag in jsp page

In my website, I download a full webpage from another site, modify something and extract it as a string. 在我的网站上,我从另一个网站下载了完整的网页,进行了一些修改并将其提取为字符串。 Now, I want to display it as a part of my .jsp page, with scrolling bar. 现在,我想使用滚动条将其显示为.jsp页面的一部分。

How can I do that? 我怎样才能做到这一点? It shows me error when I try to put another <html> tag. 当我尝试放置另一个<html>标签时,它显示了错误。

Thanks for your help. 谢谢你的帮助。

EDIT!!! 编辑!!!

Here is my .jsp 这是我的.jsp

<%@page contentType="text/html" 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>Create Your XSLT Here</title>
    </head>
    <body>
        <form action="../AdminServlet">
            URL <input type="text" name="txtUrl" value="" /><br/>
            Start Promotion <input type="text" name="txtStart" value="" /><br/>
            Produt Name <input type="text" name="txtProductName" value="" /><br/>
            <input type="submit" value="View" name="action" />
        </form>
        <c:if test="${not empty requestScope.website}">
            <div>
                ${requestScope.website}
            </div>
        </c:if>
    </body>
</html>

requestScope.website is a full html page as a string, return from server. requestScope.website是一个完整的html页面,作为字符串,从服务器返回。 When I run, everything in the requestScope.website (such as background image) apply to all my page. 当我运行时, requestScope.website所有内容(例如背景图片)都将应用于我的所有页面。 I want to limit it to a part of my page, just like using iframe . 我想将其限制为页面的一部分,就像使用iframe

I think u can use the <jsp:include ...> tag. 我认为您可以使用<jsp:include ...>标记。 Put the whole source code into a jsp and use the tag to include to your page. 将整个源代码放入一个jsp中,并使用标记将其包括到您的页面中。

Something like 就像是

<jsp:include page="mypagepath/page.jsp"></jsp:include>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM