Questions tagged [spring-mvc-initbinders]

65 questions
1
vote
0 answers

Example to understand a possible invalid date through a CustomDateEditor with the exactDateLength option

According with the CustomDateEditor API for this constructor version: public CustomDateEditor(DateFormat dateFormat, boolean allowEmpty, int exactDateLength) says: Without an "exactDateLength"…
Manuel Jordan
  • 15,253
  • 21
  • 95
  • 158
1
vote
1 answer

Conflicts: Spring MVC with Hibernate Validator - Submit/Binding action

I have two entities, they are: Person and Address, relation one to one. The source code about JPA/Hibernate has been removed to keep the things simple. My problem is with Hibernate Validator. I have the following for the Person…
1
vote
1 answer

spring mvc how to improve my initBinder

I am using spring mvc and am still trying to get my head around binders, formatters and converters. I have a custom binder behind one of my controllers... @InitBinder public void initBinder(WebDataBinder webDataBinder) { SimpleDateFormat df =…
Richie
  • 4,989
  • 24
  • 90
  • 177
1
vote
0 answers

How to dateFormatter Timestamp and Date in coincide

@InitBinder public void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); dateFormat.setLenient(false); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat,…
1
vote
0 answers

Access model object in property editor in Spring MVC

I have a Map of two custom objects as property in my Model object that I display in JSP by directly binding it in path and items attribute of
1
vote
1 answer

Spring MVC 3: CustomDateEditor working but there is a validation error (BindingResult)

I have a problem with a validation error displayed when i submit my form with an empty date like that in the resulting web page: Failed to convert property value of type java.lang.String to required type java.util.Date for property dateFin; nested…
scherzoteller
  • 127
  • 1
  • 3
  • 7
1
vote
1 answer

initBinder method is not being called for conversion from String to Enum

I'm testing out the @InitBinder annotation so I can have String objects converted into appropriate Enum objects during web requests. I created the following simple Enum: SampleEnum.java public enum SampleEnum { ONE, TWO, THREE, …
1
vote
0 answers

Preselect option in form and propertyEditor

I'm working with Spring in a web application, using forms and right now it's working fine, but i'd like to change one thing and that's when I get an error. I have a small form with two text fields and one select option field and it's this select…
user2018311
  • 105
  • 2
  • 13
0
votes
1 answer

For a List object form submission does not works without BindingResult

I need an explanation on the role of BindingResults. Though i have studied it on internet and it seem to be used for validating the request and holding errors but i haven't found answers in details that could explain the situation i experienced. So…
Abhi0008
  • 1
  • 2
0
votes
1 answer

Spring mvc form handling property value setting error

Good day! I try to create a new Task using form
0
votes
0 answers

view Calendar objects in thymeleaf as dates

this is in continuation of my previous post view Calendar Objects in thymeleaf forms as date types I have taken the suggestion given in the previous post and worked on it, I did not want to update my problem description there or else it would have…
user641887
  • 1,506
  • 3
  • 32
  • 50
0
votes
2 answers

Set default format for LocalDateTime (jsr310) in spring when passed to a rest end point

I am trying to figure out the default java.time.LocalDateTime format when the user pass a date in the URL as a request parameter when used in conjunction with QueryDSL I have Looked at QuerydslPredicateArgumentResolver, and ending with…
Muhammad Hewedy
  • 29,102
  • 44
  • 127
  • 219
0
votes
1 answer

Spring initBinder StringTrimmerEditor - exclude some fields

In my current application by using init binder-StringTrimmerEditor we are nullifying all the values which are empty from the view/templates. But now I want to remove one field(movielist) from being nullified as this particular field when I edit the…
dummy
  • 67
  • 4
  • 16
0
votes
1 answer

How to bind date and time separately?

I want to bind date and time separately in a controller. I have 1 timepicker and 1 datepicker on a form, i use InitBinder binder for time picker which is, @InitBinder public void initBinder(WebDataBinder binder) { SimpleDateFormat sdf =…
0
votes
1 answer

Thymeleaf seems to prefer toString over initbinder customEditor

I want to pass a LocalDateTime object to thymeleaf with a specific format (yyyy/MM/dd HH:mm) and later receive it back into my controller class. I want to use an customEditor / initbinder to do the convertion. /** * Custom Initbinder makes…