Steps:
1) Use a regular expression to check that the url fits the pattern you are looking for
(here's a good tutorial on regexes:
http://www.zvon.org/other/PerlTutorial/Output/index.html). You can do this directly
with the validator framework if you're using it, or later from the action.
2)
I think the URL validation should be done in the form's validate() method.
-Original Message-
From: Dichotomy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 15, 2003 11:48 AM
To: Struts Users Mailing List
Subject: Re: URL validation with struts???
Steps:
1) Use a regular expression
Hi Prashanth,
I have done this using the Struts validator. I use the mask rule as
follows:
form name=serviceProviderForm
field property=URL depends=required,mask
msg name=mask
key=error.invalid.ServiceProviderURL/
arg0
Hi all,
How abt throwing MalformedURLException in the service method inside action class??
Than no need to do validation in action form??
Is it correct??
Help??
Thanks
Prashanth
Dichotomy [EMAIL PROTECTED] wrote:
Steps:
1) Use a regular expression to check that the url fits the pattern you are
That shoud do it right
Open a new URL with a specified URL, if it throws MalformedURLException
its bad URL
Panchasheel
-Original Message-
From: Prashanth.S [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 15, 2003 10:04 AM
To: Struts Users Mailing List
Subject: Re: URL validation
You could definitely do that, too. If you just create a new Url(yourstringhere) it
will raise that exception if it's malformed, so it won't waste time creating a
connection to a malformed url. I guess that's probably a better solution than the
regex one, too, because it's simpler.
--
If
Prashanth.S wrote:
Hi all,
I need to upload a resource present at a particular location by making user enter a
valid URL...How can i do URL name validation using struts???Is there anything to do
so??Do i need to do this in action form or action class??[what User entered is a valid
url i.e,both
Dichotomy wrote:
You could definitely do that, too. If you just create a new Url(yourstringhere) it will raise that exception if it's malformed,
I would encourage you to look at the implementation of URL. It does
only a small amount of validation on the format, but that may be enough,
for your
On Tue, 15 Jul 2003, Gandle, Panchasheel wrote:
That shoud do it right
Open a new URL with a specified URL, if it throws MalformedURLException
its bad URL
Unfortunately, there's a gotcha to this approach -- the JVM you are
running on has to understand the scheme part of the URL you are
To: Struts Users Mailing List
Subject: RE: URL validation with struts???
On Tue, 15 Jul 2003, Gandle, Panchasheel wrote:
That shoud do it right
Open a new URL with a specified URL, if it throws MalformedURLException
its bad URL
Unfortunately, there's a gotcha to this approach -- the JVM you
What is URL validation?
David
From: Greg Hess [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts [EMAIL PROTECTED]
Subject: URL Validation with Struts validator
Date: Wed, 5 Mar 2003 16:53:36 -0500
Hi All,
Has anyone implemented URL validation for Struts
I want to ensure my users enter a valid URL in a form.
eg: http://www.somesite.com
Greg
-Original Message-
From: David Graham [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 05, 2003 4:54 PM
To: [EMAIL PROTECTED]
Subject: Re: URL Validation with Struts validator
What is URL
you will have to do a javascript string validation in the same manner as is
done for email address validation and include it in validation-rules.xml.
-Original Message-
From: Greg Hess [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 05, 2003 4:54 PM
To: Struts
Subject: URL Validation
You could probably do a less robust version using the
existing mask rule, could you not?
-jeff
On Wednesday, March 5, 2003, at 04:11 PM, Pani, Gourav wrote:
you will have to do a javascript string validation in the same manner
as is
done for email address validation and include it in
.
Greg
-Original Message-
From: Jeff Kyser [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 05, 2003 5:26 PM
To: Struts Users Mailing List
Subject: Re: URL Validation with Struts validator
You could probably do a less robust version using the
existing mask rule, could you not?
-jeff
Mailing List
Subject: Re: URL Validation with Struts validator
You could probably do a less robust version using the
existing mask rule, could you not?
-jeff
On Wednesday, March 5, 2003, at 04:11 PM, Pani, Gourav wrote:
you will have to do a javascript string validation in the same manner
I started coding a URL client/server side validation 2 weeks ago,
that I hope to contribute to the Validation framework.
I put it on hold while getting other work finished before going on vacation.
I modeled it on the email validation items, and used the w3.org definition
of A URI to write the
Greg Hess wrote:
I was looking at that but the RFC compliant Regex I found needs to split
the string up and examine each segment separately.
Could you send me the URL where I can get the RFC compliant Regex,
or e-mail me directly ?
It would have to make the port optional, and with that I can
18 matches
Mail list logo