我想调用 a Servlet 作为第一个文件来执行欢迎文件。
在这个 servlet 中,我从数据库中检索数据并将其渲染到第一页的显示页面。
我需要的是当我运行程序时
网址应该是 - http://localhost:8083/projectName/servletUrl
不是 http://localhost:8083/projectName/
如果 url 是 http://localhost:8083/projectName 这应该打我 servlet(/servletUrl) 不是welcome file 。
将您的 servlet URLpattern 配置为
<? xml 版本 = “1.0”编码 = “UTF-8” ?> < web-app xmlns:xsi = “http://www.w3.org/2001/XMLSchema-instance” xmlns = “http://xmlns.jcp .org/xml/ns/javaee" xsi:schemaLocation = "http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd " id = "WebApp_ID" 版本= "3.1" > <显示名称>项目名称显示名称> < welcome-file-list > < welcome-file > ServletURLpattern welcome-file > welcome-file-list > web-app >假设您使用 eclipse 作为 IDE 并且 servlet version 3 or 3.1 您必须 web.xml 手动创建。
| 留言与评论(共有 0 条评论) “” |