草庐IT

$servlet

全部标签

java - 根上下文和调度程序 servlet 上下文到底是如何进入 Spring MVC Web 应用程序的?

我正在学习SpringMVC,我有一些疑问所以,我有这个配置类来配置处理用户请求的DispatcherServlet:publicclassMyWebAppInitializerimplementsWebApplicationInitializer{@OverridepublicvoidonStartup(ServletContextcontainer){//Createthe'root'SpringapplicationcontextAnnotationConfigWebApplicationContextrootContext=...//Createthedispatcherser

spring - 在 Spring Boot 应用程序中添加 Servlet 过滤器

我想要ETagsuport.为此,有一个ShallowEtagHeaderFilter可以完成所有工作。如何添加它而不在我的web.xml中声明它(它实际上不存在,因为到目前为止我不知何故没有它)?附:我使用SpringBoot1.1.4附言这是一个完整的解决方案packagecuenation.api;importorg.springframework.boot.context.embedded.FilterRegistrationBean;importorg.springframework.context.annotation.Bean;importorg.springframew

spring - 在 Spring Boot 应用程序中添加 Servlet 过滤器

我想要ETagsuport.为此,有一个ShallowEtagHeaderFilter可以完成所有工作。如何添加它而不在我的web.xml中声明它(它实际上不存在,因为到目前为止我不知何故没有它)?附:我使用SpringBoot1.1.4附言这是一个完整的解决方案packagecuenation.api;importorg.springframework.boot.context.embedded.FilterRegistrationBean;importorg.springframework.context.annotation.Bean;importorg.springframew

spring - applicationContext 找不到 Servlet 上下文的 Controller

我有一个带有applicationContext.xml和dispatcher-servlet.xml配置的SpringWeb应用程序。我已经定义了在applicationContext.xml中,但是当我运行我的应用程序时,除非我还添加,否则找不到Controller到dispatcher-servlet.xml。我在两者中都使用相同的基本包,所以这不是问题。我很困惑,因为我认为applicationContext.xml是dispatcher-servlet.xml的父级。不会放在applicationContext.xml中就足够了吗?web.xmlcontextConfigLo

spring - applicationContext 找不到 Servlet 上下文的 Controller

我有一个带有applicationContext.xml和dispatcher-servlet.xml配置的SpringWeb应用程序。我已经定义了在applicationContext.xml中,但是当我运行我的应用程序时,除非我还添加,否则找不到Controller到dispatcher-servlet.xml。我在两者中都使用相同的基本包,所以这不是问题。我很困惑,因为我认为applicationContext.xml是dispatcher-servlet.xml的父级。不会放在applicationContext.xml中就足够了吗?web.xmlcontextConfigLo

java - 在 Spring Boot 中使用多个调度程序 Servlet/Web 上下文

我创建了一个带有父上下文(服务)和子上下文(spring-webmvcController)的SpringBoot应用程序:@ConfigurationpublicclassMainApiApplication{publicstaticvoidmain(String[]args){newSpringApplicationBuilder().parent(Services.class).child(ApiOne.class,MainApiApplication.class).run(args);}@BeanpublicEmbeddedServletContainerFactoryserv

java - 在 Spring Boot 中使用多个调度程序 Servlet/Web 上下文

我创建了一个带有父上下文(服务)和子上下文(spring-webmvcController)的SpringBoot应用程序:@ConfigurationpublicclassMainApiApplication{publicstaticvoidmain(String[]args){newSpringApplicationBuilder().parent(Services.class).child(ApiOne.class,MainApiApplication.class).run(args);}@BeanpublicEmbeddedServletContainerFactoryserv

java - SpringMVC servlet映射

我编写了一个非常简单的SpringMVC应用程序。抱歉,我是SpringMVC的新手,所以请多多包涵。web.xml如下contextConfigLocation/WEB-INF/spring/root-context.xmlorg.springframework.web.context.ContextLoaderListenerappServletorg.springframework.web.servlet.DispatcherServletcontextConfigLocation/WEB-INF/spring/appServlet/servlet-context.xml1app

java - jsp表单发送数据到servlet而不改变页面

我用的是jsp+servlets,有一个form。如何在不离开包含表单的实际页面的情况下将表单数据发送到servlet(发送到doPost()方法)?我想按下“提交”按钮,数据应该被发送,我想仍然留在带有表单的页面上。我宁愿不使用javascript。我在http://localhost/myproject/FirstName:LastName:当点击提交按钮时,我被转发到以下页面:http://localhost/myproject/anotherpage但我想留下来http://localhost/myproject/编辑:现在我要写request.getRequestDispat

java - 从 JBoss 中的 servlet 访问 Spring bean

我想在JBoss中编写一个简单的servlet,它将调用Springbean上的一个方法。目的是允许用户通过点击URL来启动内部工作。在servlet中获取对Springbean的引用的最简单方法是什么?JBossWeb服务允许您使用@Resource注释将WebServiceContext注入(inject)到您的服务类中。有什么类似的东西可以在普通的servlet中工作吗?解决此特定问题的Web服务将使用大锤来粉碎坚果。 最佳答案 有一种更复杂的方法可以做到这一点。org.springframework.web.context.