Re: More validation woes

2003-07-25 Thread Cyber.Zombie
In both cases, you're returning an ActionForward that has no idea of the 
environment in which it was created.  So, why not forward to another 
page (like error.jsp)?

Yansheng Lin wrote:

That's what 
	return (new ActionForward(mapping.getInput());
returns.  An ActionForward to the jsp that generated the error.

Ok, take a look at the following code.  You see the difference?  findForward can
forward you to any page, but not mapping.getInput().

public ActionForward execute() {
 ...
if (!errors.isEmpty())
{
saveErrors(request, errors);
//return (mapping.findForward(error));
   return new ActionForward(mapping.getInput());
}
}

-Original Message-
From: Gregory F. March [mailto:[EMAIL PROTECTED] 
Sent: July 24, 2003 1:43 PM
To: Struts Users Mailing List
Subject: Re: More validation woes



On Jul 24, 2003, Yansheng Lin [EMAIL PROTECTED]  wrote:

|I forgot how you implemented your return statement, but
|
|  return  new ActionForward(mapping.getInput());
|
|should work.
I don't think it works.  An Action.execute() returns an ActionForward.
ActionMapping.getInput() returns a string.  Type conflict.
Or, am I doing something really dumb?

/greg

--
Gregory F. March-=-http://www.gfm.net:81/~march-=-AIM:GfmNet
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


OT: struts-user archive question

2003-07-21 Thread Cyber.Zombie
I need to solve a problem associated with the Validator.  If I use the 
online search engines, I either get too little or too much info -- and I 
have yet to find anything that pertains to my question.  Is there a 
mechanism whereby I can grab a tarball (or zip) of the last 10,000 
messages?  I know about struts-user-get.min_max@jakarta.apache.org, 
but that is limited to 100 messages per query...



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Validator problem?

2003-07-21 Thread Cyber.Zombie
While I'm waiting for an answer to my OT: ?, I figured I'd come out and 
ask the question that's been bothering me for a few days.  First, the setup:

Form:  Contains a number of fields.  Indirectly extends ValidatorForm.  
There are some processes in place not necessary for this discussion, but 
cool enough for me to talk about.  I use EJBGen to take the Entity bean 
and produce a ValueObject.  I then use a custom generator that works off 
of the *VO to produce a *FormBase that decorates the VO (composition, 
not inheritance) and allows full Struts integration (handles 
Date-StringDate conversions).  The end Form extends the FormBase and 
adds any requirements needed by the JSP (like readonly lists for 
dropdowns, boolean-String converters for Y/N database columns, etc.)

For the purposes of this discussion, there are 36 attributes.

JSP:  Contains a block of the common fields, followed by some 
nested:equals tags to add type-specific information.  NOTE:  This is 
*not* a wizard -- there is no page-by-page progression.  Only one page 
(as the user requires).  The nested:equals tag relies on one of the 
form attributes.

Struts:  validation.xml contains one form with a number of field 
definitions.  Some of these are required.  Some are 'at least one of 2 
checked' required (for which I added a custom Validator method and 
associated validator JavaScript).

Problem:  When I submit, Struts returns an error on the server side 
because fields that aren't included in the JSP are marked as required.

The solution I'd like to see is a Validator that only validates on 
fields that are included in the Submit.

A solution that I'm trying to avoid (and may fail) is to duplicate all 
of the common validation rules in validation.xml for each 'type' of 
form.  In struts-config, I'd just add more actions with the same form 
base.  Though I don't know if that would be enough.  I really don't want 
to move away from the single DispatchAction tied to a single Form with 
only 2 struts action defs (w/ and wo/ validation).

Any suggestions?



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Struts: a Graphic Artist blessing or curse?

2002-11-25 Thread Cyber.Zombie
My last JSP job did not suffer that problem -- the graphics designer 
also did 100% of the JSP work.  This on a post 1.0.2 nightly with 
integrated nested extensions (I had convinced the client on the benefits 
of the nested extension and they prefered integrated rather than in a 
separate package).  The data architect did 100% of the database work 
(and some of the use case work -- he was quite good at high-level 
analysis).  The programmers did 100% of the coding.  The only aberration 
was me (the chief architect) -- not only did I do analysis through 
detailed design (using TogetherJ for class and sequence diagrams), I 
also did a fair amount of coding.

Contrast that with my last .NET job:  The graphics designers did 
strictly static HTML work.  The converion to dynamic HTML, database work 
and coding was shared by everyone else (not much of a design to start with).

[EMAIL PROTECTED] wrote:

Haha! 

This whole idea of J2EE where we have seperation of roles hasn't quite happened has it. The idea that there are business process programmers, database programmers, front end guys etc. In the end it's always the same person fulfilling all the roles.

On the projects that I have been on in the past Graphic designers have been comissioned to make up the pages, which are done statically. Then the programmers have gone through the pains of making these pages dynamic.

Regards
IV



 

from:Foong Tzer [EMAIL PROTECTED]
date:Mon, 25 Nov 2002 13:31:26
to:  [EMAIL PROTECTED], [EMAIL PROTECTED]
subject: Re: Struts: a Graphic Artist blessing or curse?

Dear Struts supporter,

There seems to be a real world problem with using Struts (well, not
really Struts, but JSP Tag Libraries). It seems despite zero java coding
on the JSP pages, those 'funny' tags are still not digest-able by average
graphic designers. I mean, if they were to use Macromedia DreamWeaver, it
would not've rendered the look and feel if the tags were something like
this: -

html:img page=/nice.gif altKey=Nice/

html:html locale=true  /html:html

html:link page=/another.jspbean:message
key=another.title//html:link


As opposed to the native standard HTML tags?

I'm really not sure whether Macromedia or any other popular graphic
artiste tool would render these Struts JSP pages properly. Anybody here
has any experience solving this real world problem?

Thanks. Any help would be much appreciated.
Regards,

 Tzer
 [EMAIL PROTECTED]

Is J2EE messing up your mind?
http://www.see-consulting.com

--
http://fastmail.fm - Or how I learned to stop worrying and
 love email again

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]

   




