javascript - div open itself in a new window from a jsp? -
i have jsp "template" view in including content several other jsp's. content other jsp's being included <div>
in template file.
inside included jsp's want have hyperlink called "popup" (or whatever). when link clicked, content of included jsp "popped out" of template jsp , opened own window.
e.g.:
template.jsp:
<body> <div> //include jsp-1.jsp </div> <div> //include jsp-2.jsp </div> </body>
jsp-1.jsp:
<p> ... <a href="">pop out</a> //clicking open new window //containing contents of jsp-1.jsp </p>
this shouldn't hard. i'm not sure if have set browser requests jsp files directly, if so, should work you:
jsp-1.jsp:
<p> ... <a href="/jsp-1.jsp" target="_blank">pop out</a> </p>
edit: re: comment losing css , js files, here's how i've solved server-side. it's little ugly, works fine.
template.jsp:
<html> <head> ... </head> <body> <c:set var="contentonly" value="true" scope="request"/> <div> <jsp:include page="jsp-1.jsp" /> </div> <div> <jsp:include page="jsp-2.jsp" /> </div> <c:remove var="contentonly" scope="request"/> </body> </html>
jsp-1.jsp:
<c:if test="${(empty contentonly) or (not contentonly)}"> <html> <head> ... <!-- jsp-1 required css , js here --> <!-- these included when page requested "standalone" --> ... </head> <body> </c:if> ... <!-- jsp-1 content here --> ... <c:if test="${(empty contentonly) or (not contentonly)}"> </body> </html> </c:if>
Comments
Post a Comment