Tag: web.xml

没有发现WebApplicationContext:没有ContextLoaderListener注册?

我试图创build一个简单的Spring 3应用程序,并有以下文件。 请告诉我这个错误的原因 下面是我的web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>Spring2</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app> 以下是我的index.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> […]

如何在web.xml中指定默认错误页面?

我在web.xml中使用<error-page>元素来指​​定友好的错误页面,当用户遇到一些错误,例如错误代码为404时: <error-page> <error-code>404</error-code> <location>/Error404.html</location> </error-page> 不过,我希望如果用户不符合<error-page>指定的任何错误代码,他或她应该看到一个默认的错误页面。 我怎样才能使用web.xml中的元素?

JSF Facelets:有时我会看到URL是.jsf,有时是.xhtml。 为什么?

一直试图学习JSF,有时我看到的URL是.jsf ,有时是.xhtml 。 有人可以填补我的知识吗? 当我使用Facelet创buildJSF时,文件扩展名为.xhtml ,那么.jsf URL扩展名是从哪里来的?

servlet映射url模式中的/和/ *之间的区别

熟悉的代码: <servlet-mapping> <servlet-name>main</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>main</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> 我的理解是, /*映射到http://host:port/context/* 。 怎么样? 它肯定不会只映射到http://host:port/context root。 实际上,它将接受http://host:port/context/hello ,但拒绝http://host:port/context/hello.jsp 。 任何人都可以解释如何http://host:port/context/hello映射?

EL表达式在JSP中不被评估

我的servlets / jsp web应用程序存在一个小问题。 我试图在jsp页面中使用jstl。 当我使用任何标签例如: <c:out value="${command}"/> 它显示了我 ${command} 在我的浏览器中,而不是参数'命令'的值。 我正在使用maven(我猜这个问题在这里)。 这里是pom的xml依赖关系: <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> 我的web.xml声明标签: <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> 和jsp部分: <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <html> <head> <title>Parsing results</title> <link type="text/css" rel="stylesheet" href="css/page.css"/> <link type="text/css" rel="stylesheet" href="css/table.css"/> </head> […]