Re: checking for an object in a collection

2004-10-08 Thread Muhammad Momin Rashid
Thank you for replying,  I believe that your idea of using the hashMap is 
probably the best one.  Is it possible for you to provide me some assistance 
with a sample jsp tag to accomplish this?  e.g. lets say that I have a 
hashMap with rules x, y and z defined (where x, y and z are the keys.  Which 
struts tags allow me to check if a desired rule is defined or not in the 
hashMap?

Regards,
Muhammad Momin Rashid.

<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Obviously, it's still too early for me.  A HashMap is what I meant to say.

Dennis



[EMAIL PROTECTED]
10/07/2004 08:15 AM Please respond to
"Struts Users Mailing List" <[EMAIL PROTECTED]>

To"Struts Users Mailing List" <[EMAIL PROTECTED]>
cc
SubjectRe: checking for an object in a collection








I may not fully understand what you're trying to do, but why not use a 
HashSet instead?  Let the table name be the key to the rule.
This may or may not be helpful:  http://www.javapractices.com/Topic65.cjp.


Dennis



"Muhammad Momin Rashid" <[EMAIL PROTECTED]>
Sent by: news <[EMAIL PROTECTED]>
10/07/2004 08:09 AM
Please respond to
"Struts Users Mailing List" <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
cc
Subjectchecking for an object in a collection









Hello All,

I have a scenario in which I need to display (or not display) differnt parts
of a jsp page depending on rules defined in a collection in scope.

I was wondering what is the best way to accomplish this?  All the rules
defined in a collection, and the decision is made on the basis of if a rule
is present in the collection or not.  The following approach seems messy to
me, so i was wondering if anyone can enlighten me with a better way to
accomplish this

iterate through collection
  if rule x is present
  display x table
  end if
end iterate

iterate through collection
  if rule y is present
  display y table
  end if
end iterate

A sample code snippit would be highly apprecated,  Thanks for your time.

Regards,
Muhammad Momin Rashid.




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




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



Re: checking for an object in a collection

2004-10-07 Thread DGraham

Obviously, it's still too early for
me.  A HashMap is what I meant to say.

Dennis






[EMAIL PROTECTED]

10/07/2004 08:15 AM



Please respond to
"Struts Users Mailing List" <[EMAIL PROTECTED]>





To
"Struts Users Mailing
List" <[EMAIL PROTECTED]>


cc



Subject
Re: checking for an object
in a collection









I may not fully understand what you're trying to do, but why not use a
HashSet instead?  Let the table name be the key to the rule.  

This may or may not be helpful:  http://www.javapractices.com/Topic65.cjp.



Dennis 






"Muhammad Momin Rashid"
<[EMAIL PROTECTED]> 
Sent by: news <[EMAIL PROTECTED]> 
10/07/2004 08:09 AM





Please respond to
"Struts Users Mailing List" <[EMAIL PROTECTED]>





To
[EMAIL PROTECTED]



cc



Subject
checking for an object in
a collection










Hello All,

I have a scenario in which I need to display (or not display) differnt
parts 
of a jsp page depending on rules defined in a collection in scope.

I was wondering what is the best way to accomplish this?  All the
rules 
defined in a collection, and the decision is made on the basis of if a
rule 
is present in the collection or not.  The following approach seems
messy to 
me, so i was wondering if anyone can enlighten me with a better way to

accomplish this

iterate through collection
   if rule x is present
       display x table
   end if
end iterate

iterate through collection
   if rule y is present
       display y table
   end if
end iterate

A sample code snippit would be highly apprecated,  Thanks for your
time.

Regards,
Muhammad Momin Rashid. 




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

Re: checking for an object in a collection

2004-10-07 Thread Miranda & John Stager
Hello Muhammad,

I hope that you are using custom tags for this.

I would create a new custom tag  to determine if the
rule is present in the collection...


display table x


This tag would then look in the collection for the
specific rule, not by iterating through the collection
but by trying to retrieve the rule by its key.

I would suggest using a key/value mapping collection,
do the look up on the key
collection.containsKey(ruleKey) if true then display
the tag body, if false then skip the tag body.

Hope this helps.

John

 --- Muhammad Momin Rashid <[EMAIL PROTECTED]> wrote: 
> Hello All,
> 
> I have a scenario in which I need to display (or not
> display) differnt parts 
> of a jsp page depending on rules defined in a
> collection in scope.
> 
> I was wondering what is the best way to accomplish
> this?  All the rules 
> defined in a collection, and the decision is made on
> the basis of if a rule 
> is present in the collection or not.  The following
> approach seems messy to 
> me, so i was wondering if anyone can enlighten me
> with a better way to 
> accomplish this
> 
> iterate through collection
> if rule x is present
> display x table
> end if
> end iterate
> 
> iterate through collection
> if rule y is present
> display y table
> end if
> end iterate
> 
> A sample code snippit would be highly apprecated, 
> Thanks for your time.
> 
> Regards,
> Muhammad Momin Rashid. 
> 
> 
> 
> 
>
-
> 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: checking for an object in a collection

2004-10-07 Thread DGraham

I may not fully understand what you're
trying to do, but why not use a HashSet instead?  Let the table name
be the key to the rule.  
This may or may not be helpful:  http://www.javapractices.com/Topic65.cjp.


Dennis







"Muhammad Momin Rashid"
<[EMAIL PROTECTED]> 
Sent by: news <[EMAIL PROTECTED]>
10/07/2004 08:09 AM



Please respond to
"Struts Users Mailing List" <[EMAIL PROTECTED]>





To
[EMAIL PROTECTED]


cc



Subject
checking for an object in
a collection








Hello All,

I have a scenario in which I need to display (or not display) differnt
parts 
of a jsp page depending on rules defined in a collection in scope.

I was wondering what is the best way to accomplish this?  All the
rules 
defined in a collection, and the decision is made on the basis of if a
rule 
is present in the collection or not.  The following approach seems
messy to 
me, so i was wondering if anyone can enlighten me with a better way to

accomplish this

iterate through collection
    if rule x is present
        display x table
    end if
end iterate

iterate through collection
    if rule y is present
        display y table
    end if
end iterate

A sample code snippit would be highly apprecated,  Thanks for your
time.

Regards,
Muhammad Momin Rashid. 




-
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: checking for an object in a collection

2004-10-07 Thread Paul McCulloch
A Map is proabably a better data structure to use than a collection. I'd
consider changing the way the rules are stored, or converting the Collection
to a Map in your action.

Paul

> -Original Message-
> From: Muhammad Momin Rashid [mailto:[EMAIL PROTECTED]
> Sent: Thursday, October 07, 2004 1:09 PM
> To: [EMAIL PROTECTED]
> Subject: checking for an object in a collection
> 
> 
> Hello All,
> 
> I have a scenario in which I need to display (or not display) 
> differnt parts 
> of a jsp page depending on rules defined in a collection in scope.
> 
> I was wondering what is the best way to accomplish this?  All 
> the rules 
> defined in a collection, and the decision is made on the 
> basis of if a rule 
> is present in the collection or not.  The following approach 
> seems messy to 
> me, so i was wondering if anyone can enlighten me with a 
> better way to 
> accomplish this
> 
> iterate through collection
> if rule x is present
> display x table
> end if
> end iterate
> 
> iterate through collection
> if rule y is present
> display y table
> end if
> end iterate
> 
> A sample code snippit would be highly apprecated,  Thanks for 
> your time.
> 
> Regards,
> Muhammad Momin Rashid. 
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


**
Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you are not 
the addressee indicated in this message (or responsible for delivery of the message to 
such person), you may not copy or deliver this message to anyone. In such case, you 
should destroy this message, and notify us immediately. If you or your employer does 
not consent to Internet email messages of this kind, please advise us immediately. 
Opinions, conclusions and other information expressed in this message are not given or 
endorsed by my Company or employer unless otherwise indicated by an authorised 
representative independent of this message.
WARNING:
While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted 
via electronic mail attachments we cannot guarantee that attachments do not contain 
computer virus code.  You are therefore strongly advised to undertake anti virus 
checks prior to accessing the attachment to this electronic mail.  Axios Systems Ltd 
grants no warranties regarding performance use or quality of any attachment and 
undertakes no liability for loss or damage howsoever caused.
**


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