http://www.amazon.co.uk/exec/obidos/redirect-home?tag=velloscouk-21placement=home_multi.gifsite=amazon

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


 




--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




[Fwd: Re: [OT - Java] How can I do this in Java?]

2002-10-01 Thread Cyber.Zombie

As it look like my last attempt bounced, resending...

---BeginMessage---

Let's take it one step further and make the Map a 1st-class object. 
 After all, shouldn't all knowledge of how to recognize a driver's 
license be localized to a single class?  Then the external interface can 
be a simple as isValidLicense( state, licenseString );

Max Cooper wrote:

I agree that reflection is not a good solution here, but does have useful
application in general (but it isn't needed here, so don't use it). Use a
singleton or a statically-initialized Map to look up the patterns based on
the state. Save yourself some time by putting Patterns in the map,
identified by the state represented as a String.

patternMap.add(AK, Pattern.compile(^[0-9]{1,7}$));

Put the map in its own class (perhaps a singleton), so you would get
patterns from it with a call like one of these:

Pattern pattern = LicensePatterns.getInstance().getPattern(licenseState);

-or-

Pattern pattern = LicensePatterns.getPattern(licenseState);

Putting the patterns is a Properties file seems like a good idea, too. How
often do the patterns change? Perhaps you could add a refresh() method to
the singleton class to reload the patterns from the properties file if you
anticipate that they will change while the app is supposed to be running.
This is usually the case, but it is often overlooked when setting such
constants.

-Max

- Original Message -
From: Jerry Jalenak [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, September 30, 2002 7:49 AM
Subject: [OT - Java] How can I do this in Java?


  

OK - off topic, but Sun's java forum sucks, and there are an incredible
number of Java guru's on this list, so I thought I'd throw this out here.
(That and I am using this in a custom validation routine  :-))Any help
would be GREATLY appreciated!

Here's the scenario - I've got a series of static constants that represent
Java regular expressions.  These RE's are used to validate driver license
formats for the 50 states + DC.  The strings look like this:

public static final String AK = ^[0-9]{1,7}$;
public static final String AL = ^[0-9]{7}$;
public static final String AR = ^[0-9]{8,9}$;
public static final String AZ =
^[0-9ABDY][0-9]{8}$|^[A-Z][0-9]{3,6}$|^[A-Z]{2}[0-9]{3,5}$;
public static final String CA = ^[A-Z][0-9]{4,7}$;
public static final String CO =
^[A-Z][0-9]{1,6}$|^[A-Z]{2}[0-9]{1,6}$|^[0-9]{9}$;
etc. etc. etc.

On my form I have a drop-down box of states, and a field for the license
number.  In my custom validator routine, I pick up the value of the state,
and build a string to represent the constant - i.e.

private static boolean validateDriversLicenseNumber(String
licenseState, String licenseNumber)
{
String licenseConstant = Constants. + licenseState;

I then want to use licenseConstant in a Pattern / Match:

Pattern p = Pattern.compile(licenseConstant,
Pattern.CASE_INSENSITIVE);
Match m = p.matcher(licenseNumber);
return (m.find());
}

Obviously the line String licenseConstant = Constants. + licenseState;
does not give me the value of Constant.state name; the question I have


