我创建了一个JSP文件.
sample.jsp
<%@ page pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>Insert title here</title>
</head>
<body>
This is jsp program
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我把它放在samplejsp
项目中.
samplejsp
`-- WebContent
`-- WEB-INF
`-- sample.jsp
Run Code Online (Sandbox Code Playgroud)
我在以下网址上打开了它.
http://localhost:8080/samplejsp/sample.jsp
但它在浏览器中显示以下错误.
404错误
请求的资源(/sample.jsp)不可用.
我可以在不使用HTML表单的情况下从JSP文件调用servlet吗?
例如,在页面加载期间显示HTML表格中的数据库结果.