struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amit Kirdatt <Amit.Kird...@Ingenix.com>
Subject RE: URL validation with struts???
Date Tue, 15 Jul 2003 13:55:45 GMT
I think the URL validation should be done in the form's validate() method.


-----Original Message-----
From: Dichotomy [mailto:dichotomy@greenmail.ch]
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 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) Open a java.io or java.nio connection to that url to check that it is
valid. Look into File and/or InputStream for more info on how to do this.

You should never put any logic in the form bean itself (it should remain a
plain dumb form bean). Put this code in a library and make a call to it from
your action.

-- 
If education is too expensive, try ignorance.


On Tue, 15 Jul 2003 06:36:14 -0700 (PDT)
"Prashanth.S" <suman291857@yahoo.com> 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 name as well as resource
present at that url)
> Thanks in advance
> Prashanth
> 
> 
> 
> ---------------------------------
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity to
which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified that
any dissemination, distribution or copying of this e-mail is prohibited. If
you have received this e-mail in error, please notify the sender by replying
to this message and delete this e-mail immediately.

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message