当前位置:首页 » 数据仓库 » webxml是什么配置
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

webxml是什么配置

发布时间: 2022-09-26 08:37:58

⑴ servlet为什么要配置web xml

web.xml其实就是servlet的一个配置文件,通过这个配置文件来寻找对应的servlet处理业务。

sun公司就是这样设计,容器通过配置文件web.xml找相应的servlet这样有助于灵活和可维护性。具体用法如下:

<servlet>
<servlet-name>MyServlet </servlet-name> //这里是servlet 的名字,自己定义 的
<servlet-class>Servlet </servlet-class> //这里是servlet的位置 。 如果在 一个包下, 就写 包名.类名
</servlet>

<servlet-mapping>
<servlet-name>MyServlet </servlet-name> //这里跟 上面的;servlet-name 必须一样
<url-pattern>/abc </url-pattern> //这里 在地址 输入访问的 时候 输入的,自己定义
</servlet-mapping>

⑵ web.xml配置

<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispacher
</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
这段配置了一个过滤器,所有的请求都是先定位到这个过滤器再被转发到对应的jsp或servlet。所以,先看看你的这个过滤器类写好了没有

如何配置 web.xml

1,在webapps中建立一个文件夹aa再在aa中建立WEB-INF文件夹,
2,在WEB_INF中复制一个web.xml
文件
,3,再在WEB-INF中创建classes文件夹和lib文件夹
4,往lib文件夹里面加入所需要的包
5,在aa文件夹中建立page文件夹用来存放jsp文件

⑷ 请问关于spring,下面在web.xml中的配置什么意思啊谢谢

<context-param>标签的意思当然是初始化启动了.
classpath:applicationContext.xml的意思就是从classpath:路径中找到SPRING的配置文件并加载上..classpath:也可以改成/WEB-INF/.就看配置文件放哪了
监听器会帮你新建BeanFactory接口的实例.然后就可以大胆的用IOC了.SPRING中配置的依赖关系都会生效.

⑸ web.xml配置参数

。。。xml头上有个dtd或者是xsd 那个文件就是说明

⑹ web.xml配置详解

1、首先打开myeclipse新建web项目,如下图所示。

⑺ web.xml中的是什么意思

web.xml主要是配置web项目启动时加载的信息,比如<context-param/>配置参数, <listener/>配置你的监听器,<filter/>配置过滤器,<servlet/>配置你的servlet实现。

在WEB端实现监听实质:实现一系列的监听接口(实现相应的接口,覆写各接口中相应的方法,在相应的事件触发的时候会执行自己的监听器中的覆写的方法,在各个方法中完成自己想要的操作,从而实现了监听)。

监听--就是在进行某种各个范围(application,session,request)中有相关值的设置、修改、替换的时候,这些操作都会触发事件,而Java中事件的代理机制,事件处理是利用listener机制,所以为了在事件触发的时候能够使自己能够采取相应的措施,就需要---->继承这样的listener,在listener中覆写相应的方法,覆写相应的事件处理方法,在对应的方法中处理对应的事件,也就是进行了监听。

web.xml文件是用来初始化工程配置信息的,比如说welcome页面,filter,listener,servlet,servlet-mapping,启动加载级别等等,当你的web工程中没用到这些当然也就不需要这个xml文件来配置你的apllication了:

<?xmlversion="1.0"encoding="UTF-8"?>
<web-appversion="2.5"
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_2_5.xsd">
</web-app>

⑻ java中web.xml具体是什么

web.xml是一个java的web程序的主要配置文件..配置程序中的一些基本信息和文件等等..具体..具体可以去看j2ee中的介绍..
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
这个给你解释一下
文件映射节点
里面的子节点filter-name 文件名字是encodingFilter
路径类型是 以.do结束的

⑼ web.xml中相关配置

在web.xml中通过contextConfigLocation配置spring,contextConfigLocation参数定义了要装入的 Spring 配置文件

部署applicationContext.xml文件
如果不写任何参数配置,默认的是在/WEB-INF/applicationContext.xml
如果指定了要加载的文件,则会去加载相应的xml,而不会去加载/WEB-INF/下的applicationContext.xml。如果没有指定的话,默认会去/WEB-INF/下加载applicationContext.xml。
如果想要自定义文件名,需要在web.xml中加入contextConfigLocation这个context参数
springmvc的默认配置文件是放在WEB-INF下的,并且要命名为 -servlet.xml, 为servlet—name,即下文中的"Springmvc"

web.xml文件中webAppRootKey属性是web项目的绝对路径,默认值是webApp.root,可以通过System.getProperty(“webApp.root”)来获取属性值或者在配置文件中通过${webApp.root}获得。

Spring通过 org.springframework.web.util.WebAppRootListener 这个监听器来注入项目路径,因此部署在同一个web容器中的项目,要配置不同的param-value(比如”项目名.root”),不然会造成冲突。但是如果在web.xml中已经配置了org.springframework.web.util.Log4jConfigListener这个监听器,则不需要配置WebAppRootListener了。因为Log4jConfigListener已经包含了WebAppRootListener的功能。WebAppRootListener要在ApplicationContext的ContextLoaderListener之前,否则ApplicationContext的bean注入根目录值时会发生无法注入异常。

"webapp.root"这个字符串可以随便写任何字符串。如果不配置默认值是"webapp.root"。

可以用System.getProperty("webapp.root")来动态获项目的运行路径。
一般返回结果例如:/usr/local/tomcat6/webapps/项目名

定义以后,在Web Container启动时将把ROOT的绝对路径写到系统变量里。
然后log4j的配置文件里就可以用${webName.root }来表示Web目录的绝对路径,把log文件存放于webapp中。
此参数用于后面的“Log4jConfigListener”-->

⑽ web.xml配置

大哥不敢当,发一个我的web.xml给你看看,感觉内容差不多
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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_2_5.xsd">

<filter>
<filter-name>SetCharacterEncoding</filter-name>
<filter-class>e.ontest.filter.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>gb18030</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>SetCharacterEncoding</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>

<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<jsp-config>
<taglib>
<taglib-uri>http://www.woodisthebest.org</taglib-uri>
<taglib-location>/pagetag_tld/pagetag.tld</taglib-location>
</taglib>
</jsp-config>

</web-app>

试试不要将tag的tld放在WEB-INF目录下呢