简体   繁体   English

无法在其他JSP中包含JSP文件

[英]Not able to include jsp file in other jsp

in my localhost it is working. 在我的本地主机正在工作。 but in my site www.step2java.com the Java Core link not working. 但是在我的网站www.step2java.com中 ,Java Core链接不起作用。

when i put menu.jsp out side jsp folder and nav_home.jsp outside navigation-left folder it's working. 当我将menu.jsp放在jsp文件夹之外,并将nav_home.jsp放在左侧导航文件夹之外时,它正在工作。

i wonder how it's working in my localhost 我想知道它在我的本地主机中如何工作

u can visit step2java.com for more information about problem 您可以访问step2java.com了解有关问题的更多信息

web.xml web.xml

 <web-app>
  <display-name>Archetype Created Web Application</display-name>

  <welcome-file-list>
  <welcome-file>/index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

index.jsp index.jsp

<%@include file="/jsp/menu.jsp" %>
<%@include file="/navigation-left/nav_home.jsp" %>
<%@include file="/containerPage/container_Home.jsp" %>
<div class="navigation-right"> </div>

menu.jsp menu.jsp

<link href="<%=request.getContextPath() %>/css/style.css"
            rel="stylesheet" type="text/css" />
 <script  src="<%=request.getContextPath() %>/js/js_library/jquery-1.10.2.js"></script>
 <script  src="<%=request.getContextPath() %>/js/js_library/jquery-1.3.2.min.js"></script>
  <script  src="<%=request.getContextPath() %>/js/navigation.js"></script>

<body>
<div id="header"><div class="container">
<div id="header-logo"> <a title="step2java.com" href="#"><div ><img  style="border: 0 none;height: auto;max-width: 34%;vertical-align: middle;"alt="" src="<%=request.getContextPath() %>/images/logo.jpg" ></div> </a></div>
<h1 style="margin-top: 43px;">Step2Java</h1>
</div></div>
<div id="menu"><div class="container">
<ul><li class="menu-allround"> <a href="<%=request.getContextPath()%>">Home</a></li><li class="menu-allround"> <a href="<%=request.getContextPath()%>/jsp/javaHome.jsp">Java Core</a></li><li class="menu-allround"> <a href="#">Spring</a></li><li class="menu-topround"> <a href="#">Hibernate</a><div class="dropdown" id="hibernate-menu"><div class="tut-title">Hibernate Tutorials</div><div class="dropdown-item"> <div>1. <a href="#">Hibernate Core</a></div></div></div></li><li class="menu-topround"> <a href="#">Others</a><div class="dropdown" id="misc-menu"><div class="dropdown-item"><ol><li><a href="#">Java MongoDB</a></li><li><a href="#">jUnit</a></li><li><a href="#">jQuery</a></li></ol></div></div></li></ul>

</div></div>

</body>

Use a dynamic include in your index.jsp page: index.jsp页面中使用动态包含

<jsp:include page="jsp/menu.jsp" />
<jsp:include page="navigation-left/nav_home.jsp" />
<jsp:include page="containerPage/container_Home.jsp" />

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

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