Questions tagged [spring-mvc-initbinders]

65 questions
0
votes
1 answer

Spring @initBinder method to be called only once inside a controller

I have a class that annotated with @RestController and @ControllerAdvice that has my requests mapped methods (@RequestMapping). Also in this class I added a method public void initBinder(WebDataBinder dataBinder) that is annotated with @InitBinder…
0
votes
1 answer

Spring MVC Validator. encapsulate multiple validator initialization for multiple request mappings

I have a some controllers that have multiple methods, each with a different @RequestBody domain object having its own validator @RestController public class MyController { @Autowired private Validator BeanOneValidator; @Autowired …
mjj1409
  • 3,075
  • 6
  • 28
  • 28
0
votes
1 answer

Custom Binding Required for SpringMVC Form Field

I ran into the following SpringMVC issue: there is a domain object which uses a certain Address sub-object, but the getters/setters have to be tweaked to use a different Address object via conversion. This is an architectural requirement. public…
gene b.
  • 10,512
  • 21
  • 115
  • 227
0
votes
1 answer

HV000030: No validator could be found for type: java.math.BigDecimal

I have a field: Ordinality DB: ORDINALITY NOT NULL NUMBER(2) @Column(name="ORDINALITY") @NotNull(message="Ordinality is Mandatory") @Size(max=2,message="Ordinality exceeded the limit, Max. 2 numbers are allowed.") private BigDecimal…
Asif Billa
  • 821
  • 2
  • 15
  • 28
0
votes
1 answer

How to write initbinder for json deserialization?

I have the following POJO: class MyClass{ ... HttpStatus httpStatus = HttpStatus.OK //from org.springframework.http @JsonIgnore public HttpStatus getHttpStatus() { return httpStatus; } @JsonProperty(value =…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
0
votes
0 answers

Spring InitBinder, Binding date of list of nested Beans

I have Bean DealSheetForm which has List of OrderDto beans as its property. OrderDtos has 4 datefields. I used @InitBinder to bind date format as MM/dd/yyyy at controller. Now I need to modify one of the date fields format to MM/dd/yyyy hh:mm:ss I…
Jeevan Kumar
  • 43
  • 1
  • 1
  • 4
0
votes
0 answers

Conditionally binding Spring MVC fields

I want to limit the fields that are permitted by my WebDataBinder so that ordinary users can't create objects attached to other accounts. I can do this pretty easily using an @InitBinder: @InitBinder void initBinder(WebDataBinder binder) { …
chrylis -cautiouslyoptimistic-
  • 75,269
  • 21
  • 115
  • 152
0
votes
1 answer

Spring configure mapping for nested form-objects

I have the following classes public class RequestResponseWrapper { MyDto myDto; } public class MyDto { private String field1; private String field2; .... } and I have the following controller…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
0
votes
0 answers

Mapping happening for normal objects but not for list in spring mvc

I am trying to map a collection of objects in Spring MVC but its giving error Mapping of String is working fine but could not map a collection org.springframework.beans.NotReadablePropertyException: Invalid property 'familyHistory[0].relation' of…
0
votes
1 answer

PropertyEditor in java beans are stateful?

While understanding data binding in Spring i came to know that PropertyEditors are stateful , what is meant by stateful here ? Here is the link of that…
0
votes
0 answers

Spring/initBinder - Not able to get the value binded when multiple values are selected

The below code works fine when I try to save a single value of miniApple. I can see the value of miniApple object value in argument of controller i.e., apple. However I am not able to binder if there are multiple values. Not sure what should be the…
0
votes
0 answers

Spring MVC: Request Scope, trying to update a Command Object with binder.setDisallowedFields

I have this Object public class Deportista implements Serializable { private static final long serialVersionUID = 6229604242306465153L; private String id; ... @NotNull(message="{field.null}") public String getId() { …
Manuel Jordan
  • 15,253
  • 21
  • 95
  • 158
0
votes
1 answer

Ignore form keys with initBinder

I was told there is a way for initBinder to ignore some keys passed in by a form. So say I have a POJO with a name, accountNumber, and balance. The user posts a form with an update to accountNumber with a new balance, but attempts to tamper with…
stef52
  • 1,089
  • 2
  • 15
  • 23
0
votes
1 answer

modelAttribute (list of objects) return null paramters randomly in Spring MVC

I am new to Spring MVC and I am kind of stuck debugging this issue. I fetch some details from my database and send them to the JSP from my controller, and I am able to display it properly. When I am trying to submit the same form back to the…
Karthik
  • 75
  • 2
  • 8
0
votes
1 answer

InitBinder on multiple form objects

Can you have a @Initbinder on several data in the same form? I have a spring form which contains a select dropdown of an object and two datafields, I have an Initbinder on the dates otherwise I get an error on submit. But I also need to bind the…
user2018311
  • 105
  • 2
  • 13