spring-mvc

Request with multipart/form-data returns 415 error

不问归期 提交于 2020-03-05 00:38:32
问题 I need to receive this request using Spring : POST /test HTTP/1.1 user-agent: Dart/2.8 (dart:io) content-type: multipart/form-data; boundary=--dio-boundary-3791459749 accept-encoding: gzip content-length: 151 host: 192.168.0.107:8443 ----dio-boundary-3791459749 content-disposition: form-data; name="MyModel" {"testString":"hello world"} ----dio-boundary-3791459749-- But unfortunately this Spring endpoint: @PostMapping(value = "/test", consumes = MediaType.APPLICATION_OCTET_STREAM_VALUE) public

Request with multipart/form-data returns 415 error

谁都会走 提交于 2020-03-05 00:34:42
问题 I need to receive this request using Spring : POST /test HTTP/1.1 user-agent: Dart/2.8 (dart:io) content-type: multipart/form-data; boundary=--dio-boundary-3791459749 accept-encoding: gzip content-length: 151 host: 192.168.0.107:8443 ----dio-boundary-3791459749 content-disposition: form-data; name="MyModel" {"testString":"hello world"} ----dio-boundary-3791459749-- But unfortunately this Spring endpoint: @PostMapping(value = "/test", consumes = MediaType.APPLICATION_OCTET_STREAM_VALUE) public

Bean is not formed for datasource in Spring MVC Project

最后都变了- 提交于 2020-03-04 18:48:10
问题 I am facing error "Property datasource is required". Below is the configuration in dao-beans xml. <bean id="Template" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="java:/comp/env/jdbc/TEMPLATES" /> </bean> <bean id="languageDao" class="com.test.daoImpl.LanguageDAOImpl" init-method="init"> <property name="cspLanguageGet" value="csp_LANGUAGE_Get" /> </bean> Class has the following configurations: private DataSource Template; private SimpleJdbcCall

Best way to get data from database inside Thread Class in Spring

无人久伴 提交于 2020-03-04 02:41:07
问题 Currently i am troubling that how to get data from database inside my thread class. I can't make bean of my thread class because new instance is created of thread on every request. MyThread.class class MyThread implements Runnable{ public void run(){ //How to get Employee data and also data from other tables.?????? } } EmployeeDAO.class @Component("employeeDAO") public class EmployeeDAO { @Cacheable(value = "employeeCache") public List<Employee> getEmployees() { //got data from database

The handler mapping from the mvc:resource override other mappings which defined with annotation

霸气de小男生 提交于 2020-03-03 03:17:45
问题 I am new in spring mvc3,and I am trying to create a simple project to get close to spring mvc3. Now I meet some problem when I try to server some static resources files. Because I use the url-pattern (/) in the web.xml: <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>

The handler mapping from the mvc:resource override other mappings which defined with annotation

风格不统一 提交于 2020-03-03 03:14:51
问题 I am new in spring mvc3,and I am trying to create a simple project to get close to spring mvc3. Now I meet some problem when I try to server some static resources files. Because I use the url-pattern (/) in the web.xml: <servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>

Send list object from thymeleaf to controller

亡梦爱人 提交于 2020-02-29 08:36:26
问题 I have a big problem about saving an Object list from Thymeleaf to the controller. Object List in thymeleaf is generated by Jquery. but I don't know how to get the data to Controller, that Object list doesn't know the size. Because users can add it anytime. Please help me to send a list object in thymeleaf to controller. I’ve Created a new class with 1 properties: ArrayList loaiDoans; "LoaiDoan" is a Object that i want to save. And using that class is an object to Save List "LoaiDoan" from

Send list object from thymeleaf to controller

主宰稳场 提交于 2020-02-29 08:34:09
问题 I have a big problem about saving an Object list from Thymeleaf to the controller. Object List in thymeleaf is generated by Jquery. but I don't know how to get the data to Controller, that Object list doesn't know the size. Because users can add it anytime. Please help me to send a list object in thymeleaf to controller. I’ve Created a new class with 1 properties: ArrayList loaiDoans; "LoaiDoan" is a Object that i want to save. And using that class is an object to Save List "LoaiDoan" from

Spring MVC and Thymeleaf Resource Versioning

心不动则不痛 提交于 2020-02-28 03:56:08
问题 I am trying resource versioning with Spring Mvc 4.I use thymeleaf template engine.But doesnt work with the following code.When load the page I cant see new version Url when i view the page source.So what's the problem in my code? what am i miss? @Override public void addResourceHandlers(final ResourceHandlerRegistry registry) { registry.addResourceHandler("/static/theme*//**").addResourceLocations("/resources/static/theme/") .setCacheControl(CacheControl.maxAge(365, TimeUnit.DAYS))

Spring-mvc + Thymeleaf: dealing with complex form

霸气de小男生 提交于 2020-02-27 03:24:15
问题 I'm working on an internal tool using spring-mvc and thymeleaf. A section of this tool is used to create an entity we save in the database. This entity is quite complex; it contains many properties and relations. Some of these relations contain list and other properties. I have 2 constraints: Single page. No "wizard". To only save a completed object in the database. Now, I'm not really asking for a specific issue. I know my way around thymeleaf, spring @ModelAttribute, etc. My question is