web.xml

Tomcat unable to find jsp in war file

人走茶凉 提交于 2019-12-31 01:25:30
问题 I recently switched one of my static html files to a Spring controller that uses a JSP to render its view. I use jetty to test locally and local testing shows the page rendering fine. Upon deploying to our test server, which uses Tomcat 6.0.26, I get the following exception: javax.servlet.ServletException: Could not get RequestDispatcher for [/WEB-INF/jsp/index.jsp]: check that this file exists within your WAR org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel

how to integrate angularjs and java jaas based authentication?

感情迁移 提交于 2019-12-31 01:11:28
问题 I have a webapp which has angularJS on the frontend and Java on the backed. Angular communicates with the java backend via Restful webservices consuming and sending JSON across HTTP. I need to build the authentication mechanism for this app and was wondering how would be the best approach, currently I'm using JAAS based authentication (JDBC user table). This is how my app is configured: My web.xml configuration has: <login-config> <auth-method>FORM</auth-method> <realm-name>userauth</realm

Configure web.xml (Tomcat 5) for one servlet to handle all incoming requests?

北城以北 提交于 2019-12-30 09:38:15
问题 Basically I want one servlet to handle all incoming request regardless of the path. I'm on shared hosting environment with access to configure my own web.xml file. I have the following configured in web.xml, but it doesn't work on Tomcat 5: <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee

HOWTO handle 404 exceptions globally using Spring MVC configured using Java based Annotations

依然范特西╮ 提交于 2019-12-30 04:22:05
问题 ( SOLUTION posted at the end of the Question) I am building a Spring 4 MVC app. And it is completely configured using Java Annotations. There is no web.xml . The app is configured by using instance of AbstractAnnotationConfigDispatcherServletInitializer and WebMvcConfigurerAdapter like so, @Configuration @EnableWebMvc @ComponentScan(basePackages = {"com.example.*"}) @EnableTransactionManagement @PropertySource("/WEB-INF/properties/application.properties") public class WebAppConfig extends

How can I read context parameter/web.xml values in a non-servlet java file?

自闭症网瘾萝莉.ら 提交于 2019-12-30 00:30:31
问题 I've got a regular java file that I use to update and query a mysql database but I need to take configurable options in that file (like host name, password, etc) and put it in the web.xml file (or perhaps another file if that's an option, but ideally in web.xml). But I don't know how to get access to web.xml values from a regular non-servlet java file. Or would I need to read the xml (like any other xml file... or is there a shortcut route to this...) 回答1: You need to put the required

Using properties in web.xml

假如想象 提交于 2019-12-29 05:25:09
问题 I would like to control the settings in web.xml and using different once for different environments. Is it possible to use a property, from a property file on classpath, in web.xml? Something like this: <context-param> <param-name>myparam</param-name> <param-value>classpath:mypropertyfile.properties['myproperty']</param-value> </context-param> Best regards P 回答1: No. However you can pass the properties file in and read from it at runtime. <context-param> <param-name>propfile</param-name>

Configuring a spring-boot application using web.xml

笑着哭i 提交于 2019-12-28 10:44:47
问题 I'm bootifying an existing Spring Web application so the generated war file embed a Jetty web server. I want to stick to the existing configuration as much as I can in order to limit the regressions. Here is the existing web.xml : <web-app id="fbecart-webapp" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <context-param> <param-name

Getting error: The content of element type “web-app” must match,

感情迁移 提交于 2019-12-28 05:36:25
问题 When I build my project in Eclipse Helios Service Release 2, I get an error in my web.xml . Please suggest what I have to do for this. In my project I am using DTD 2.2. The error is below. The content of element type "web-app" must match "(icon?,display- name?,description?,distributable?,context-param*,servlet*,servlet-mapping*,session-config?,mime- mapping*,welcome-file-list?,error-page*,taglib*,resource-ref*,security-constraint*,login-config?,security- role*,env-entry*,ejb-ref*)". 回答1: The

Getting error: The content of element type “web-app” must match,

≯℡__Kan透↙ 提交于 2019-12-28 05:36:13
问题 When I build my project in Eclipse Helios Service Release 2, I get an error in my web.xml . Please suggest what I have to do for this. In my project I am using DTD 2.2. The error is below. The content of element type "web-app" must match "(icon?,display- name?,description?,distributable?,context-param*,servlet*,servlet-mapping*,session-config?,mime- mapping*,welcome-file-list?,error-page*,taglib*,resource-ref*,security-constraint*,login-config?,security- role*,env-entry*,ejb-ref*)". 回答1: The

How can I map a “root” Servlet so that other scripts are still runnable?

笑着哭i 提交于 2019-12-28 02:42:07
问题 I'm trying to build a Servlet that calls a JSP page similar to the following: public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { req.getRequestDispatcher("/WEB-INF/main.jsp").forward(req, resp); } I need this Servlet to respond to the domain's root (eg: http://example.com/) so I'm using the following mapping in the web.xml: <servlet-mapping> <servlet-name>MainServlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> The