链接不适用于jsp和jquery(如何在jsp页面的定位标记中链接websiteurl) [英] Links don't work with jsp and jquery (How to link websiteurl in anchor tag in jsp page)
问题描述
在我的本地主机上正在工作.但是在我的网站 www.step2java.com 中, Java Core 链接无效. 部署后,在我的public_html中,他们将Project根文件夹放在了Step2java之类的地方.请告诉我如何解决.我只使用jsp和jquery
in my localhost it is working. but in my site www.step2java.com the Java Core link not working. in my public_html after deploying they put the Project rootfolder like Step2java. plz tell me how to solve. I m only using jsp and jquery
<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>
推荐答案
问题似乎与您链接到menu.jsp
文件的方式有关.进入jsp
目录后,此文件的路径不正确.这是我看到的错误消息:
The problem looks to be with how you are linking to the menu.jsp
file. The path to this file once you enter the jsp
directory is incorrect. Here's the error message I see:
org.apache.jasper.JasperException:/javaHome.jsp(行:2,列:1)找不到文件[/jsp/menu.jsp]
org.apache.jasper.JasperException: /javaHome.jsp (line: 2, column: 1) File [/jsp/menu.jsp] not found
我猜您正在使用的jsp:include
标记应指向menu.jsp
而不是/jsp/menu.jsp
.
The jsp:include
tag that I'm guessing you are using should point to menu.jsp
instead of /jsp/menu.jsp
.
这篇关于链接不适用于jsp和jquery(如何在jsp页面的定位标记中链接websiteurl)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!