Skip to content
Advertisement

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 code do exactly what

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 able to write theirs first/name). Example: And the

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 can I solve this problem? Answer This is a bit late, but technique of

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 would like to understand this concept. Answer The validate() method itself returns nothing (void).

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 = account.validate(Account.Step1.class)? I am aware of creating your

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’t supply the request URL with parameters username and password (the parameters aren’t set by the

Advertisement