web.xml

Order of loading contextConfigLocation in web.xml of Spring Servlet project

夙愿已清 提交于 2019-12-17 22:31:25
问题 Suppose that I have a Spring Java project and I am trying to configure it as a web server servlet. Here is a stripped-down version of the web.xml file: <context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/spring/generalApplicationContext.xml </param-value> </context-param> <servlet> <servlet-name>my-servlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name>

*.xhtml url-pattern causes java.lang.NullPointerException at com.sun.faces.context.flash.ELFlash.loggingGetPhaseMapForReading

ε祈祈猫儿з 提交于 2019-12-17 20:52:06
问题 I am trying to force JSF to process my welcome file. I have set the servlet-mapping in my web.xml to the following: <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.xhtml</url-pattern> </servlet-mapping> However, when I try to run my project after doing this, I get this exception: java.lang.NullPointerException at com.sun.faces.context.flash.ELFlash.loggingGetPhaseMapForReading(ELFlash.java:793) at com.sun.faces.context.flash.ELFlash.getPhaseMapForReading(ELFlash

<error-page> tag in web.xml doesn't catch java.lang.Throwable Exceptions

狂风中的少年 提交于 2019-12-17 20:28:19
问题 I have a web-app developed with servlet & JSP. I configured my app to throw an IllegalArgumentException if I insert bad parameters. Then I configured my web.xml file in this way: <error-page> <error-code>404</error-code> <location>/error.jsp</location> </error-page> <error-page> <exception-type>java.lang.Throwable</exception-type> <location>/error.jsp</location> </error-page> When I rise a 404 error , then it works and calls error.jsp , but when I rise a java.lang.IllegalArgumentException ,

Using JSP code in JavaScript

两盒软妹~` 提交于 2019-12-17 18:24:01
问题 I want to use JSTL's fmt tag in JavaScript to localize my alert messages. My JavaScript file is a standalone file and when I include fmt tag in js, the file browser gives JavaScript errors. Is it possible to treat .js file as .jsp files using web.xml configuration? Can anyone please suggest how can I do that? 回答1: is it possible to treat .js file as .jsp file using web.xml configuration? Yes: <servlet> <servlet-name>scriptjsp</servlet-name> <jsp-file>/script.jsp</jsp-file> </servlet> <servlet

load spring bean into a servlet

喜欢而已 提交于 2019-12-17 16:44:18
问题 There are many documentations out there on how to achieve this task but I still couldn't resolve my issue. I'm new to working with servlet so I probably missed something. I use red5 that uses tomcat 6 to create a servlet that uses a spring bean that's of a MysqlDb class for database manipulations. when I point to red5 using port 5080 it acts as a regular tomcat server and i can browse jsp and servlet pages. my web.xml contains the following relevant information: <listener> <listener-class>org

How to use a sub-folder as web.xml welcome directory

牧云@^-^@ 提交于 2019-12-17 16:37:11
问题 I want to configure my web.xml for Google App Engine, but my configuration doesn't work. I want to change the default index.html with WebApp/index.html . Here is the web.xml : <servlet> <servlet-name>App</servlet-name> <servlet-class>bg.app.AppServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>App</servlet-name> <url-pattern>/WebApp/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>WebApp/index.html</welcome-file> </welcome-file-list> 回答1: The "welcome file"

Is security-constraint configuration for Tomcat mandatory?

一曲冷凌霜 提交于 2019-12-17 09:20:52
问题 In order to do an SSL Configuration testing under Tomcat, is this all mandatory? This below line is taken from a website: In order to do this for our test, take any application which has already been deployed successfully in Tomcat and first access it through http and https to see if it works fine. If yes, then open the web.xml of that application and just add this XML fragment before web-app ends i.e </web-app> : <security-constraint> <web-resource-collection> <web-resource-name>securedapp<

Referencing Environment Variables in web.xml

自闭症网瘾萝莉.ら 提交于 2019-12-17 07:17:05
问题 I'm pre-packaging a JSP web-app that relies on some file path settings found within web.xml. These settings are unknown at packaging time, because they reference a path the customer will set when deploying the entire application (of which the web-app is a management interface). It seems that the easiest way to avoid tokens and file modifications in my installer script, is to ask the user for an install location, set this location as an environment variable (e.g JAVA_HOME), and have web.xml

“The Struts dispatcher cannot be found” error while deploying application on WebLogic 12.1.3

丶灬走出姿态 提交于 2019-12-17 06:54:51
问题 I have the following error while trying to run my application on WebLogic 12.1.3. The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. This is my web.xml file : <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation=

Can we use regular expressions in web.xml URL patterns?

[亡魂溺海] 提交于 2019-12-17 04:29:17
问题 I am writing a filter to do a specific task but I am unable to set a specific url pattern to my filter. My filter mapping is as follows: <web.xml> <filter> <filter-name>myFilter</filter-name> <filter-class>test.MyFilter</filter-class> </filter> <filter-mapping> <filter-name>myFilter</filter-name> <url-pattern>/org/test/*/keys/*</url-pattern> </filter-mapping> </web-app> My url-pattern [ /org/test/ * /keys/ * ] is not working as I had expected. I am calling urls from the browser like: http:/