Michael Angstadt wrote:
rajarshi roy wrote:
What happens if indexOf() returns zero?
Thank you for pointing out.Well,I will do something like this-
Or I can append something at the beginning of the string.Well,I was working on this,and this approach works.Now,again I have a problem.
As I have said before,my objective is to do validation for the strings that are passed in a
jsp from another using request.getparameter().
I am passing the request object to a method,running an Enumeration and validating the strings that are passed one by one using another method.
Something like this::
But,I am facing a very basic issue here.I am doing validation against special characters and some keywords here
There are various fields in the jsp where various kinds of data are passed.Say,for example there is a field where "date" is passed.Now date is in the format mm/dd/yyyy. Hence it contains the character "/".Similarly,the field "company_name" may contain characters like "-" and ".".
Till now,I was passing the request class for validation.Like this:
But,I cannot use this approach because as I said some of the objects may pass Strings containing "date" or "company_name" which are bound to contain some special characters.
I can obviously pass each request.getparameter() to a method performing validation,but thats too cumbersome to do.I want to know what is the proper approach in situations like this.
Thank you.