Re: Can validation.xml be modularized?

2004-03-18 Thread Matt Bathje
- Original Message - 
From: Chan, Jim [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 18, 2004 12:34 PM
Subject: Can validation.xml be modularized?



 I have modularized my Struts application using different struts-config.xml
 files. Also I am using different resource properties files for
localization
 for each module.  Everything works fine.  Currently, I am hooking up the
 client side validation using the struts validation plugin.  However, the
 only way I can get it working is to register all the form validation in
the
 validation.xml, and access the localized error messages using the default
 resource properties file.

 Does anyone know how to:

 1.  modularize the validation.xml so that I can decompose it the same way
as
 I did for the struts-config files.  I tried using xml includes, but the
 validation plugin complains that it can't find my validation1.xml file.
It
 only works if I use the absolute file path.

 !DOCTYPE project [
   !ENTITY validation1 SYSTEM ./validation1.xml
 ]

 validation1;



For this part - I have wrestled with this alot, and have not been able to
get it to work for validation.xml or tiles-defs.xml. Search back through the
archives for something like entity includes and you will see my problems
with it, and some suggestions for fixing - none of which have worked for me.

I myself am convinced there is a bug in the plugin processor, or in
validation and tiles themselves that make this not possible. It works fine
in struts-config though. When I get free time (yeah right) I plan on getting
to the bottom of this, but I have know idea when it would be.


Matt Bathje


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



Re: Struts logic combined with the struts validator

2004-03-02 Thread Matt Bathje
Alexander -

Usually when I have this situation I just put in an else (or a
logic:notEqual in your case) which prints out the form field as hidden with
some bogus data in it. That bogus data will be enough to make the
validation pass of course.

I had thought about doing the requiredifpresent or something like that, but
this always seemed much simpler.

Matt Bathje

- Original Message - 
From: Alexander Craen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 02, 2004 8:14 AM
Subject: Re: Struts logic combined with the struts validator


 Maybe i`ll better rephrase my question to make it more easy for the reader
 :)

 I want to make a field in a form required when it exists on the form

 if it is not on the form (due to some logic tags that make it disappear),
I
 dont want to generate an error.

 How would I best solve this?

 make a new validator requiredifpresent ?
 or could I use the requiredif together with some logic based on values in
 other beans ?


 - Original Message - 
 From: Alexander Craen [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, March 02, 2004 11:25 AM
 Subject: Struts logic combined with the struts validato


  Hello,
  I am making a registration procedure that works with some logic based on
 the
  choices the customer makes on a previous page
 
  logic:equal name=LogonForm property=customertype scope=session
  value=business
  span class=labellabelbean:message
  key=text.data.label.bill_vat_number//label/span
  html:text property=bill_vat_nr styleId=bill_vat_nr /
  /logic:equal
 
  Problem description :
  When a customer is of customertype 'business' the field bill_vat_nr is
  showed on the page and is required when a customer is not of
customertype
  'business' the field bill_vat_nr is not showed on the page and theirfor
is
  not required
 
  I tried to use a standard struts validator implementation
  field property=bill_vat_nr depends=required
  arg0 key=text.data.label.bill_vat_number/
  arg1 key=${dummy}/
  /field
 
  I first thought about using the requiredif implementation. Problem is
that
 I
  only get it to work with elements from the same form.
 
  The result :
  The bill_vat_nr is required even if it has been left out of the form by
  struts logic
 
  My question :
  Is their a way to combine struts logic and the validator framework? Do I
  have to write a custom validator that does some kind of introspection on
 the
  jsp? Or are their validators that are used for that purpose? What would
be
  the best solution to tackle this problem?
 
  Tnx in advance
  Alexander Craen
 
 
  -
  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]



flushing output from custom taglib

2004-02-19 Thread Matt Bathje
Hey all.

Got another wacky question.

I am writing a custom tag library, and I want it to flush the buffer of html
out to the page as part of the processing. From what I can tell, either
pageContext.getResponse.flushBuffer(); or pageContext.getOut.flush(); should
do this, but I can't get either to. If for example I have in my doEndTag():

ResponseUtils.write(pageContext, test1);
pageContext.getResponse.flushBuffer();
Thread.sleep(5000);
ResponseUtils.write(pageContext, test2);
pageContext.getResponse.flushBuffer();
Thread.sleep(5000);
ResponseUtils.write(pageContext, test3);

I would expect the top portion of the tile/page to be spit out along with
test1, then a 5 second wait, then test2 to be spit out, then the rest of
the page. Instead I get a 10 second (or so) wait, and the whole page spits
out.

using getOut.flush() results in the same behavior.

I am using tiles if it makes any difference...but any idea what I am doing
wrong here?

Matt Bathje


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



global forwards with modules (Again)

2004-02-13 Thread Matt Bathje
Hi all. I asked this a while back and never got an answer, so figured I'd
ask again and see if there were any bites.

I am trying to have the admin area of my project use modules, but so far it
is a no go. I setup the module as:

init-param
  param-nameconfig/admin/param-name
  param-value/WEB-INF/struts-config-admin.xml/param-value
/init-param

and if I type urls under /admin/ into the location bar, they work. If I try
to use any of the global forwards I have defined in struts-config-admin.xml
though, they do not. This becomes a problem rapidly, because (like good
struts users) all of our javascript, style sheets, etc. are setup as global
forwards, and the index.jsp page under the /admin/ directory has
logic:redirect forward=adminLogin/

Any idea why the forwards aren't being followed, and how to correct the
problem?

I have tried changing that to forward=/admin/adminLogin and that didn't
help either. Right now the forwards are setup like the following:

forward name=adminLogin path=/login.do /

I have tried changing it to name=/admin/adminLogin,
path=/admin/login.do, and messing around with the contextRelative
attribute, and nothing seems to help - it always says it can't find the
forward.

Any help would be greatly appreciated.

Thanks again,
Matt Bathje


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



[OT] Sending email from struts

2004-02-11 Thread Matt Bathje
Hi all.

This is kind of off topic as it is not really struts related, but somebody
here would probably have the answer.

We have our application sending emails to users at some points and it is
working fine. The problem is that we have the email message hardcoded into
the Java, which we would like to avoid either by storing the message in
application.properties or our database. This would be easy, except all of
the messages contain user-specific information like their name or phone
number or order id or something like that.

Anybody have any ideas (or links to programs!) that can read in an email,
replace the information it needs to from the db, and send that to the user.

I could obviously write something myself to do it, but wouldn't want to
reinvent the wheel.

Turns out this is hard to search for too - email is not a search term that
makes things easy.

Thanks,
Matt Bathje


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



Re: dynamic parameters

2004-02-10 Thread Matt Bathje
Nathan - I think in a situation like this I would put an if test into the
loop. If there is no data for the student, I would make HIDDEN form fields
for that student, otherwise I would make the text fields. Then in your
action, if the fields are blank, you don't need to worry about updating
them. (Although then you need to think about what happens if a users enters
blanks into the text fields - maybe add another field to each student for
whether the user was allowed to input data or something like that)


Matt Bathje


- Original Message - 
From: Nathan Maves [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Tuesday, February 10, 2004 1:35 PM
Subject: Re: dynamic parameters


 Sorry for an ambiguity that was in my example.

 here are the gory details :)

 I am only using student as an example the real object would only
 complicate matters.

 In an action I am retrieving :

 - a list of all the students objects. This includes their student id.

 - an array of studentsGrade objects.  These objects have a studentId,
 semester1Grade, semester2Grade in them.  Remember that there might be,
 at most, the same amount of studentGrade objects as there are students.
   It is the case where there are less that I am concerned in.

 In the jsp :

   I only what the form to create text fields for the student if there
 was data found.  This may seem strange but there is a good business
 reason for this.

 I need the full list of students to be displayed in the page.  With out
 this everything works great.  The list of students is also ordered.

 Last ditch effort,
 Nathan

 On Feb 10, 2004, at 11:43 AM, Michael McGrady wrote:

  Hi, Nathan:
 
  This is progress, but I cannot tell what Since the index from the
  outside foreach will not work for the indexed properties first and
  last name means.  Please clarify.
 
  So far I can tell only the following: you have a list of students
  identified only by first and last name.  You want to have a form that
  gets some more information, i.e. a third bit of information, from them
  via a text field.
 
  There are various reasons why what you are writing is hard to read.
  Your examples indicate a reality which is unlikely to be true, e.g.
  you have all the students with the same name such a Joe Schmoe.  You
  apparently are using A, B, etc. to stand in for what you call a
  NameId.  If that is true or not is impossible to tell.
 
  Let me try to understand what you want to do.  Do you merely want to
  update student names when you have them stored under student ids?  I
  really cannot tell what you want to do.  Whatever you want to do can
  easily be done, I am sure.  It is really hard to tell what you want
  done.  If you are trying to update names alone, then how are you doing
  this.  Are the students doing it?  Is an administrator doing it?  Is
  the problem that there are too many students for one page?  Is the
  problem that you don't have them indexed by name?  If they are indexed
  by id, and there are a known number, you an create a Map with the
  students and use the id as an indexed property to retrieve the
  students.  But, again, your explanation is not readable for me.  So, I
  don't know what you want to do.  Want to try again?
 
  Michael
 
  Michael
 
  At 07:52 AM 2/10/2004, you wrote:
  First thanks for your time trying to help me.
 
  Here is the deal
 
  I have a list of elements.
 
  NameId
  Student A   123
  Student B 123
  Student C 123
  Student D 123
  Student E 123
  Student F 123
 
  and I only have data (first  last name) for some random amount of
  them.  On these rows I want the form to create text fields for these
  items.
 
  Student A
  Student B   joe schmoe
  Student C
  Student D   joe schmoe
  Student E   joe schmoe
  Student F
 
  Since the index from the outside foreach will not work for the
  indexed properties first and last name I believe that I will have to
  test if the current student row is equal to the next row in the array
  of data.  If they are then I will have to create the html:text  by
  hand.
 
  Nathan Maves
  Sun Microsystems
 
 
 
 
  On Feb 10, 2004, at 1:40 AM, Villalba Arias, Fredy [BILBOMATICA]
  wrote:
 
  Hi,
 
  I don't know about indexes, but I can think of a simple solution,
  Struts-independent (well, not 100%): have all values concatenated in
  a single hidden attribute that get's submitted, using different
  tokens for separating different values and for separating different
  records (by record I mean a set of values). Then it's just about
  parsing it (the value stored on the corresponding property) on the
  server side. I know It's not the most elegant solution, but it you
  are short of time, then it will surely do it.
 
  HTH,
  Freddy.
 
  -Mensaje original-
  De: Nathan Maves [mailto:[EMAIL PROTECTED]
  Enviado el: martes, 10 de febrero de 2004 1:24
  Para: Struts Users Mailing List
  Asunto: dynamic

Re: Orkut

2004-02-09 Thread Matt Bathje
I would also like to be added.

Any way we could take this off the list though? Like have 1 or 2 people that
can be emailed privately about it?

Matt


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



Re: dynamic parameters

2004-02-09 Thread Matt Bathje
What you want are called indexed properties in struts.

Start here: http://jakarta.apache.org/struts/faqs/indexedprops.html
and here:  http://www.developer.com/java/ejb/article.php/2233591

Then search the list archives for any specific questions you have, many have
been answered.

Also, if you are having n number of elements, make sure your form goes into
the session scope instead of the request scope. This is probably the biggest
issue with indexed properties I have seen.

Matt Bathje


- Original Message - 
From: Nathan Maves [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Monday, February 09, 2004 6:24 PM
Subject: dynamic parameters


 I have searched but found nothing on this specific example.

 I have a form that will have n number of elements.  Each of these
 elements will needs it own name.

 example.

 list of students is displayed on the screen with two text fields for
 their first and last name.

 This is for a mass update page.

 The only way I can thing of is to have form element like..

 text name=#student_id#-#first_name#
 text name=#student_id#-#last_name#

 This way in my action I can parse out the student id and then update
 the corresponding first and last name.

 Can this be done or is there a better way to do it.


 -
 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]



Re: 2 unanswered questions

2004-02-02 Thread Matt Bathje
Replying to myself here - but after some searching over the weekend, I found
bug 17667 - which is the same problem I have been having. Stupid me
searching for multiple form all this time instead of multi-form never
found it.

Anyways, I took the patches that had been attached to that bug already, and
updated them for the latest versions of Struts and Commons Validator (mostly
moving all the javascript fixes out of validator-rules.xml and into the
individual .js files in validator) and it is working great. Much cleaner
then the crap I had been brewing up as well.

I put the new patches back up under the bug if anybody else is interested.
(Or if they want to put this in 1.2)

Matt Bathje


- Original Message - 
From: Matt Bathje [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, January 29, 2004 6:00 PM
Subject: Re: 2 unanswered questions


  I'm assuming that you've at least specified distinct values for the
  method attribute for each use of html:javascript?
  http://jakarta.apache.org/struts/userGuide/struts-html.html#javascript
  (Actually, looking at the doc I see that the process when this isn't
  specified should result in unique validate method names.)  I've never
  actually tried to validate multiple forms in a single page.  You may
  have simply discovered a limitation in the design of the validator
  stuff.  If so, feel free to submit an enhancement request in
  Bugzilla, and feel just as free (or more so) to attach patches to
  help solve the problem!

 Yes, specifying the method doesn't help with the problem.

 I started working on a patch - and it doesn't seem like it is going to be
 struts specific. The validator javascript files (as well as the validator
 itself maybe) need to be changed so that this can be done.

 Basically what I have started on doing is:

 1. adding a multipleForm (true|false) property to the html:javascript
tag -
 if it is true it means we want multiple js validators on the same page.
 2. Modifying

org.apache.struts.taglib.html.JavascriptValidatorTag.createDynamicJavascript
 to append the formName to the javascript functions that it outputs in the
 ValidatorAction iteration loop. (If multipleForm = true)
 3. Modifying

org.apache.struts.taglib.html.JavascriptValidatorTag.getJavascriptStaticMeth
 ods to alter the validator javascript if multipleForm = true. The 2 things
I
 am trying to have it do are replace the function definition with a
function
 definition that includes the form name and replace the oRequired (or
 whatever) array definition call with a call that includes the form name
(so
 oRequired = new required(); becomes oRequired = new requiredFormName();)

 1 and 2 are no problems.
 3 on the other hand is a major pain in the butt, and where alterations to
 validator instead of struts come in.

 First, the .js files follow very loose standards for naming. Weird things
 like oRequired for the required validator, but oMasked for the mask
 validator. Weird things like minlength and maxlength both having wacky
 upper/lower case changes all over. This makes doing String.replaceall()
 operations on the .js files extremely tricky. The .js files would need to
be
 changed to make sure they follow a standard that could be parsed properly.

 The second problem is that I don't even think these replace operations
 belong in struts, but in the validator code itself. (Like in
 org.apache.commons.validator.ValidatorAction.loadJavascriptFunction
 possibly) The problem here is I'm not entirely sure how to get the
 html:javascript multipleForm variable into ValidatorAction properly. I am
 also not sure if this is even the best/most elegant solution. If having it
 in the validator code is good, is loadJavascriptFunction the best place
for
 it, or is somewhere else better? Does that code actually belong in struts
or
 validator?

 I can hack some stuff together and use it on our own sites, but I'd really
 like to be able to contribute this stuff back so I want to make it
right.

 Thats all for now, let me know what you all think.

 Thanks,
 Matt Bathje


 -
 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]



Re: Is there an INCLUDE feature that works with struts-config?

2004-02-02 Thread Matt Bathje
I think XML entities would do what he wants.

What you do is, at the top of your struts-config.xml file, you define the
entities you want to include:

?xml version=1.0 encoding=UTF-8?
!DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts
Configuration 1.1//EN
http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd;
[
!ENTITY actionMappings SYSTEM /path/to/actionMappings.xml
!ENTITY formBeans SYSTEM /path/to/formBeans.xml
]

Then, at each place you want to use the entity in your file, you include it
as an entity using entityName; (so for the above example: actionMappings;
and formBeans;)

So to include action mappings in your struts config that you have defined in
another file, you would do:

action-mappings
!-- hard coded action mapping, just for this app --
action parameter=.view.checkoutPage path=/checkoutPage
type=org.apache.struts.actions.ForwardAction/

!-- include common action mappings --
actionMappings;

/action-mappings

In struts-config, the entity paths can be relative to your struts-config.xml
file (usually /WEB-INF/), or hard coded paths to somewhere else on the file
system. If you want to use entities in tiles-defs.xml or validation.xml,
they must be hard coded paths (for now...I'm investigating this in my free
time!!).


Matt Bathje



- Original Message - 
From: Hubert Rabago [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Monday, February 02, 2004 11:23 AM
Subject: Re: Is there an INCLUDE feature that works with struts-config?


 Probably not in the way you're thinking.
 Struts allows you to specify more multiple config files for the same
 app, so you can probably specify the app-specific config and the shared
 config for each app.  However, each of your apps will need to have copies
of
 the same shared XML.
 If you're worried about duplication, you can have the shared config in
 one location and have your build process copy it from there.
 Just an idea.

 - Hubert

 --- Anderson, James H [IT] [EMAIL PROTECTED] wrote:
  We will have many related Struts apps that require identical entries in
  struts-config, so I'm wondering if there's a way to define common sets
of
  entries and then include them in the config file for each of the apps.
 
  Thanks,
 
  jim
 
 

 __
 Do you Yahoo!?
 Yahoo! SiteBuilder - Free web site building tool. Try it!
 http://webhosting.yahoo.com/ps/sb/

 -
 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]



Re: custom javascript validation (solved)

2004-01-30 Thread Matt Bathje
Hi everybody. After working on this for a bit, I figured it out for myself.
The problem was that in the variable definition, I was using
var-jsTyperegexp/var-jsType. This is wrong - the proper way to do it is
var-jstyperegexp/var-jstype.

Hopefully this will help somebody else out at some point.

Matt Bathje


- Original Message - 
From: Matt Bathje [EMAIL PROTECTED]
To: strutslist [EMAIL PROTECTED]
Sent: Wednesday, January 28, 2004 12:44 PM
Subject: custom javascript validation


 Hi all.

 I am doing some custom validations, and the server side of them is working
 well. The problem is that in my custom javascript, I cannot get a variable
I
 have defined as a regular expression to work. The javascript always pulls
 out the backslashes (\) from the regexp. If I put in the regular
expression
 with double backslashes, it works for javascript, but breaks in the java
 end. Plus I would really like to not have to use nonstandard regexps.

 I am using the mask validator as my guide, and it seems the big difference
 is when the validation function is created, in mask the regexp variables
 get created as regular expressions, where as in my validator they get
 created as strings. For example, here is the created mask function:

 function mask () {
   this.a0 = new Array(phone, Phone Number is invalid., new Function
 (varName,

this.mask=/^(^\\([2-9]\\d{2}\\)\\s*\\d{3}-\\d{4}$)|(^[2-9]\\d{2}-\\d{3}-\\d{
 4}$)$/; return this[varName];));
 }

 and here is my function:
 function countryMask () {
   this.a0 = new Array(postalCode, Postal Code is invalid., new
Function
 (varName,

this.CAN='^([ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]\\d[A-Za-z]\\s*\\d[A-Za-z
 ]\\d)$'; this.otherField='countryID';
 this.USA='^(^\\d{5}$)|(^\\d{5}-\\d{4}$)$'; return this[varName];));
 }


 See how in the mask function this.mask is set to a regular expression - no
 quotes around it? But in my function, this.USA and this.CAN are both
created
 as strings with quotes around them (and no regexp demarkers (/))

 Also, notice that at this point this.USA and this.CAN both have the
slashes
 in them as needed. But, in my validation script when I do var pattern =
 oCountryMask[x][2](CAN);, pattern does not contain the slashes.

 What I am looking for is either a way to call oCountryMask[x][2](CAN) and
 have it not strip the slashes, OR (and even better) have the var treated
as
 a regexp like the mask variable is.

 Obviously the mask variable for a mask validation is a special variable
 that gets treated as a regexp - but is there any way to set the
javascript
 type of the variable in my validation?

 I was poking around in the validator javadocs and found
 var-jsTyperegexp/var-jsType looks like it may do something, but it
 unfortunatley does not solve my problem. I'm wondering if maybe it isn't
 implemented yet or something?

 I have really been able to find anybody else mentioning similar problems.
:(

 Any help to get this working would be greatly appreciated!!!

 Thanks,
 Matt Bathje

 ps - anybody have any knowledge about these three questions that were
never
 answered?

http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgId=1327188

http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgId=1328405

http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgId=1328406


 -
 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]



Re: 2 unanswered questions

2004-01-30 Thread Matt Bathje

 regarding entity includes in tiles-defs.xml (again) -- both
 struts-config and tiles-definitions files can be specified using a
 comma-separated list of files (in web.xml for struts-config, and in
 the plugin descriptor in struts-config for tiles) -- isn't that a
 simpler way to solve the same problem of breaking down big config
 files?


The problem with that is, we have some forms (probably 5-6 of them) that
have duplicated properties/validations. It would be nice to be able to do an
entity include to include those duplicated validations in each form they are
required in validation.xml.

If I get some free time I am going to look into this, but as I mentioned in:
http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg92220.html

I really think there is some sort of bug in either the plugin interface or
the tiles and validator plugins specifically that make the root for the
xml documents change to be %SystemRoot% or something like that.


Matt Bathje


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



Re: bug in latest validator-rules.xml ?

2004-01-30 Thread Matt Bathje
Joe - this is working fine for me with the 1/13/2004 nightly build. I have
tried with commons-validator-1.1.1.jar and with whatever version the
commons-validator.jar in the 1/13 nightly build of struts is.

Validation worked right out of the box - all I did to install the nightly
build was copy over the jar, tld and xml files from the zip file.

Based on that it seems like if there is a bug, it is in struts and probably
in the newer nightly builds. (Doesn't seem like it would be in
validator-rules.xml itself though, that hasn't been updated since december)

Matt Bathje


- Original Message - 
From: Joe Germuska [EMAIL PROTECTED]
To: Struts Users List [EMAIL PROTECTED]
Sent: Friday, January 30, 2004 10:54 AM
Subject: bug in latest validator-rules.xml ?


 Between versions 1.47 and 1.48 of conf/share/validator-rules.xml, the
 javascript block for validateRequired was removed.  Now when I drop
 that file into my webapp, my form which only has required validations
 comes up with this as the entirety of its JavaScript block:

 script type=text/javascript language=Javascript1.1

 !-- Begin

   var bCancel = false;

  function validateForm(form) {
  if (bCancel)
return true;
  else
 return true;
 }

 //End --
 /script

 When I use 1.47, I get the normal behavior.  This form only has
 required validations, so I'm assuming it's related to the removal of
 the javascript for validateRequired, which is the change between
 these versions.

 Is there something I'm supposed to know to switch to the latest
 version of validator-rules?   I'm using commons-validator-1.1.1.jar
 and the Struts nightlies from sometime in the last week.  Do I need a
 newer commons-validator?

 I'll file a bug if it's a bug, but I thought I'd ask if there was
 some documentation that I'd missed before doing that.

 Joe


 -- 
 Joe Germuska
 [EMAIL PROTECTED]
 http://blog.germuska.com
Imagine if every Thursday your shoes exploded if you tied them
 the usual way.  This happens to us all the time with computers, and
 nobody thinks of complaining.
  -- Jef Raskin

 -
 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]



Re: Validator Framework - problem using Mask

2004-01-30 Thread Matt Bathje
Pani - it looks like you may be missing jakarta-oro.jar from your
WEB-INF/lib directory. (Or have an older version of it possibly).

Make sure it exists, and if not get it from either your struts
distribution's lib directory or from the apache website and put it into
WEB-INF/lib.

If it does exist, download the version from the apache website and put it
into WEB-INF/lib and see if that fixes the problem.


Matt Bathje


- Original Message - 
From: Pani R [EMAIL PROTECTED]
To: Struts Users List [EMAIL PROTECTED]
Sent: Friday, January 30, 2004 11:49 AM
Subject: Validator Framework - problem using Mask


 Hi:

 I get the following exception while validating the mask part of a field.

 Exception:

 [ERROR] Validator - -reflection: null
java.lang.reflect.InvocationTargetExceptionjava.lang.reflect.InvocationTar
getException: java.lang.NoClassDefFoundError:
org/apache/oro/text/perl/Perl5Util
 at
org.apache.commons.validator.GenericValidator.matchRegexp(GenericValidator.j
ava:107)
 at
org.apache.struts.validator.FieldChecks.validateMask(FieldChecks.java:271)


 Extract from my validation.xml:

 field property=firstName
depends=required,mask,minlength
 msg name=mask key=errors.onlyalpha/
 arg0 key=ex.register.info.fName/
 arg1 name=minlength key=${var:minlength} resource=false/
 var
 var-namemask/var-name
 var-value^[a-zA-Z]*$/var-value
 /var
 var
 var-nameminlength/var-name
 var-value2/var-value
 /var
 /field

 I dont know if this has got to do with the any path settings or versions
'am using with. Anyways, 'am using WSAD5.1, WAS 4.0 TestEnv, J2EE 1.2 with
Struts 1.1 support, JDK 1.3.1.

 I appreciate any response.

 Thanks,
 Pani



 
 Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
 http://login.mail.lycos.com/r/referral?aid=27005

 -
 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]



Re: entity includes in tiles-defs.xml (again)

2004-01-29 Thread Matt Bathje
Looking at the xml spec (1.0, second edition, section 4.2.2) it appears as
though entities should be processed as relative to the resource within which
they appear.

The spec does allow for special circumstances that change the default
relativity - but why would tiles and validator need to do this? And why
would they change it to be %SystemRoot% (on my system, they appear to both
be relative to c:\windows\system)

Looking through the tiles parser code and the struts-config.xml parser code,
I can see no difference - nothing that sets the entity root to be
different, and there is nothing in the dtd from what I can tell.

I can run the xml file with the relative path through a validating parser
and it validates perfectly, reading the included entity as it should.

I am left with 2 decisions on this then. Either there is some sort of
(weird) requirement in tiles and validator (maybe all plugins that use
config files?) that the default relative path for entities needs to change
to %Systemroot% and that requirement DOESN'T exists for the struts-config
files. Else, there is some sort of bug in both of their parsers which
changes the relative path. I can't seem to find it though otherwise I would
fix it myself.

Let me know what you all think.

Thanks,
Matt Bathje

- Original Message - 
From: Hubert Rabago [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, January 28, 2004 5:31 PM
Subject: Re: entity includes in tiles-defs.xml (again)


 Hi Matt,

 I ran into the same problem (with the same error message) when I tried
 using my own DTDs for XML files that Digester was processing.  I found
 that the solution is to put my DTD in the apps' class path, and then
 register my dtd with the Digester instance which parses my config file.

 I'm not sure if the solution that worked for me would work for you.
 I don't know if there's a way you can register a resource in such a
 way that allows it to be recognized by the digester instance that
 the tiles plugin uses.  If there is, then that would solve your problem.
 If not, it seems like you'd have to implementing your own tiles xml
 digester, register the dtd with that instance, and parse your XML.
 Looking at the tiles plugin source code, the class which does
 the actual parsing is buried deep.  Look at
 org.apache.struts.tiles.xmlDefinition.XmlParser.
 I didn't dig deep enough to see if you can configure its factory so
 that your customized parse could be called instead.

 Maybe one of the Tiles developers can help.

 - Hubert

 --- Matt Bathje [EMAIL PROTECTED] wrote:
  James -
 
  I'm 99.999% sure that spelling is not the issue. To test this out, I am
just
  cutting the path out and leaving the filename. Since it works with the
path,
  I am deducing that the filename is correct.
 
  What other information can I give you to help? Unfortunatley I can't
give
  you my entire application - but I was able to duplicate it in
struts-example
  using validation.xml.
 
  I created a file in WEB-INF called testValidationInclude.xml and
cut/paste
  the registrationForm validator into it out of validation.xml. Then in
  validation.xml I created an entity using the following syntax:
 
  !DOCTYPE form-validation PUBLIC
  -//Apache Software Foundation//DTD Commons Validator Rules
  Configuration 1.0//EN
  http://jakarta.apache.org/commons/dtds/validator_1_0.dtd;
  [
  !ENTITY testinclude SYSTEM
 
C:\apache_group\tomcat\Tomcat_4_1_24\webapps\struts-example\WEB-INF\testVal
  idationInclude.xml
  ]
 
 
  and where the registrationForm was, I put testinclude;
 
  This works without a problem
 
  When I change the entity definition to:
 
  !DOCTYPE form-validation PUBLIC
  -//Apache Software Foundation//DTD Commons Validator Rules
  Configuration 1.0//EN
  http://jakarta.apache.org/commons/dtds/validator_1_0.dtd;
  [
  !ENTITY testinclude SYSTEM testValidationInclude.xml
  ]
 
  I get an error:
 
  Jan 28, 2004 4:35:17 PM org.apache.struts.validator.ValidatorPlugIn
  initResources
  INFO: Loading validation rules file from '/WEB-INF/validation.xml'
  Jan 28, 2004 4:35:17 PM org.apache.struts.validator.ValidatorPlugIn
  initResources
  SEVERE: C:\WINDOWS\system32\testValidationInclude.xml (The system cannot
  find the file specified)
  java.io.FileNotFoundException:
C:\WINDOWS\system32\testValidationInclude.xml
  (The system cannot find the file specified)
   at java.io.FileInputStream.open(Native Method)
 
 
  There are a bunch more lines, I can get them for you if you want.
 
  Let me know what else may be helpful to you.
 
  Thanks,
  Matt Bathje
 
 
 
  - Original Message - 
  From: James Mitchell [EMAIL PROTECTED]
  To: Struts Users Mailing List [EMAIL PROTECTED]
  Sent: Wednesday, January 28, 2004 4:20 PM
  Subject: Re: entity includes in tiles-defs.xml (again)
 
 
   Sorry, I thought you *wanted* to specify it directly.
  
   From what you've said below, that's an odd problem and my first
  inclination
   would be to check

2 unanswered questions

2004-01-29 Thread Matt Bathje
Hi all.

I have a few questions I've posted to the list recently that have not been
answered. 2 of them are somewhat important, and I was wondering if anybody
had any insights. I will simplify the questions in this message and include
a link to the full description.

First - how can I have multiple forms on the same page all use javascript
validation? The javascript that struts prints out for each form conflicts
with each other, and causes only the last form's validations to work.
Originally asked here:
http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg92019.html

Second - I am working on a custom validator. The server side of the
validation works great, but the javascript side has some issues with
variables that contain regular expressions. It is stripping out the \
characters from the regexp so that it doesn't work. How can I access
variables as regular expressions in a custom validator?
Originally asked here:
http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg92124.html

And as long as I am doing this, there are 2 other questions with no answers
yet, but they aren't quite as important to me as the above questions:
http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg92020.html
http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg91959.html
(there is a thread about this, but no solution yet)

Thanks again,
Matt


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



Re: 2 unanswered questions

2004-01-29 Thread Matt Bathje
 I'm assuming that you've at least specified distinct values for the
 method attribute for each use of html:javascript?
 http://jakarta.apache.org/struts/userGuide/struts-html.html#javascript
 (Actually, looking at the doc I see that the process when this isn't
 specified should result in unique validate method names.)  I've never
 actually tried to validate multiple forms in a single page.  You may
 have simply discovered a limitation in the design of the validator
 stuff.  If so, feel free to submit an enhancement request in
 Bugzilla, and feel just as free (or more so) to attach patches to
 help solve the problem!

Yes, specifying the method doesn't help with the problem.

I started working on a patch - and it doesn't seem like it is going to be
struts specific. The validator javascript files (as well as the validator
itself maybe) need to be changed so that this can be done.

Basically what I have started on doing is:

1. adding a multipleForm (true|false) property to the html:javascript tag -
if it is true it means we want multiple js validators on the same page.
2. Modifying
org.apache.struts.taglib.html.JavascriptValidatorTag.createDynamicJavascript
to append the formName to the javascript functions that it outputs in the
ValidatorAction iteration loop. (If multipleForm = true)
3. Modifying
org.apache.struts.taglib.html.JavascriptValidatorTag.getJavascriptStaticMeth
ods to alter the validator javascript if multipleForm = true. The 2 things I
am trying to have it do are replace the function definition with a function
definition that includes the form name and replace the oRequired (or
whatever) array definition call with a call that includes the form name (so
oRequired = new required(); becomes oRequired = new requiredFormName();)

1 and 2 are no problems.
3 on the other hand is a major pain in the butt, and where alterations to
validator instead of struts come in.

First, the .js files follow very loose standards for naming. Weird things
like oRequired for the required validator, but oMasked for the mask
validator. Weird things like minlength and maxlength both having wacky
upper/lower case changes all over. This makes doing String.replaceall()
operations on the .js files extremely tricky. The .js files would need to be
changed to make sure they follow a standard that could be parsed properly.

The second problem is that I don't even think these replace operations
belong in struts, but in the validator code itself. (Like in
org.apache.commons.validator.ValidatorAction.loadJavascriptFunction
possibly) The problem here is I'm not entirely sure how to get the
html:javascript multipleForm variable into ValidatorAction properly. I am
also not sure if this is even the best/most elegant solution. If having it
in the validator code is good, is loadJavascriptFunction the best place for
it, or is somewhere else better? Does that code actually belong in struts or
validator?

I can hack some stuff together and use it on our own sites, but I'd really
like to be able to contribute this stuff back so I want to make it right.

Thats all for now, let me know what you all think.

Thanks,
Matt Bathje


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



custom javascript validation

2004-01-28 Thread Matt Bathje
Hi all.

I am doing some custom validations, and the server side of them is working
well. The problem is that in my custom javascript, I cannot get a variable I
have defined as a regular expression to work. The javascript always pulls
out the backslashes (\) from the regexp. If I put in the regular expression
with double backslashes, it works for javascript, but breaks in the java
end. Plus I would really like to not have to use nonstandard regexps.

I am using the mask validator as my guide, and it seems the big difference
is when the validation function is created, in mask the regexp variables
get created as regular expressions, where as in my validator they get
created as strings. For example, here is the created mask function:

function mask () {
  this.a0 = new Array(phone, Phone Number is invalid., new Function
(varName,
this.mask=/^(^\\([2-9]\\d{2}\\)\\s*\\d{3}-\\d{4}$)|(^[2-9]\\d{2}-\\d{3}-\\d{
4}$)$/; return this[varName];));
}

and here is my function:
function countryMask () {
  this.a0 = new Array(postalCode, Postal Code is invalid., new Function
(varName,
this.CAN='^([ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]\\d[A-Za-z]\\s*\\d[A-Za-z
]\\d)$'; this.otherField='countryID';
this.USA='^(^\\d{5}$)|(^\\d{5}-\\d{4}$)$'; return this[varName];));
}


See how in the mask function this.mask is set to a regular expression - no
quotes around it? But in my function, this.USA and this.CAN are both created
as strings with quotes around them (and no regexp demarkers (/))

Also, notice that at this point this.USA and this.CAN both have the slashes
in them as needed. But, in my validation script when I do var pattern =
oCountryMask[x][2](CAN);, pattern does not contain the slashes.

What I am looking for is either a way to call oCountryMask[x][2](CAN) and
have it not strip the slashes, OR (and even better) have the var treated as
a regexp like the mask variable is.

Obviously the mask variable for a mask validation is a special variable
that gets treated as a regexp - but is there any way to set the javascript
type of the variable in my validation?

I was poking around in the validator javadocs and found
var-jsTyperegexp/var-jsType looks like it may do something, but it
unfortunatley does not solve my problem. I'm wondering if maybe it isn't
implemented yet or something?

I have really been able to find anybody else mentioning similar problems. :(

Any help to get this working would be greatly appreciated!!!

Thanks,
Matt Bathje

ps - anybody have any knowledge about these three questions that were never
answered?
http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgId=1327188
http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgId=1328405
http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]msgId=1328406


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



Re: entity includes in tiles-defs.xml (again)

2004-01-28 Thread Matt Bathje
Hi James, thanks for the answer. Unfortunatley it somehow wound up in my
spam box...

This doesn't really solve the problem. I don't care about having to put the
c:\ in the entity - what I care about is having to put
/Inetpub_Tomcat/rsg_java/struts/pub in there. The application I am working
on will have multiple instantations, and the installation path will change
with each one.

What I am looking for is a solution that allows me to put in just the file
name (as you can do in struts-config files) or a path relative to WEB-INF.


Thanks,
Matt Bathje



- Original Message - 
 Date: Mon, 26 Jan 2004 13:17:25 -0500
 From: James Mitchell [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
  Subject: Re: entity includes in tiles-defs.xml (again)
   To: Struts Users Mailing List [EMAIL PROTECTED]

 Try changing this:
  Here is what DOES work in tiles-defs:
  !ENTITY kurt-tiledefs SYSTEM
 
C:\Inetpub_Tomcat\rsg_java\struts\pub\WEB-INF\kurt-admin-tilesdefs.xml
 

 to this
 !ENTITY kurt-tiledefs SYSTEM
 /Inetpub_Tomcat/rsg_java/struts/pub/WEB-INF/kurt-admin-tilesdefs.xml


 normally, / will be interpreted as C:\ or to be more
 specificyour system's %SystemDrive%



 --
 James Mitchell
 Software Engineer / Struts Evangelist
 http://www.struts-atlanta.org
 678.910.8017 (cell)
 AIM: jmitchtx
 MSN: [EMAIL PROTECTED]



 - Original Message -
 From: Matt Bathje [EMAIL PROTECTED]
 To: strutslist [EMAIL PROTECTED]
 Sent: Monday, January 26, 2004 12:04 PM
 Subject: entity includes in tiles-defs.xml (again)


  Hi, I asked this question a month or 2 ago, and never got a response, so
  thought I'd try again -
 
  Using XML entities, I was able to get my struts-config file broken up
into
  multiple files.
 
  I am attempting the same thing on my tile-defs.xml file, and when I do
it,
 I
  get the following error:
 
  12/16/03 10:56:55 AMERROR org.apache.struts.tiles.TilesPlugin init -
Can't
  create Tiles definition factory for module ''.
  ServletInitError: javax.servlet.ServletException: IO Error while parsing
  file '/WEB-INF/tiles-defs-admin.xml'.
  C:\WINDOWS\system32\kurt-admin-tilesdefs.xml (The system cannot find the
  file specified)
 
 
  So, just to be stupid, I put the full path to the file in the XML
enitity
  declaration, and that makes it work - but I don't want to have to hard
 code
  that path in.
 
 
  Here is what works in struts-config:
  !ENTITY kurt-actionmappings SYSTEM kurt-admin-actionmappings.xml
 
  Here is what DOESN'T work in tiles-defs:
  !ENTITY kurt-tiledefs SYSTEM kurt-admin-tilesdefs.xml
 
  Here is what DOES work in tiles-defs:
  !ENTITY kurt-tiledefs SYSTEM
 
C:\Inetpub_Tomcat\rsg_java\struts\pub\WEB-INF\kurt-admin-tilesdefs.xml
 
  I have also tried doing ./kurt-admin-tilesdefs.xml and
  /kurt-admin-tilesdefs.xml but they just give me the same error.
 
  Any ideas about what is going on or how to fix it?
 
 
  Thanks,
  Matt Bathje
 
 
  -
  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]


 - End forwarded message -




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



Re: entity includes in tiles-defs.xml (again)

2004-01-28 Thread Matt Bathje
James -

I'm 99.999% sure that spelling is not the issue. To test this out, I am just
cutting the path out and leaving the filename. Since it works with the path,
I am deducing that the filename is correct.

What other information can I give you to help? Unfortunatley I can't give
you my entire application - but I was able to duplicate it in struts-example
using validation.xml.

I created a file in WEB-INF called testValidationInclude.xml and cut/paste
the registrationForm validator into it out of validation.xml. Then in
validation.xml I created an entity using the following syntax:

!DOCTYPE form-validation PUBLIC
-//Apache Software Foundation//DTD Commons Validator Rules
Configuration 1.0//EN
http://jakarta.apache.org/commons/dtds/validator_1_0.dtd;
[
!ENTITY testinclude SYSTEM
C:\apache_group\tomcat\Tomcat_4_1_24\webapps\struts-example\WEB-INF\testVal
idationInclude.xml
]


and where the registrationForm was, I put testinclude;

This works without a problem

When I change the entity definition to:

!DOCTYPE form-validation PUBLIC
-//Apache Software Foundation//DTD Commons Validator Rules
Configuration 1.0//EN
http://jakarta.apache.org/commons/dtds/validator_1_0.dtd;
[
!ENTITY testinclude SYSTEM testValidationInclude.xml
]

I get an error:

Jan 28, 2004 4:35:17 PM org.apache.struts.validator.ValidatorPlugIn
initResources
INFO: Loading validation rules file from '/WEB-INF/validation.xml'
Jan 28, 2004 4:35:17 PM org.apache.struts.validator.ValidatorPlugIn
initResources
SEVERE: C:\WINDOWS\system32\testValidationInclude.xml (The system cannot
find the file specified)
java.io.FileNotFoundException: C:\WINDOWS\system32\testValidationInclude.xml
(The system cannot find the file specified)
 at java.io.FileInputStream.open(Native Method)


There are a bunch more lines, I can get them for you if you want.

Let me know what else may be helpful to you.

Thanks,
Matt Bathje



- Original Message - 
From: James Mitchell [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, January 28, 2004 4:20 PM
Subject: Re: entity includes in tiles-defs.xml (again)


 Sorry, I thought you *wanted* to specify it directly.

 From what you've said below, that's an odd problem and my first
inclination
 would be to check and recheck the spelling.  Other than that, I'm not sure
 without having more information or having the project right here in front
of
 me.



 --
 James Mitchell
 Software Engineer / Struts Evangelist
 http://www.struts-atlanta.org
 678.910.8017 (cell)
 AIM: jmitchtx
 MSN: [EMAIL PROTECTED]



 - Original Message -
 From: Matt Bathje [EMAIL PROTECTED]
 To: strutslist [EMAIL PROTECTED]
 Sent: Wednesday, January 28, 2004 2:52 PM
 Subject: Re: entity includes in tiles-defs.xml (again)


  Hi James, thanks for the answer. Unfortunatley it somehow wound up in my
  spam box...
 
  This doesn't really solve the problem. I don't care about having to put
 the
  c:\ in the entity - what I care about is having to put
  /Inetpub_Tomcat/rsg_java/struts/pub in there. The application I am
working
  on will have multiple instantations, and the installation path will
change
  with each one.
 
  What I am looking for is a solution that allows me to put in just the
file
  name (as you can do in struts-config files) or a path relative to
WEB-INF.
 
 
  Thanks,
  Matt Bathje
 
 
 
  - Original Message -
   Date: Mon, 26 Jan 2004 13:17:25 -0500
   From: James Mitchell [EMAIL PROTECTED]
   Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Re: entity includes in tiles-defs.xml (again)
 To: Struts Users Mailing List [EMAIL PROTECTED]
  
   Try changing this:
Here is what DOES work in tiles-defs:
!ENTITY kurt-tiledefs SYSTEM
   
 
C:\Inetpub_Tomcat\rsg_java\struts\pub\WEB-INF\kurt-admin-tilesdefs.xml
   
  
   to this
   !ENTITY kurt-tiledefs SYSTEM
  
/Inetpub_Tomcat/rsg_java/struts/pub/WEB-INF/kurt-admin-tilesdefs.xml
  
  
   normally, / will be interpreted as C:\ or to be more
   specificyour system's %SystemDrive%
  
  
  
   --
   James Mitchell
   Software Engineer / Struts Evangelist
   http://www.struts-atlanta.org
   678.910.8017 (cell)
   AIM: jmitchtx
   MSN: [EMAIL PROTECTED]
  
  
  
   - Original Message -
   From: Matt Bathje [EMAIL PROTECTED]
   To: strutslist [EMAIL PROTECTED]
   Sent: Monday, January 26, 2004 12:04 PM
   Subject: entity includes in tiles-defs.xml (again)
  
  
Hi, I asked this question a month or 2 ago, and never got a
response,
 so
thought I'd try again -
   
Using XML entities, I was able to get my struts-config file broken
up
  into
multiple files.
   
I am attempting the same thing on my tile-defs.xml file, and when I
do
  it,
   I
get the following error:
   
12/16/03 10:56:55 AMERROR org.apache.struts.tiles.TilesPlugin init -
  Can't
create Tiles definition factory for module ''.
ServletInitError: javax.servlet.ServletException: IO Error while

multiple validations on one page

2004-01-27 Thread Matt Bathje
Hi all.

Still no answer to my other question regarding entities in tiles-defs.xml
but now I have another question.


I have 2 forms on the same page. I want javascript validations to work for
both forms, but it's not happening. It looks like the first form is using
the required() function from the second form instead of its own. The second
form's javascript validation works just fine though.

Anybody know of a way around this?


Thanks,
Matt Bathje



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



global forwards in modules

2004-01-27 Thread Matt Bathje
Hi again - yet another question from me, sorry.

I am trying to have the admin area of my project use modules, but so far it
is a no go. I setup the module as:

init-param
  param-nameconfig/admin/param-name
  param-value/WEB-INF/struts-config-admin.xml/param-value
/init-param

and if I type urls under /admin/ into the location bar, they work. If I try
to use any of the global forwards I have defined in struts-config-admin.xml
though, they do not. This becomes a problem rapidly, because (like good
struts users) all of our javascript, style sheets, etc. are setup as global
forwards, and the index.jsp page under the /admin/ directory has
logic:redirect forward=adminLogin/

Any idea why the forwards aren't being followed, and how to correct the
problem?

I have tried changing that to forward=/admin/adminLogin and that didn't
help either. Right now the forwards are setup like the following:

forward name=adminLogin path=/login.do /

I have tried changing it to name=/admin/adminLogin,
path=/admin/login.do, and messing around with the contextRelative
attribute, and nothing seems to help - it always says it can't find the
forward.

Any help would be greatly appreciated.

Thanks again,
Matt Bathje


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



entity includes in tiles-defs.xml (again)

2004-01-26 Thread Matt Bathje
Hi, I asked this question a month or 2 ago, and never got a response, so
thought I'd try again -

Using XML entities, I was able to get my struts-config file broken up into
multiple files.

I am attempting the same thing on my tile-defs.xml file, and when I do it, I
get the following error:

12/16/03 10:56:55 AMERROR org.apache.struts.tiles.TilesPlugin init - Can't
create Tiles definition factory for module ''.
ServletInitError: javax.servlet.ServletException: IO Error while parsing
file '/WEB-INF/tiles-defs-admin.xml'.
C:\WINDOWS\system32\kurt-admin-tilesdefs.xml (The system cannot find the
file specified)


So, just to be stupid, I put the full path to the file in the XML enitity
declaration, and that makes it work - but I don't want to have to hard code
that path in.


Here is what works in struts-config:
!ENTITY kurt-actionmappings SYSTEM kurt-admin-actionmappings.xml

Here is what DOESN'T work in tiles-defs:
!ENTITY kurt-tiledefs SYSTEM kurt-admin-tilesdefs.xml

Here is what DOES work in tiles-defs:
!ENTITY kurt-tiledefs SYSTEM
C:\Inetpub_Tomcat\rsg_java\struts\pub\WEB-INF\kurt-admin-tilesdefs.xml

I have also tried doing ./kurt-admin-tilesdefs.xml and
/kurt-admin-tilesdefs.xml but they just give me the same error.

Any ideas about what is going on or how to fix it?


Thanks,
Matt Bathje


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



Re: [OT] Debugging w/Eclipse Tomcat Sysdeo Plugin? Help!

2003-12-19 Thread Matt Bathje
David - there are 2 options for this that I can think of:

1. In your project settings in eclipse, in the java compiler category, go to
the build path tab and uncheck the clean output folders on full build
setting

2. Put your configuration/other files into the /src directory. When eclipse
builds, it will copy the files over to the classes directory. (note: if this
doesn't work there may be a setting that turns it on, but I couldn't find
one, and don't remember ever setting it...)


I prefer situation 2 myself.

Matt Bathje


- Original Message - 
From: David Erickson [EMAIL PROTECTED]
To: Struts Mailing List [EMAIL PROTECTED]
Sent: Friday, December 19, 2003 1:42 PM
Subject: [OT] Debugging w/Eclipse Tomcat Sysdeo Plugin? Help!


 So we are migrating our app from debugging with System.out.. (dont laugh..
 even though I do).. to debugging it with Sysdeo's Eclipse plugin.  However
 we have run into a showstopping snag unless we can get it resolved.
Eclipse
 is set to compile everything from /web/WEB-INF/src into
/web/WEB-INF/classes
 as it should so tomcat can run correctly and see the files.  However we
have
 configuration and other files also in /web/WEB-INF/classes.. and when
 eclipse rebuilds the project it 'cleans' that directory by deleting
 everything then compiling the source back into there.  Can this be
stopped?
 Or what is everyone else doing regarding this?  I'm sure I can't be the
only
 one with this problem.

 Thanks,
 David


 -
 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]



entity includes in tile-defs.xml

2003-12-16 Thread Matt Bathje
Hi all. Using XML entities, with this as a guide:

http://www.mail-archive.com/[EMAIL PROTECTED]/msg13197.html

I was able to get my struts-config file broken up into multiple files.

I am attempting the same thing on my tile-defs.xml file, and when I do it, I
get the following error:

12/16/03 10:56:55 AMERROR org.apache.struts.tiles.TilesPlugin init - Can't
create Tiles definition factory for module ''.
ServletInitError: javax.servlet.ServletException: IO Error while parsing
file '/WEB-INF/tiles-defs-admin.xml'.
C:\WINDOWS\system32\kurt-admin-tilesdefs.xml (The system cannot find the
file specified)


So, just to be stupid, I put the full path to the file in the XML enitity
declaration, and that makes it work - but I don't want to have to hard code
that path in.


Here is what works in struts-config:
!ENTITY kurt-actionmappings SYSTEM kurt-admin-actionmappings.xml

Here is what DOESN'T work in tiles-defs:
!ENTITY kurt-tiledefs SYSTEM kurt-admin-tilesdefs.xml

Here is what DOES work in tiles-defs:
!ENTITY kurt-tiledefs SYSTEM
C:\Inetpub_Tomcat\rsg_java\struts\pub\WEB-INF\kurt-admin-tilesdefs.xml


Any ideas what is going on? Is this something wrong with my XML? A bug in
Struts? Or in the XML parser?

I haven't found anything mentioning this, and the apache bug db appears to
be down right now so I can't check it.


Thanks,
Matt Bathje


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



Re: dynamically sized form (mostly solved)

2003-12-11 Thread Matt Bathje
Hi All.

Sorry I am jumping in a bit late on this since I am the one who
probably caused a lot of the confusion.

I am the one who originally said I had this working with the form 
under the request scope - I was wrong. The form needs to be 
under the session scope for this to work or you will get the
beanutils.populate errors. 

Matt Bathje


- Original Message - 
From: Andy Schmidgall [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, December 10, 2003 4:01 PM
Subject: RE: dynamically sized form (mostly solved)


 Does this mean it's impossible to do through request scope? I am
 attempting to do this, and it would be nice to know if my work is in
 vain :)
 
 -Andy
 
 -Original Message-
 From: Yee, Richard K,,DMDCWEST [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, December 10, 2003 3:20 PM
 To: 'Struts Users Mailing List'
 Subject: RE: dynamically sized form (mostly solved)
 
 
 I thought it worked, but it didn't.
 
 -Richard
 
 -Original Message-
 From: Nifty Music [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, December 10, 2003 1:02 PM
 To: [EMAIL PROTECTED]
 Subject: RE: dynamically sized form (mostly solved)
 
 
 Nicholas, 
 
 What you said definitely makes sense to me.  Richard graciously replied
 off-list with a similar response.  I remember reading documentation
 which stated that when using dynamic arrays with DynaForms, it is
 necessary to place the DynaForm in session scope.  However, I 'm almost
 positive that someone (Matt? Mark?) mentioned on this list that they
 were able to pass an ArrayList through a DynaForm in request scope.  For
 a variety of reasons, I'm not too eager to put the entire formbean in
 the session for the sake of propogating one ArrayList attribute.  If
 Matt or Mark or anyone else has some insights to share regarding how
 they were able to get this to work in request scope, I'd be very
 grateful to hear.  
 
 Thanks again,
 
 Brent
 
 
 -
 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]



Re: dynamically sized form (mostly solved)

2003-11-21 Thread Matt Bathje
Might I say - woohoo!!

Thanks to your guys help, I got this working. I just want to make
sure that I'm doing this the best way.

In my struts-config file, the preloader has to have the form named
in addition to having it on the action. The form is setup to be in
the request scope, not in the session scope.

In my preloader action, instead of doing

DynaActionForm taxRatesForm = new DynaActionForm();

I do:

DynaActionForm taxRatesForm = (DynaActionForm) form;

then I just do:
taxRatesForm.set(taxRates, allTaxRates);
request.setAttribute(taxRates, allTaxRates);

In the submit action, I just have to do:
DynaActionForm taxRatesForm = (DynaActionForm) form;
TaxRateBean[] taxRates = 
(TaxRateBean[]) taxRateForm.get(taxRates);

Everything seems to work pretty slickly. My main question is 
if having to have the name=formName in the preloader
action is correct? It would be nice to know if I am doing
anything else the incorrect way though also. If I didn't
explain anything very well and you want to see code
snippets, just let me know.

Thanks,
Matt

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



Re: dynamically sized form (mostly solved)

2003-11-21 Thread Matt Bathje
  DynaActionForm taxRatesForm = new DynaActionForm();
  and
  taxRatesForm.set(taxRates, allTaxRates); 
  request.setAttribute(taxRates,
  allTaxRates);
 
 Creating a form in the action servlet is one sure way to piss the folks 
 off who have to maintain the app. You might think its big n clever, but 
 you'd be hiding the form away in a class, what do the htmlists do?

Well this does not work for me anyway. When I change the code to
do what Richard suggests, I get null pointer exceptions.

So is what you are saying Mark is that the way I am doing this (have
the form name specified on the preloader action, and do
DynaActionForm taxRateForm = (DynaActionForm) form;
in the preloader action class) is correct?


 form-property name=taxRate type=java.util.ArrayList /
 
 Using arraylist means you dont have to use the lazy list initialization 
 that i think that using an array will require. See bean utils for 
 details. I could be full of shit but I have this working with arrayList 
 and no joy with using arrays of beans.
 

It is working fine for me with an array of beans. I'm not entirely sure
what you mean by lazy list initalization, or how it could be a problem
here. (I couldn't find a reference in the BeanUtils api, and googling
for it didn't return much other than standard java lazy instantiation
which from my Java knowledge isn't a problem...)

  I think you have the choice of putting the form in either session or 
  request
  scope. Request scope is generally preferable b/c the memory gets 
  released
  sooner.
 
 Yeah right .. Nullpointerexception tastic. Last I looked scoping to 
 request wont work , so don't bother.

My form is in the request scope and working fine. I agree with Richard
in preferring request scope, but if there is a valid reason for it to be
in session instead I'd move it there.


Matt Bathje


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



Re: dynamically sized form (mostly solved)

2003-11-21 Thread Matt Bathje
 I found out that using new DynaActionForm()inside of the
 PreLoaderAction.execute() doesn't work. It gives a null pointer exception
 when you try and call the set() method.

 You need to do this instead:

 FormBeanConfig cfg = mapping.getModuleConfig()
.findFormBeanConfig(dynaIndexTestForm);
 DynaActionForm myForm;


Richard - this was the last piece of the puzzle for me, now it works without
having to supply the name=form on the preloader action...sweet.

Mark - I have had it working both ways now, in session and request. If you
want to do it in request you have to have 2 request objects in your preload.
The first is the form itself, and the second is the property for the form
(which
is what you actually loop through in your jsp)

I will probably use the request scope myself just because I try to stay out
of session as much as possible.


Thanks,
Matt Bathje


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



Re: dynamically sized form (mostly solved)

2003-11-21 Thread Matt Bathje
Cool, thanks for the extra tip!

Matt Bathje


- Original Message - 
From: Yee, Richard K,,DMDCWEST [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Friday, November 21, 2003 4:22 PM
Subject: RE: dynamically sized form (mostly solved)


 Matt,
 You actually only need the form in the request. You don't need the
property
 of the form at all in your JSP.

 In my JSP I use

 html:form action=/indexTestSubmitAction
 logic:iterate id=testBean name=dynaIndexTestForm property=tests
 indexId=ctr 
 html:text name=testBean property=id /br
 html:text name=testBean property=amount /br
 html:text name=testBean property=name/
 /logic:iterate
 html:submit value=Update/
 /html:form


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



dynamically sized form

2003-11-20 Thread Matt Bathje
Hi all.

I am trying to have a dynamically sized forming using indexed properties. I
am using the following article:
http://www.developer.com/java/ejb/article.php/2233591
as a guide, and have almost got it. The form appears to get properly
generated, and each element is listed as taxRates[3].ID, etc. I am putting
the form bean into the session scope (I think) as the article states, but
when I submit, I get an error: javax.servlet.ServletException:
BeanUtils.populate, root cause: java.lang.ArrayIndexOutOfBoundsException at
java.lang.reflect.Array.get(Native Method)(a full stack trace is at the
bottom of the message).

As far as I can tell, this happens before any code in my action is being
processed. (The first line of the action is to print hello to the log, and
that never even happens)

I am using The struts nightly build from 11/19/03 to make sure it isn't a
bug or something like that, because what I am seeing here is very similar to
bugzilla report #23465

Here are relevant code snippets:

The form bean:
form-bean name=advancedTaxRatesCurrentForm
type=org.apache.struts.action.DynaActionForm
form-property name=taxRates type=com.ntso.rsg.bus.tax.TaxRateBean[]
/
/form-bean

The action mapping:
action path=/admin/taxRatesUpdateAction
type=com.ntso.rsg.admin.view.settings.TaxRateAction scope=session
name=advancedTaxRatesCurrentForm
forward name=success path=.view.admin.advancedTaxRates
redirect=true/
forward name=failure path=.view.admin.errorPage redirect=true/
/action

The preloader:
request.setAttribute(taxRates, allTaxRates);  // where allTaxRates is a
TaxRateBean[]

The jsp form:
html:form action=admin/taxRatesUpdateAction
logic:iterate id=taxRates name=taxRates indexId=ctr 
html:checkbox indexed=true name=taxRates property=delete /
html:hidden indexed=true name=taxRates property=ID /
html:text indexed=true name=taxRates property=ratePercent
style=width: 50px; text-align: right;/
/logic:iterate
html:submit value=Update/
/html:form

For the action, I have tried three different things:
Try 1: (DynaActionForm) myForm = (DynaActionForm) form;
Try 2: (DynaActionForm) myForm = (DynaActionForm)
session.getAttribute(advancedTaxRatesCurrentForm);
Try 3: TaxRateBean[] myForm = (TaxRateBean[])
session.getAttribute(advancedTaxRatesCurrentForm);

All three things yield the same error, and as stated above, the error occurs
before any of my code in the action. The action itself is extending
org.apache.struts.action.Action; and is just a standard execute method.

Searching on the web and in the archives has yielded some people with
similar problems, but so far I have not been able to find a solution that
works.

Just for reference, the platform for this is:
Windows XP Pro
Tomcat 4.1.24
Struts Nightly Build 11/19/03
Java 1.4.2

Any help about what I'm doing wrong would be greatly appreciated!! As
stated, the full error stack trace is attached below.

Thanks,
Matt Bathje




Stack trace of error:
javax.servlet.ServletException: BeanUtils.populate
 at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:844)
 at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
ava:823)
 at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:243)
 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1176)
 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:472)
 at com.ntso.rsg.RsgStrutsServlet.doPost(RsgStrutsServlet.java:52)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
 at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
 at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
 at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
 at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
 at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:171)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext

Re: dynamically sized form

2003-11-20 Thread Matt Bathje
Hi again.

I guess I left out part of the explanation when I asked this question - I
already have it working with a form bean class as is described in the
message you indicate. I am trying to avoid having a class for each form by
using DynaActionForms (or better yet DynaValidatorForms). That is what I am
seeking an answer to. Is there a way to do a dynamically sized form using a
DynaForm, instead of a custom form bean class for each one.

Thanks again for any insights,
Matt


- Original Message - 
From: Nicholas L Mohler [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, November 20, 2003 11:33 AM
Subject: Re: dynamically sized form







 Matt,

 Find the thread titled Using a collection of Beans within an ActionForm
 from yesterday.  It has the answer that you need.

 Nick



snip my previous message


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



Re: dynamically sized form

2003-11-20 Thread Matt Bathje
OK, This gets me a step closer - I never understood that last paragraph
completely, The actual always got me :)

Anyway, here is what I have in my preloader now:

DynaActionForm taxRatesForm = new DynaActionForm();

// allTaxRates is the array that holds my data bean
for(int i=0; i  allTaxRates.length; i++) {
// this is the set I am using, from the Struts API:
//set(java.lang.String name, int index, java.lang.Object value)
//  Set the value of an indexed property with the specified
name.
taxRatesForm.set(ID, i, allTaxRates[i].getID());
... set all the other form properties
}
HttpSession session = request.getSession();

// advancedTaxRatesCurrentForm is the name of the form bean in struts-config
session.setAttribute(advancedTaxRatesCurrentForm, taxRatesForm);

Which is giving me the error:

java.lang.NullPointerException: No indexed value for 'ID[0]'   (if you need
the
entire stack trace let me know)

I think I may be using the wrong DynaActionForm.set method, or I
misunderstand
the parameters to it or something.

Just for good measure, here is my form bean out of struts-config again:
form-bean name=advancedTaxRatesCurrentForm
type=org.apache.struts.action.DynaActionForm
form-property name=taxRates type=com.ntso.rsg.bus.tax.TaxRateBean[]
/
/form-bean


Thanks,
Matt Bathje





- Original Message - 
From: Yee, Richard K,,DMDCWEST [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Thursday, November 20, 2003 2:58 PM
Subject: RE: dynamically sized form


 Matt,
 In the previous email, I wrote, You will need to dynamically create the
 array of TaxRateBean and put it in session scope in order to create the
 submission fields in your form. (See the last paragraph of article #2).
 I should have said that according to the article, you prepopulate the
array
 in the form and put the form in session scope.

 -Richard



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



Re: dynamically sized form

2003-11-20 Thread Matt Bathje
snip
 
 DynaActionForm taxRatesForm = new DynaActionForm();
 com.ntso.rsg.bus.tax.TaxRateBean[] taxRates = new
 com.ntso.rsg.bus.tax.TaxRateBean[allTaxRates.length];
 
 // allTaxRates is the array that holds my data bean
 
 for(int i=0; i  allTaxRates.length; i++) {
 // this is the set I am using, from the Struts API:
 //set(java.lang.String name, int index, java.lang.Object value)
 //  Set the value of an indexed property with the specified
 name.
 taxRatesForm.set(taxRates, taxRates);
 }
snip

Richard - I tried this, but didn't have much hope, as it doesn't really
make sense to me. What would be the point of doing the set inside
a loop over allTaxRates? Also, how would the data get from
allTaxRates into the taxRates array in the form? How does it know
that taxRates is an indexed property as opposed to a simple 
property? Why setup a new TaxRateBean array (taxRates) when 
allTaxRates is already that?

Anyways, trying your method outright produces a null pointer 
exception.

I tried modifying it to do this in the loop (using allTaxRates so that
it gets the current data):
taxRatesForm.set(taxRates, i, allTaxRates[i]);
and it produces an error of:
java.lang.NullPointerException: No indexed value for 'taxRates[0]'

I then tried this, outside of the loop (again using allTaxRates because
it will get the current data)
taxRatesForm.set(taxRates, allTaxRates);
it also gives a null pointer exception


Using the set(string, object) method of DynaActionForm doesn't
really make sense to me, so if that is the solution could you explain
why? (See all my questions above about that) Unless I am 
completely braindead (which we can't rule out of course) I think
the set(string, int, object) method needs to be used for this.

Thanks again,

Matt Bathje

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