Re: Trouble with validation of nested properties-indexedListProperty?

2003-08-14 Thread John Tangney
Thanks, Yansheng.

I am not sure I understand. I tried
 
  
 

Is that what you meant? It does the same thing (empty JavaScript.) I don't
understand how your solution is *supposed* to work. I want to validate the
email field of every Info object in the allUsers collection.

Did I misunderstand your suggestion?

Thanks!
--johnt

in article [EMAIL PROTECTED], Yansheng Lin
at [EMAIL PROTECTED] wrote on 8/14/03 8:31 AM:

> 
> I can see one spot that could lead to problem.
> 
> In your iterate,  the var name is "allUsers".  However, in your
> validation.xml,
> the field property is "email".   The name of the iteration var has to be the
> same as the property name of the array in the form.
> 
> Hope this works.
> 
> - Yansheng
> 
> -Original Message-
> From: John Tangney [mailto:[EMAIL PROTECTED]
> Sent: August 13, 2003 5:22 PM
> To: [EMAIL PROTECTED]
> Subject: Trouble with validation of nested properties -indexedListProperty?
> 
> 
> Hi all,
> 
> I have memorized the docs, scoured the archives, googled 'till my eyes were
> crossed, experimented at great length, but have not been able to solve this
> riddle.
> 
> I have a JSP that looks like this:
> 
>   
> 
>   
>   
> 
>   
> 
> 
> My form bean has 
> 
>   public List getAllUsers() {
>   return this.allUsers;
>   }
> 
> Which returns a collection of...
> 
>   public static class Info {  // an inner class of the form bean, FWIW
>   private String email;
>   private String userName;
> 
>   public void setEmail(String string) {
>   email = string;
>   }
> 
>   public String getEmail() {
>   return email;
>   }
>   ...
>   }
> 
> Everything's great - works perfectly; does what I want. It's a pattern I use
> all over the place, on several projects.
> 
> Next, I want to add validation:
> 
> In the JSP I add  in the head. My
> form bean now extends ValidatorForm.
> 
> In my validation.xml I add:
> 
> 
>  depends="required,email">
>  
> 
> 
> 
> 
> *** The validation doesn't work.***
> 
> I am more concerned about client-side validation, so let's look at that:
> 
> The generated JavaScript looks like this:
>  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]



Trouble with validation of nested properties -indexedListProperty?

2003-08-14 Thread John Tangney
Hi all,

I have memorized the docs, scoured the archives, googled 'till my eyes were
crossed, experimented at great length, but have not been able to solve this
riddle.

I have a JSP that looks like this:


  


  



My form bean has 

public List getAllUsers() {
return this.allUsers;
}

Which returns a collection of...

public static class Info {  // an inner class of the form bean, FWIW
private String email;
private String userName;

public void setEmail(String string) {
email = string;
}

public String getEmail() {
return email;
}
...
}

Everything's great - works perfectly; does what I want. It's a pattern I use
all over the place, on several projects.

Next, I want to add validation:

In the JSP I add  in the head. My
form bean now extends ValidatorForm.

In my validation.xml I add:

  
  
   
  
  


*** The validation doesn't work.***

I am more concerned about client-side validation, so let's look at that:

The generated JavaScript looks like this:

Re: two-step container managed authentication

2003-08-14 Thread John Tangney
The way CMA works, the auth happens completely transparently. That is, auth
happens before your app even sees the HttpRequest.

If you want to do a second auth-like thing with that request, the you'd set
up an action to do so.

Note that the CMA can access the same db tables as the rest of the app,
using a JDBCRealm (rather than JNDI.) But I guess you want to maintain
separate lists of users, right?

Sorry if this is not much help. If you could explain the use case(s) a
little, maybe we can help come up with an architecture that'll do the trick.

--johnt
Strictly speaking this is OT, since CMA is not a Struts thing, but who ya
gonna ask? ;->

in article [EMAIL PROTECTED], Erik Price at [EMAIL PROTECTED] wrote on
5/19/03 8:29 AM:

> Hi,
> 
> I am soliciting advice from other struts and web developers.  I am
> moving my in-progress project (JSP & servlets only) to Struts framework
> after having been converted at a JUG meeting, and am planning things
> out.  One of the things I would like to do is move from my current
> security model (which uses a homebrewed authentication filter) to
> container-managed authorization/authentication.  However, I would like
> to perform two steps in the login and am not sure if this is possible
> with CMA.
> 
> When a user requests a resource of the webapp, a login (form-based auth)
> should be presented, and the user enters username and password.  The
> authorization is performed against LDAP (partly the motivation to move
> from my security filter to container-managed auth is to make JNDI/LDAP
> auth easier to set up).  If the user authorizes successfully, then a
> *second* step is performed -- authenticate against a local (non-LDAP)
> database of registered users.  If the user's name is present in this
> database, fine, log in as normal.  However, if the username is not
> present in this database, then the user must be requesting an account to
> use this webapp: execute the NewUserRequestAction.
> 
> This is something I can easily do with my filter, simply by implementing
> the code myself.  But is it possible to do with container-managed
> authorization?  Any suggestions?  BTW I would like to perform all of
> this within a single HTTP request so that there is no opportunity for
> the user to change the username after authorizing against LDAP but
> before querying the database.
> 
> 
> Thanks,
> 
> Erik



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



Re: Trouble with validation of nested properties -indexedListProperty?

2003-08-14 Thread John Tangney
in article [EMAIL PROTECTED], Mark Lowe at
[EMAIL PROTECTED] wrote on 8/13/03 5:10 PM:

> 
> The js array that is generated doesn't generate the indexed property
> attributes.
Right.

