Spring模板Hello world项目不起作用
我正在学习 Spring STS 并尝试创建简单的 Web 项目。我选择了 Spring 模板项目 -> Spring MVC 项目,填写名称并单击“完成”。我对这个项目没有做更多的事情,但它从一开始就有一个错误:
找不到“http://java.sun.com/jsp/jstl/core”的标签库描述符
这是关于home.jsp
文件向导已创建。那么为什么他们不在模板中引用库描述符时放置库描述符呢?
EDIT1
如果我运行此程序,则会收到错误 404 http://localhost:8080/
not found。
来自日志:
警告:org.springframework.web.servlet.PageNotFound - 在名称为“appServlet”的 DispatcherServlet 中未找到带有 URI [
] 的 HTTP 请求的映射
I am learning Spring STS and trying to create simple web project. I have selected Spring Template Project -> Spring MVC Project, filled names and clicked "Finish". I did nothing more with the project, but it have an error in it from the very beginning:
Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"
This is about home.jsp
file wizard created. So why don't they put library descriptor while referencing it in template?
EDIT1
If I run this program, I get error 404 http://localhost:8080/<appname>/
not found.
From log:
WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [<appname>
] in DispatcherServlet with name 'appServlet'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我遇到了同样的问题,这是解决方案:
对于第一个问题:
为了修复上面的错误,右键单击项目资源管理器中的 webapp 目录并选择 Build Path –>单击用作源文件夹。其作用是将 webapp 目录添加到构建路径,以确保我们的 webapp 文件包含在部署中。
对于您的第二个问题“找不到“http://java.sun.com/jsp/jstl/core”的标签库描述符”
有时我注意到 STS 最初并未在模板中构建所有文件,因此只需转到 home.jsp 并重新保存它。
我写了一个关于这个主题的教程,可能对您也有帮助:
http://devhub.fm/?p=56< /a>
祝你好运!
I ran into the same issue, here is the solution:
For the first issue:
In order to fix the error above right click on the webapp directory in your project explorer and select Build Path –> Click Use as Source Folder. What this does is add the webapp directory to the build path which ensures our webapp files are included in the deployment.
For your second issue 'Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"'
Sometimes i notice STS doesnt build all the files initially in the template, so just go to home.jsp and re-save it.
I wrote a tutorial on this subject that might help you also:
http://devhub.fm/?p=56
Good luck!
根据 这篇文章,项目> STS 中的 Clean 为我解决了这个问题。
As per this post, Project > Clean within STS resolved this for me.
问题已为我解决...实际上,在使用 sts 创建 Spring MVC 项目时,它会提示输入项目/应用程序名称以及包名称。因此,如果项目名称是 TestPayments 并且包名称是 com.xyz. payments,那么在创建项目后,当您运行项目并点击 localhost:8080/TestPayments 的 url 时,它会显示资源未找到或 404。但实际上它作为 localhost 工作: 8080/ payment
在创建项目时,它会在 pom.xml 中将artifactId创建为“付款”(基于包名称)
不知道为什么,但它是这样工作的。
Issue is resolved for me ...Actually while creating Spring MVC Project using sts it prompts for project/application name and also the package name. So if project name is TestPayments and package name is com.xyz.payments then after creating the project when you run the project and hit the url as localhost:8080/TestPayments it says resource not found or 404. But actually it works as localhost:8080/payments
While creating the project it creates the artifactId as "payments" in your pom.xml (based on the package name)
Not sure why but it works like that.