作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
在动态 Web 项目中我有 - default.html 页面
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="./Styles/Site.css" type="text/css" />
<title>Create new customer</title>
</head>
<body>
<a href="\WEB-INF\forms\CustomerMenu.jsp">Test new</a>
</body>
</html>
我还有 CustomerMenu.jsp 页面 -
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="./Styles/Site.css" type="text/css" />
<title>Create new customer</title>
</head>
<body>
// Table ..
</body>
</html>
页面层次结构如快照 -
当我点击 default.html 中的链接时,我收到错误消息
- HTTP Status 404 -
--------------------------------------------------------------------------------
type Status report
message
description The requested resource () is not available.
最佳答案
/WEB-INF
中的文件不使用前端 Controller 就无法公开访问文件夹 servlet或特定标签,如 <jsp:include>
这要么是一个 RequestDispatcher#forward()
或 RequestDispatcher#include()
.
如果您需要通过 URL 直接访问 JSP 文件,那么您不应该将 JSP 放在 /WEB-INF
中文件夹。把它放在 /WEB-INF
外面文件夹
WebContent
|-- forms
| |-- CreateNewCustomer.html
| |-- CustomerMenu.html
| `-- CustomerMenu.jsp
|-- WEB-INF
: :
并相应地修复链接。
<a href="forms/CustomerMenu.jsp">Test new</a>
关于java - 从html链接到jsp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11779721/
我正在开发一个 voip 调用应用程序。我需要做的是在接到来电时将 Activity 带到前台。我在应用程序中使用 Twilio,并在收到推送消息时开始调用。 问题是我试图在接到任何电话时显示 Act
我是一名优秀的程序员,十分优秀!