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

时间:2015-05-28 10:31:33

标签: java jsp

在我的localhost中它正在运行。但是在我的网站 www.step2java.com 中,Java Core链接无效。

当我将 menu.jsp 放在 jsp 文件夹外,将 nav_home.jsp 放在 navigation-left 文件夹之外它在工作。

我想知道它是如何在我的localhost中工作的

您可以访问 step2java.com 了解有关问题

的更多信息

的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

<%@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

<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>

1 个答案:

答案 0 :(得分:0)

index.jsp页面中使用dynamic include

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