> I've been wanting to look in this, so far I've got as far as adding
> myindexedprop[0].property as the property in validator to test whether
> if you can get the array of required properties (for example) whether
> it would work which it does. So in theory the javascript doesn't need a
> tweak but something to do with whatever punches-out the javascript
> array.
Exactly.
 
> This works in terms of the javascript.. Compare the js out put of both
> conditions
> 
>>  >   depends="required,email">

Hmm. I see what you mean. That gets us the first element... (Yay!)
 
> 
> Using indexedListPRoperty does seem to work..
>>  >   depends="required,email">

???! Maybe I'm misunderstanding you.. This is precisely the case that does
NOT work!

> thus its one of those things that needs a bit of looking at.. Its there
> to be done and the indexed property attribute is there. I even read a
> presentation demonstrating use in the way, but thus far I haven't had
> it working.

I am starting to suspect that it's just a bug. :-(

> Not very helpful I guess but thats as far as I've got with this one.

On the contrary: You've helped me enormously!
> 
> Cheers Mark

Thanks again,
--johnt

> On Thursday, August 14, 2003, at 12:22 AM, John Tangney wrote:
> 
>> Hi all,
>> 
>> I have memorized the docs, scoured the archives, googled 'till my eyes
>> were
>> crossed, experimented at great length, but have not been able to solve
>> this
>> riddle.
>> 
>> I have a JSP that looks like this:
>> 
>> 
>>   
>> 
>> 
>>   
>> 
>> 
>> 
>> My form bean has
>> 
>> public List getAllUsers() {
>> return this.allUsers;
>> }
>> 
>> Which returns a collection of...
>> 
>> public static class Info {  // an inner class of the form
>> bean, FWIW
>> private String email;
>> private String userName;
>> 
>> public void setEmail(String string) {
>> email = string;
>> }
>> 
>> public String getEmail() {
>> return email;
>> }
>> ...
>> }
>> 
>> Everything's great - works perfectly; does what I want. It's a pattern
>> I use
>> all over the place, on several projects.
>> 
>> Next, I want to add validation:
>> 
>> In the JSP I add  in the
>> head. My
>> form bean now extends ValidatorForm.
>> 
>> In my validation.xml I add:
>> 
>>   
>>   >   depends="required,email">
>>
>>   
>>   
>> 
>> 
>> *** The validation doesn't work.***
>> 
>> I am more concerned about client-side validation, so let's look at
>> that:
>> 
>> The generated JavaScript looks like this:
>> > 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: Indexed and nested references

2001-03-08 Thread John Tangney

Thanks to all those who responded!

I have figured it out. The problem, as usual, was in my form bean. The
getQuestion(int index) accessor needed to *create* a new QuestionForm if
none existed for the given index. That was it. The succession of exceptions
that were throw were horrifyingly misleading...

Regards
--johnt


on 3/7/01 5:02 PM, John Tangney at [EMAIL PROTECTED] wrote:

> Hi
> 
> I have been away from this list for a while, so please forgive me if this is
> a known problem. I was not able to find a reference...
> 
> I am using a JSP with a form bean that has the following properties:
> Vector questions;
> String foo;
> 
> There are the usual accessors:
> public QuestionBean getQuestion(int no);
> public String getFoo();
> ...
> 
> Each element in the vector is a QuestionBean, and each QuestionBean has:
> Vector answers;
> String userText;
> 
> and the usual accessors:
> public AnswerBean getAnswer(int no);
> public String getUserText();
> 
> Each element in *this* vector is an AnswerBean, with only scalar properties
> and accessors.
> 
> My jsp then uses constructs that result in this HTML:
> 
> 
> The JSP is properly populated before it's displayed. (Note the value "Blue"
> above.) All the values are correctly pulled from the form bean and its
> nested beans. When I submit the form, the next action uses the same form
> bean class, and this is where things fall apart. The only request parameter
> that gets pulled into the form bean is foo. The indexed "question" is not
> recognized.
> 
> I reuse the QuestioBean as a form in another place (It extends ActionForm)
> and the generated HTML does not use any indexed or nested references. It
> works perfectly.
> 
> So what's happening? Is the indexed/nested stuff broken? Is the problem
> caused by the fact that question[0] yields another bean? (The docs say you
> can combine index/nested/simple references.) And why does the formBean -->
> JSP populating work, but request --> formBean not?
> 
> Any and all hints gratefully accepted.
> 
> --johnt




Indexed and nested references

2001-03-07 Thread John Tangney

Hi

I have been away from this list for a while, so please forgive me if this is
a known problem. I was not able to find a reference...

I am using a JSP with a form bean that has the following properties:
Vector questions;
String foo;

There are the usual accessors:
public QuestionBean getQuestion(int no);
public String getFoo();
...

Each element in the vector is a QuestionBean, and each QuestionBean has:
Vector answers;
String userText;

and the usual accessors:
public AnswerBean getAnswer(int no);
public String getUserText();

Each element in *this* vector is an AnswerBean, with only scalar properties
and accessors.

My jsp then uses constructs that result in this HTML:


The JSP is properly populated before it's displayed. (Note the value "Blue"
above.) All the values are correctly pulled from the form bean and its
nested beans. When I submit the form, the next action uses the same form
bean class, and this is where things fall apart. The only request parameter
that gets pulled into the form bean is foo. The indexed "question" is not
recognized.

I reuse the QuestioBean as a form in another place (It extends ActionForm)
and the generated HTML does not use any indexed or nested references. It
works perfectly.

So what's happening? Is the indexed/nested stuff broken? Is the problem
caused by the fact that question[0] yields another bean? (The docs say you
can combine index/nested/simple references.) And why does the formBean -->
JSP populating work, but request --> formBean not?

Any and all hints gratefully accepted.

--johnt