is,
  

is there a method (or something) that will allow me to build such a


string,
  

and return the value (i.e. the regular expression)?  Or is there a better
way of doing this?

TIA!

Jerry Jalenak
Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496
[EMAIL PROTECTED]


This transmission (and any information attached to it) may be confidential


and is intended solely for the use of the individual or entity to which it
is addressed. If you are not the intended recipient or the person
responsible for delivering the transmission to the intended recipient, be
advised that you have received this transmission in error and that any use,
dissemination, forwarding, printing, or copying of this information is
strictly prohibited. If you have received this transmission in error, please
immediately notify LabOne at (800)388-4675.
  


--
To unsubscribe, e-mail:


mailto:[EMAIL PROTECTED]
  

For additional commands, e-mail:


mailto:[EMAIL PROTECTED]
  






--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


  




---End Message---

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


Re: [OT - Java] How can I do this in Java?

2002-09-30 Thread Cyber.Zombie

Let's take it one step further and make the Map a 1st-class object. 
 After all, shouldn't all knowledge of how to recognize a driver's 
license be localized to a single class?  Then the external interface can 
be a simple as isValidLicense( state, licenseString );

Max Cooper wrote:

I agree that reflection is not a good solution here, but does have useful
application in general (but it isn't needed here, so don't use it). Use a
singleton or a statically-initialized Map to look up the patterns based on
the state. Save yourself some time by putting Patterns in the map,
identified by the state represented as a String.

patternMap.add(AK, Pattern.compile(^[0-9]{1,7}$));

Put the map in its own class (perhaps a singleton), so you would get
patterns from it with a call like one of these:

Pattern pattern = LicensePatterns.getInstance().getPattern(licenseState);

-or-

Pattern pattern = LicensePatterns.getPattern(licenseState);

Putting the patterns is a Properties file seems like a good idea, too. How
often do the patterns change? Perhaps you could add a refresh() method to
the singleton class to reload the patterns from the properties file if you
anticipate that they will change while the app is supposed to be running.
This is usually the case, but it is often overlooked when setting such
constants.

-Max

- Original Message -
From: Jerry Jalenak [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, September 30, 2002 7:49 AM
Subject: [OT - Java] How can I do this in Java?


  

OK - off topic, but Sun's java forum sucks, and there are an incredible
number of Java guru's on this list, so I thought I'd throw this out here.
(That and I am using this in a custom validation routine  :-))Any help
would be GREATLY appreciated!

Here's the scenario - I've got a series of static constants that represent
Java regular expressions.  These RE's are used to validate driver license
formats for the 50 states + DC.  The strings look like this:

public static final String AK = ^[0-9]{1,7}$;
public static final String AL = ^[0-9]{7}$;
public static final String AR = ^[0-9]{8,9}$;
public static final String AZ =
^[0-9ABDY][0-9]{8}$|^[A-Z][0-9]{3,6}$|^[A-Z]{2}[0-9]{3,5}$;
public static final String CA = ^[A-Z][0-9]{4,7}$;
public static final String CO =
^[A-Z][0-9]{1,6}$|^[A-Z]{2}[0-9]{1,6}$|^[0-9]{9}$;
etc. etc. etc.

On my form I have a drop-down box of states, and a field for the license
number.  In my custom validator routine, I pick up the value of the state,
and build a string to represent the constant - i.e.

private static boolean validateDriversLicenseNumber(String
licenseState, String licenseNumber)
{
String licenseConstant = Constants. + licenseState;

I then want to use licenseConstant in a Pattern / Match:

Pattern p = Pattern.compile(licenseConstant,
Pattern.CASE_INSENSITIVE);
Match m = p.matcher(licenseNumber);
return (m.find());
}

Obviously the line String licenseConstant = Constants. + licenseState;
does not give me the value of Constant.state name; the question I have


is,
  

is there a method (or something) that will allow me to build such a


string,
  

and return the value (i.e. the regular expression)?  Or is there a better
way of doing this?

TIA!

Jerry Jalenak
Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496
[EMAIL PROTECTED]


This transmission (and any information attached to it) may be confidential


and is intended solely for the use of the individual or entity to which it
is addressed. If you are not the intended recipient or the person
responsible for delivering the transmission to the intended recipient, be
advised that you have received this transmission in error and that any use,
dissemination, forwarding, printing, or copying of this information is
strictly prohibited. If you have received this transmission in error, please
immediately notify LabOne at (800)388-4675.
  


--
To unsubscribe, e-mail:


mailto:[EMAIL PROTECTED]
  

For additional commands, e-mail:


mailto:[EMAIL PROTECTED]
  






--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


  




--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]