servlets

Java Servlet: Specify start page wih @WebServlet annotation

耗尽温柔 提交于 2021-02-10 05:06:54
问题 I work with Eclipse Java EE, I have tomcat 7.xx server and a Java Servlet. I need to specify in the Java Servlet as startpage "WebContent/mypage.html". How can I do that with the @WebServlet annotation? This is my web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app 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" version="2.4"> <welcome-file

Java Servlet: Specify start page wih @WebServlet annotation

ε祈祈猫儿з 提交于 2021-02-10 05:05:44
问题 I work with Eclipse Java EE, I have tomcat 7.xx server and a Java Servlet. I need to specify in the Java Servlet as startpage "WebContent/mypage.html". How can I do that with the @WebServlet annotation? This is my web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app 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" version="2.4"> <welcome-file

tomcat websocket servlet listening port

こ雲淡風輕ζ 提交于 2021-02-09 20:45:00
问题 I'm trying to write a servlet that uses org.apache.catalina.websocket.WebSocketServlet . I've found an example of websocket chat, but I can't figure out how can I specify the listening port for a websocket server (which is implemented in this servlet)? For example I need to listen for clients connection on port 11337 . But how I can express this? OK, here is the (simplified) code: public class TestServlet extends WebSocketServlet { private static final Logger logger = LoggerFactory.getLogger

tomcat websocket servlet listening port

妖精的绣舞 提交于 2021-02-09 20:43:37
问题 I'm trying to write a servlet that uses org.apache.catalina.websocket.WebSocketServlet . I've found an example of websocket chat, but I can't figure out how can I specify the listening port for a websocket server (which is implemented in this servlet)? For example I need to listen for clients connection on port 11337 . But how I can express this? OK, here is the (simplified) code: public class TestServlet extends WebSocketServlet { private static final Logger logger = LoggerFactory.getLogger

tomcat websocket servlet listening port

泪湿孤枕 提交于 2021-02-09 20:43:08
问题 I'm trying to write a servlet that uses org.apache.catalina.websocket.WebSocketServlet . I've found an example of websocket chat, but I can't figure out how can I specify the listening port for a websocket server (which is implemented in this servlet)? For example I need to listen for clients connection on port 11337 . But how I can express this? OK, here is the (simplified) code: public class TestServlet extends WebSocketServlet { private static final Logger logger = LoggerFactory.getLogger

How to configure MessageDispatcherServlet programmatically

不问归期 提交于 2021-02-08 11:51:07
问题 I am trying to learn spring-ws and started with this tutorial: http://spring.io/guides/gs/producing-web-service/#initial. What I would like to do now is to start the service on non-embedded servlet container by configuring the application programmatically. I am stuck on how to setup Message Dispatcher Servlet without web.xml. What i tried to is to implement WebApplicationInitializer interface's method onStartup(ServletContext servletContext). public class ServerInitializer implements

getOutputStream in HttpServletResponseWrapper getting called multiple times

这一生的挚爱 提交于 2021-02-08 10:21:05
问题 We are using a servlet filter to inject a string into the response before returning it. We are using an implementation of HttpServletResponseWrapper to do this. The wrapper class is called from the `doFilter() method: chain.doFilter(request, responseWrapper); The code snipppet from our ResponseWrapper class is: @Override public ServletOutputStream getOutputStream() throws IOException { String theString = "someString"; // Get a reference to the superclass's outputstream. ServletOutputStream

How do I send data between servlets?

送分小仙女□ 提交于 2021-02-08 08:20:53
问题 I am pretty new to servlets and web development in general. So basically I have a servlet that queries a database and returns some values, like a name. What I want is to turn the name into a link that opens a details page for that name (which another servlet would handle). How can I send the name to the other servlet so it can query a database for the relevant details? Maybe I'm taking the wrong approach? Edit: I am using Tomcat 5.5 回答1: Pass it as request parameter. Either add it to the

Java Webapp runs fine in Eclipse but not in Tomcat

别说谁变了你拦得住时间么 提交于 2021-02-08 07:37:25
问题 I have a small Java/Spring MVC REST /Maven app that runs just fine in Eclipse but also when I run the following command from the prompt: mvn clean tomcat6:run My problem is when I do: mvn clean package and push the generated war file to the "webapps" folder in my standalone Tomcat instance, the service doesn't work anymore. The standalone Tomcat starts up just fine, no error in the logs. Interestingly enough though the standalone instance listens on port 8989 vs. 8080 when I run the app in

Context Param Values in web.xml get ignored

非 Y 不嫁゛ 提交于 2021-02-08 06:51:18
问题 I was always wondering why no primefaces theme gets applied and could never fix it. Today I found out that when I add a Bean "ServletContextInitializer" to my Application with the same stuff like in the web.xml it works. I read something that app.properties maybe overrides the settings? I got a application.properties but just for the database and jpa/hibernate. Application: @EnableAutoConfiguration @ComponentScan({ "de.develop.telefonbuch" }) public class Application extends