I have some problems with hibernate validations with Spring. I did everything as explained in an online tutorial, but it’s not working and I just go to the next page without validation error. Controller: customer-form.jsp So, there are no errors in BindingResult when I have an empty field for lastName. …
Tag: validation
Java Regex First Name Validation
I understand that validating the first name field is highly controversial due to the fact that there are so many different possibilities. However, I am just learning regex and in an effort to help grasp the concept, I have designed some simple validations to create just try to make sure I am able to make the …
validation with double value in Spring
I want to check score which have value: 0.00 <= value<= 10.00 I used: -Model(Score): -messages.properties: -servlet-context.xml: But the value = 10.01 has passed the check. Please help me. Answer I resolve my proplem with: Thank you lots @ Kayaman ,@hyness
Unique regex for first name and last name
I have a single input where users should enter name and surname. The problem is i need to use checking regEx. There’s a list of a requirements: The name should start from Capital Letter (not space) There can’t be space stacks It’s obligate to support these Name and Surname (all people are ab…
spring combine two validation annotations in one
I’m using Spring+Hibernate+Spring-MVC. I want to define a custom constraint combining two other predefined validation annotations: @NotNull @Size like this: and I want to use this annotation in my form models. UserController.java But it does not work. It accepts the less than 4 character passwords. How …
How does the validate() method in Struts 2 get the result “input”?
In Struts 2, “input” is returned when a check fails in the validate() method. I then map <result name=”input”> in struts.xml for the appropriate page. I am just wondering how it gets the “input”, which is a String when the validate() method itself returns void? I woul…
Manually call Spring Annotation Validation
I’m doing a lot of our validation with Hibernate and Spring Annotations like so: And then in the controller it’s called in the arguments: But I would like to decide the group used based on some logic in the controller method. Is there a way to call validation manually? Something like result = acco…
Save drop-down list value to database in Struts 2 with Hibernate
I want to save the selected value of drop-down list into the database. First index.jsp is loaded. From index.jsp, we can go to register.jsp when we click register URL of index.jsp. struts.xml: index.jsp: register.jsp: Action class is: the drop down list is actually only one of the form fields. there are other…
How to pass an action name using hyperlink in Struts 2?
I have a hyperlink named “Click for new User”. Once I click the link, I got NullPointerException instead of opening RegisterPage.jsp page. I post my code here, I can’t find my mistake index.jsp: struts.xml: Login.java(Action Class): Exception: Answer When you click on hyperlink you don’…
Difference between @size(max = value ) and @min(value) and @max(value)
I want to do some domain validation. In my object I have one integer. Now my question is: if I write and If it’s an integer which one is proper for domain validation? Can anybody explain me what is the difference between them? Thanks. Answer @Min and @Max are used for validating numeric fields which cou…