nested depth, iterate

2003-04-03 Thread Chris Butler
Is there anyway to determine the level you are down in the nesting?
Ideally, the number of levels back up to the nested:root...  I would
kinda assume that the level would be equal to descent... meaning that
the nested:root level would be equal to zero...

 

Also, I'd like to use this in conjunction with a fixed length iterate
tag.

Essentially letting me loop a number of times specified by the
nested:depth.

 

Any thoughts on approach?  Should I just write my own tag lib?

 

Thanks,

Chris



nested:radio does not support idName property?

2003-03-27 Thread Chris Butler
Hey folks,

I was looking for a way which would allow a nested radio button to pass
along a value of a bean.  The below example has a list of answer groups,
each of which answer group should have a selected answer.

nested:iterate id=tmpAnswerGroup property=answerGroupList
 nested:radio idName=tmpAnswerGroup 
   property=selectedAnswerId 
   value=selectedAnswerId /
 /nested:iterate

For some reason the nested:radio tag doesn't support idName.  Is
this just an oversight?  Also, value cannot be omitted based on the
html:radio definition, so I imagine the above looks a little bit
redundant by specifying the selectedAnswerId twice.

Note: if I leave out idName, the jsp does not interpret the value as a
bean-related field, but interprets it as a literal value.

Thoughts?

Chris

PS: have tested more complex behavior of nested:iterate and tiles bug
that is in bugzilla and will update the bug report as requested.

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



RE: nested:iterate jsp:include, nesting reference incorrect?

2003-03-14 Thread Chris Butler
Arron,

Thanks - that bugfix jar seems to have resolved the problem.
It works correctly against the test anyway for a first check.

BTW, I like your recursive monkey tree example on your site... ;-)

http://www.keyboardmonkey.com/pilotlight/monkey-tree/monkey-tree-02.jsp?
content=yesplease

Chris

-Original Message-
From: Arron Bates [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 13, 2003 6:10 PM
To: Struts Users Mailing List
Subject: Re: nested:iterate  jsp:include, nesting reference incorrect? 

Have you tried the latest and greatest nested tags?...

An update changing all the internals that would affect this have
changed. It
went in after RC1, so either fetch a nightly, or simply download...

 http://keyboardmonkey.com/downloads/km-nested-v2.03.jar

...and pop it into your WEB-INF/lib directory and spin your container
again.
If the problem persists, please get back to me.

Arron.


 In my http request scope, I'm seeing nested-includes-key/ losing my
 iterate index when passing the nesting context to an included jsp.
I've
 been using struts-1.1RC1.  I've dumped out the request attributes, pre
 and post jsp include to see what's in there...
 
 *** external.jsp
 nested:iterate property=someObjects
   nested:writeNesting /
   jsp:include page=included.jsp /
 /nested:iterate
 
 *** included.jsp
 nested:root
   nested:writeNesting /
 /nested:root
 
 In this example, I would get a nesting of:
 In the external jsp:
 someObject[0]
 someObject[1]
 
 In the included jsp:
 someObject[0]
 someObject[0]
 
 Within any one jsp, the nested iterate seems to manage things just
fine,
 including collections in an included jsp, just not the nested:root of
 the included jsp.
 
 Also, I notice that the NestedReference.getNestedProperty() appears to
 yield the correct string *prior* to setting the nested:root and it
is
 set to an empty string (or null?) immediately afterwards.  Thus it
 appears that the setting of nested:root is either where the bug is,
or
 this is desired behavior...  or I've gotten this entirely wrong. :-)
 
 chris




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



nested:iterate jsp:include, nesting reference incorrect?

2003-03-13 Thread Chris Butler
In my http request scope, I'm seeing nested-includes-key/ losing my
iterate index when passing the nesting context to an included jsp. I've
been using struts-1.1RC1.  I've dumped out the request attributes, pre
and post jsp include to see what's in there...

*** external.jsp
nested:iterate property=someObjects
  nested:writeNesting /
  jsp:include page=included.jsp /
/nested:iterate

*** included.jsp
nested:root
  nested:writeNesting /
/nested:root

In this example, I would get a nesting of:
In the external jsp:
someObject[0]
someObject[1]

In the included jsp:
someObject[0]
someObject[0]


Within any one jsp, the nested iterate seems to manage things just fine,
including collections in an included jsp, just not the nested:root of
the included jsp.

Also, I notice that the NestedReference.getNestedProperty() appears to
yield the correct string *prior* to setting the nested:root and it is
set to an empty string (or null?) immediately afterwards.  Thus it
appears that the setting of nested:root is either where the bug is, or
this is desired behavior...  or I've gotten this entirely wrong. :-)

chris

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



RE: Question about NestedIterateTag (also: nested:iterate nested:root)

2003-03-13 Thread Chris Butler
I seem to be having a very similarly related problem with respect to
nested:iterate and jsp:include.  I've found that the index is lost and
it always finds the name for the first element in the collection only.

A simple test that I've done - I've attached.

Chris

-Original Message-
From: Bhamani, Nizar A TL56E [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 13, 2003 4:01 PM
To: 'Struts Users Mailing List'
Subject: Question about NestedIterateTag

We have written our own tag to print a bunch of fields read from an XML
file. I am using various NestedTextTag, NestedRadioTag, NestedSelectTag,
NestedOptionsTag and it all works fine.

I had to enhance this to use iterations of a list of fields and am using
NestedIterateTag.


However using NestedIterateTag dosen't seem to iterate over the
collection
As expected. It just prints prints out the first object from the
collection.

Has anybody has experience using the NestedIterateTag ???


Here is the logic in short:


public class MyTag extends NestedWriteTag implements NestedNameSupport
{
public int doStartTag() throws JspException
{
// Some stuff removed 

NestedIterateTag iterateTag = new NestedIterateTag();
iterateTag.setParent(this);
iterateTag.setPageContext(pageContext);

// theCollectionProperty is of ArrayList type.
iterateTag.setProperty(theCollectionProperty);
iterateTag.doStartTag();


// Do some stuff to use NestedTextTag, NestedRadioTag
etc
and
// set their parent as iterateTag.

iterateTag.doEndTag();

return (SKIP_BODY); 
}

}


Again, the iteration works only for the first element in the collection.

Doesn't work for all the elements in the collection.


Any help would be appreciated.

Thanks,

Nizar.

-
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: Question about NestedIterateTag (also: nested:iterate nested:root)

2003-03-13 Thread Chris Butler
I've also attached all test files to the bug report at:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17977

Personally, I'm seeing more of a problem with the actual
names re: the nesting level rather than the actual objects,
but your problem could be a symptom of the same issue too.

chris

-Original Message-
From: Bhamani, Nizar A TL56E [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 13, 2003 4:31 PM
To: 'Struts Users Mailing List'
Cc: Chris Butler
Subject: RE: Question about NestedIterateTag (also: nested:iterate 
nested:root)

Didn't get the attachment. May be the discussion group filtered it out.
Can
you send it to me in an email separately.

Thanks,



-Original Message-
From: Chris Butler [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 13, 2003 4:28 PM
To: Struts Users Mailing List
Subject: RE: Question about NestedIterateTag (also: nested:iterate 
nested:root)

I seem to be having a very similarly related problem with respect to
nested:iterate and jsp:include.  I've found that the index is lost and
it always finds the name for the first element in the collection only.

A simple test that I've done - I've attached.

Chris

-Original Message-
From: Bhamani, Nizar A TL56E [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 13, 2003 4:01 PM
To: 'Struts Users Mailing List'
Subject: Question about NestedIterateTag

We have written our own tag to print a bunch of fields read from an XML
file. I am using various NestedTextTag, NestedRadioTag, NestedSelectTag,
NestedOptionsTag and it all works fine.

I had to enhance this to use iterations of a list of fields and am using
NestedIterateTag.


However using NestedIterateTag dosen't seem to iterate over the
collection
As expected. It just prints prints out the first object from the
collection.

Has anybody has experience using the NestedIterateTag ???


Here is the logic in short:


public class MyTag extends NestedWriteTag implements NestedNameSupport
{
public int doStartTag() throws JspException
{
// Some stuff removed 

NestedIterateTag iterateTag = new NestedIterateTag();
iterateTag.setParent(this);
iterateTag.setPageContext(pageContext);

// theCollectionProperty is of ArrayList type.
iterateTag.setProperty(theCollectionProperty);
iterateTag.doStartTag();


// Do some stuff to use NestedTextTag, NestedRadioTag
etc
and
// set their parent as iterateTag.

iterateTag.doEndTag();

return (SKIP_BODY); 
}

}


Again, the iteration works only for the first element in the collection.

Doesn't work for all the elements in the collection.


Any help would be appreciated.

Thanks,

Nizar.

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



Nested and Tiles taglibs together

2003-03-12 Thread Chris Butler
So, I've been using struts for a while... even back when Tiles used to
be called Components. :-)
I'm pretty impressed with how far things have come and how useful the
framework is...

Anyway, I'm new to using nested tags and am trying to use them in
combination with Tiles.
The goal I have is to iterate over a bunch of questions, each question
which has its own layout. For now, ignore how the layout switch is
handled - I'm more concerned about passing nested context between tiles
if it's possible.  (I've actually accomplished the switch via a
logic:equals sort of hack for the time being rather than pre-loading any
data in a tiles controller.  Why this works with a tiles:insert, I'm not
sure since one would think it would have flush-from-within-a custom-tile
issues as well.)

First pass (without swapped layout):
nested:iterate property=questions scope=request
nested:nest property=question
nested:write property=questionText /br /
nested:hidden property=questionId /br /
  !-- insert answers here later --
/nested:nest
/nested:iterate

What I would like to do in concept:
*** questions.jsp
nested:iterate property=questions scope=request
tiles:insert attribute=questionLayout flush=false/
/nested:iterate

*** questionLayout.jsp
nested:nest property=question
nested:write property=questionText /br /
nested:hidden property=questionId /br /
  !-- insert answers here later --
/nested:nest

Problems I've had:
1. Tiles  flush = false
   I'm using JBoss 3.2.0RC1 w/Jetty - the Tiles flush tag doesn't seem 
   to work or Jetty mishandles it.  I know we're fighting against the
JSP 1.1 spec.
   Symptom: The flushed tile HTML appears first, the containing JSP HTML
after

2. Losing nested context
   Once I do the tiles:insert, I lose the nested context.  I need to be
able
   to generate the problem index for each question in the form.  This
should
   look something like:
   questions[0].question.questionId=
   questions[1].question.questionId=

Thoughts:
1. When will Struts move to support JSP 1.2?  It's been around for a
long time now.
   In fact, isn't JSP 1.3 out there as well?

2. Is there any good documentation on Tiles and Nested in combination?
   So far, I've been to a lot of the struts resources without much luck.

3. I love the concept of Tiles controllers.  These are fantastic for
moving a 
   Tile around a webapp solely by referencing it via the JSP/tiles defs.
Is
   there anyway to leverage this concept in relation to my desired
objectives?

Thanks loads - any tips or even possible approaches would be fantastic.

Chris


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



RE: Nested and Tiles taglibs together

2003-03-12 Thread Chris Butler
Cedric (and others),

Thanks for the response and insight.  I'll cast my vote on the bugfix.
I'd definitely like to see the behavior I described below.

As for nested/tiles interaction and potential to allow for request
scoping of variables, hopefully I can contact the fellow who does the
nested tags and see if that's a possibility.  It makes sense to allow
for an option to push nested tags to the request scope since many
of the original struts tags support it.

Chris

Re: struts and jsp 1.2  2.0, etc.  Apologies for the misnaming of 2.0
as 1.3 - I haven't kept up with that particular spec for a long while.

-Original Message-
From: Cedric Dumoulin [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 12, 2003 12:43 PM
To: Struts Users Mailing List
Subject: Re: Nested and Tiles taglibs together


  Hi Chris,

Chris Butler wrote:

So, I've been using struts for a while... even back when Tiles used to
be called Components. :-)
I'm pretty impressed with how far things have come and how useful the
framework is...

Anyway, I'm new to using nested tags and am trying to use them in
combination with Tiles.
The goal I have is to iterate over a bunch of questions, each question
which has its own layout. For now, ignore how the layout switch is
handled - I'm more concerned about passing nested context between tiles
if it's possible.  (I've actually accomplished the switch via a
logic:equals sort of hack for the time being rather than pre-loading
any
data in a tiles controller.  Why this works with a tiles:insert, I'm
not
sure since one would think it would have flush-from-within-a
custom-tile
issues as well.)

First pass (without swapped layout):
nested:iterate property=questions scope=request
nested:nest property=question
nested:write property=questionText /br /
nested:hidden property=questionId /br /
 !-- insert answers here later --
/nested:nest
/nested:iterate

What I would like to do in concept:
*** questions.jsp
nested:iterate property=questions scope=request
tiles:insert attribute=questionLayout flush=false/
/nested:iterate

*** questionLayout.jsp
nested:nest property=question
nested:write property=questionText /br /
nested:hidden property=questionId /br /
 !-- insert answers here later --
/nested:nest

Problems I've had:
1. Tiles  flush = false
   I'm using JBoss 3.2.0RC1 w/Jetty - the Tiles flush tag doesn't seem 
   to work or Jetty mishandles it.  I know we're fighting against the
JSP 1.1 spec.
   Symptom: The flushed tile HTML appears first, the containing JSP
HTML
after
  

  There is a ticket opened in bugzilla for this issue.You can try the 
proposed patch, and vote for it.

2. Losing nested context
   Once I do the tiles:insert, I lose the nested context.  I need to be
able
   to generate the problem index for each question in the form.  This
should
   look something like:
   questions[0].question.questionId=
   questions[1].question.questionId=
  

  I don't know how nested is implemented, but it looks like it store its

context in the page scope. Need to be in the request scope to work with 
Tiles

Thoughts:
1. When will Struts move to support JSP 1.2?  It's been around for a
long time now.
   In fact, isn't JSP 1.3 out there as well?

  It is jsp1.2


2. Is there any good documentation on Tiles and Nested in combination?
   So far, I've been to a lot of the struts resources without much
luck.

  I don't know about any documentation for Tiles/nested. Any help is 
welcome.

   Cedric


3. I love the concept of Tiles controllers.  These are fantastic for
moving a 
   Tile around a webapp solely by referencing it via the JSP/tiles
defs.
Is
   there anyway to leverage this concept in relation to my desired
objectives?

Thanks loads - any tips or even possible approaches would be fantastic.

Chris


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



thread-safe?

2001-05-18 Thread Chris Butler

heya folks,

been noticing some errors in our logs when people double-click
on buttons and other struts-related html elements.  are there
any issues with it being thread-safe?  is there something that
i should be doing with my Actions?

any tips or related info would be great.  i'm using the 1.0b1
build and haven't used any builds post that date.

Chris




RE: Bean:message with args

2001-05-08 Thread Chris Butler

just curious...  what about a minor enhancement to do it like this:

bean:message key=prompt.password.sent
   bean:write name=someBean property=email/
   bean:write name=someBean property=otherAttr/
/bean:message

the listed internal body tags would be handled as
arg0, arg1, arg2, etc.

not that this is how yours works, but i kinda think
the above would be desirable because you could set
anything into the arguments...  just a thought tho.

thoughts?

Chris

At 10:34 AM 5/8/2001 +0100, Jon.Ridgway wrote:
Hi Stephen,

Your solution sounds like its just what I'm after. I would greatly
appreciate a look at the code.

Jon.

-Original Message-
From: Stephen Schaub [mailto:[EMAIL PROTECTED]]
Sent: 04 May 2001 23:34
To: [EMAIL PROTECTED]
Subject: Re: Bean:message with args


  Is there a way to acheive the following :
  bean:message key=prompt.password.sent arg0=bean:write
  name=email//
  without resorting to scriplets

I was looking for a way to do this a while back; currently
you have to resort to a scriptlet. I proposed and created an
implementation that allows you to do this:

bean:message key=prompt.password.sent arg0={email}/

The { } in argX parameters tell my modified bean:message tag
to use the bean introspection to insert the value of the
bean. If you're interested in the code, I'll be glad to
share it.

Stephen

- Original Message -
From: Jon.Ridgway [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, May 04, 2001 10:36 AM
Subject: Bean:message with args


Hi all,

Is there a way to acheive the following :

bean:message key=prompt.password.sent arg0=bean:write
name=email//

without resorting to scriplets, ie :

bean:parameter id=email name=email/
bean:message key=prompt.password.sent arg0=%=email/

would work but just doesn't sit right with me.

Any ideas.

Jon.




Re: How to check if an array is null

2001-05-04 Thread Chris Butler

logic:present checks for null: whether the bean or bean
property exists.  it works fine with arrays.

c

At 03:08 PM 5/3/2001 -0400, Alex Colic wrote:
Hi, I have a class which has a method 'Columns' which is a one dim array of
Strings. How can I check to see if that method returns null. I want to write
out one message if it is null another if it is not.

Thanks for the help.

Regards

Alex




Re: ActionForward matching url-pattern

2001-05-03 Thread Chris Butler

my guess is that this can be avoided with web.xml.
in web.xml you set the patterns which do URL/servlet matching...

can you provide more details on the forward called
and your pattern matching in web.xml?

c

At 04:00 PM 5/2/2001 -0400, Mindaugas Idzelis wrote:
When you create a new ActionForward, why does it match the location against
the url-pattern? I would like to forword to an absolute location without
matching it against the url-pattern. Any way to do this? Thank you.

--Min Idzelis




Re: using value of bean in my tag.

2001-05-02 Thread Chris Butler

it might be nice to have your tag handle it in the body.

db:setCategory
   bean:write name=category property=categoryNumber/
/db:setCategory

chris

At 09:22 PM 5/1/2001 -0700, Martin Cooper wrote:
First, specify the type of the objects you are iterating over by adding the
'type' attribute to your logic:iterate tag like this:

logic:iterate id=category name=CategoryList property=categoryList
scope=application type=com.popware.alex.Category

Obviously, you'll need to specify the appropriate fully qualified class
name. :-) This will cause the logic:iterate tag to expose the iteration
object ('category' in this case, as identified by the 'id' attribute) with
the correct type.

Then you use your custom tag like this:

db:setCategory categoryNumber='%= category.getCategoryNumber() %' /

Hope this helps.

--
Martin Cooper


- Original Message -
From: Alex Colic [EMAIL PROTECTED]
To: Struts [EMAIL PROTECTED]
Sent: Tuesday, May 01, 2001 11:00 AM
Subject: using value of bean in my tag.


  Hi, I have a tag setup as follows:
 
  logic:iterate id=category name=CategoryList property=categoryList
  scope=application
bean:write name=category property=categoryNumber filter=true/
SELECT NAME=test
  db:setCategory categoryNumber=1 /
/SELECT
  /logic:iterate
  /html:form
 
  I have an object in the servlet context that holds a vector of numbers
  corresponding to categories. I then have a custom tag that needs a number
  passed to it. The logic:iterate tag does iterate through all the numbers
in
  the collection but how do I pass the value of the number to my own custom
  tag attribute as I have above with the number'1'? Any help is appreciated.
 
  Regards
 
  Alex
 




Re: Boycott China - please read - your life may depend on it

2001-04-27 Thread Chris Butler

hey, can we keep the list on subject?

political discussions can take long winding paths
and fill up inboxes with emails that others
really might not want to hear about.  that despite
the fact i might be interested in hearing what a
multi-national list would say about such stuff. ;-)

chris

At 11:13 AM 4/27/2001 +0200, [EMAIL PROTECTED] wrote:

What a shit.
The US just will destroy the earth with the Kyoto non respect.

Thijl Duval
PricewaterhouseCoopers S.à r.l
Réviseur d'entreprises
400, route d'Esch
B.P. 1443 L-1014 Luxembourg
Telephone +352 49 48 48 1
Facsimile +352 49 48 48-2900
mailto:[EMAIL PROTECTED]
http://www.pwcglobal.com/lu

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material.  Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.   If you received
this in error, please contact the sender and delete the material from any
computer.




Re: Does strut support dynamically generated form?

2001-04-27 Thread Chris Butler

i think Struts support java beans specs as a base.
if the 'forms from the database' truly conform to
that spec, i guess yes.  however, given that they
are 'dynamic' i kinda doubt it...

i think we need more info on what 'dynamic' means.

c

At 05:11 AM 4/27/2001 -0700, Web Programmer wrote:
Does strut support forms generated dynamically from
the database? How would you get user-entered values in
the FormBean when you don't know how many elements to
expect or their names. I haven't seen any strut
example that does that or anything in the mail list.

__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/




Re: Help me defend Struts taglibs!!!

2001-04-26 Thread Chris Butler

* unified API
* consistent behavior, performance
* growing industry support
* single-point of functionality management

scriptlets tend to be ad-hoc, slap-together and
not consistent across all JSPs.

performance-wise, i'm unsure.  i'm don't have enough
experience in JSPland to know the subtle details, but
i'm definitely sure that taglibs can be tuned whereas
scriptlets would have to be handled one-by-one.

just my $0.02 though.  i really believe that most java
code should vanish from JSPs.  it's a separation of
church and state sort of belief...  why should UI guys
have to know any java?

also, of interest, is the jakarta taglibs project which
has a very interesting XSL taglib which seems to have all
kinds of potential when thinking about XML...
i think craig contributed to it, so there must be some
struts interest in its functionality.

c

At 09:46 AM 4/26/2001 +0100, Firmin David wrote:
Hi all,
Members of my team are gradually turning against using the Struts taglibs
and resorting to scriptlets.
IMHO: scriptlets bad,  tags good. I've had more experience in using them
than the others, but I'm finding it difficult to fight my corner in the face
of ever increasing skepticism.
Could anyone out there with really valid arguments as to why the use of the
Struts taglibs (especially the logic tags as they're getting the most grief
from my team at the moment) or taglibs in general is good, or why the use
of scriptlets is bad help me out (in the interest of fairness, vice versa
arguments also happily received!)??

Thanks in advance

Regards
David


The information in this email is confidential and is intended solely
for the addressee(s).
Access to this email by anyone else is unauthorised. If you are not
an intended recipient, you must not read, use or disseminate the
information contained in the email.
Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of Capco.

http://www.capco.com
***




Re: Iterate over a bean full of beans?

2001-04-23 Thread Chris Butler

as far as i know you can have nested iterate tags:

logic:iterate id=outerObj name=beanX
property=OuterCollection
 bean:write name=outerObj
property=name/
 logic:iterate id=innerObj
name=outerObj
property=InnerCollection
 bean:write name=innerObj
property=name/
 /logic:iterate
/logic:iterate

i think the trick is referencing the page scope var you've created
in the outer iterate... in this case outerObj.

chris

At 09:42 PM 4/23/2001 +0700, Gael Laurans wrote:
From:
Keith Morrell [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Iterate over a bean full of beans?
Date: Mon, 23 Apr 2001 17:12:57 +1200

I have an issue where I want to iterate using a bean which has
child
beans (excuse the non-industry standard lingo!) and would 
appreciate
some advice (sorry this is my third post today, but I have been
struggling with this and a couple of other issues for days now..)

The old code went something like:

% Iterator it = Summary.getAccounts().iterator();
if(it.hasNext())

... and then within this loop,

% while( it.hasNext() )
{
 AccountBean ab = (AccountBean) it.next();
 out.println( ab.getName();
 out.println( ab.getPhone();

... etc...

Any help etc would be appreciated...as i am not sure how to access
the
child bean properties etc from the main bean (which would control
the
iterate loop)
Here is what I am doing :
I have a Bean with a vector field...

public class SearchResult implements Serializable {
 private Vector lots = new Vector();

... and a method returning an array of the vector's elements ...

 public Lot[] getLots() {
 Lot[] results = new Lot[lots.size()];
 lots.copyInto(results);
 return results;
 }

In the JSP I can use the iterate tag as follow :

logic:iterate id=lot name=searchResult
property=lots
...
 bean:write name=lot
property=number filter=true/
...
/logic:iterate

Hope this helps
Gael Laurans
_
Get Your Private, Free E-mail from MSN Hotmail at
http://www.hotmail.com.




iteration enhancement?

2001-04-23 Thread Chris Butler

Is it possible to access the count of the number of
times you've looped in an iterate tag?

ideally:

logic:iterate id=rowX name=rows
   #bean:write name=rowX property=count/
bean:write name=rowX property=someProperty/
/logic:iterate

unfortunately, i'm guessing that via reflection the
bean is created with a reference name and additional
attributes aren't there...

chris




Calendar

2001-04-23 Thread Chris Butler

does anyone have any clever ways to deal with bean
Calendar properties via JSP?  a string would be nicer...

chris




Re: html:form always wants form bean

2001-04-22 Thread Chris Butler

Has there been any interest in allowing ActionForms
to have objects as members of the form?

ie. dividing registration into user/address/contact/subscriptions
sorts of sub-beans...

chris

At 08:25 AM 4/22/2001 -0400, Ted Husted wrote:
For a simple form with a single field that doesn't need validation you
can specify a name and type, e.g.

otherwise, yes, you do have to give Struts a bean where it can save the 
fields in your form. Vimal Kansal wrote:   Hi,   I am having a strange 
problem.   I have an action nmapping defined as
path="/XDIViewAdminConfigForm.jsp" /And then in my 
XDIViewAdminConfigForm.jsp, I have the  following :   
action="/viewadminconfig.do"    When I request this, I get 
the following exception :   "javax.servlet.jsp.jSpException : Cannot 
retrieve  definition for form bean null  at  
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:708)     
Do I always have to associate a form bean with a form.   Vimal




Casting beans in JSP

2001-04-20 Thread Chris Butler

heya folx,

is there anyway to use a tag to cast an object from
one type to another?  just curious.  the reason is
that a top level bean implements a generic interface
and i need to access the 'actual' object rather than a
the generic attributes returned by interface.

i'm loathe to use any java in my JSPs, so i'm looking
for some other sort of solution.

i'm going to look for a solution on the server side,
but i think it's a fairly normal design pattern.

thoughts?  ideas?

chris




bean:write static

2001-04-20 Thread Chris Butler

Another q:

is it possible to access a static method
[ie. public static getX()] from a bean:write?

bean:write name="myBean" property="x"/

seems to throw an exception for me.
i would have guessed that it would work...
although i question what would happen if
you tried to put something in the attribute.
the setX() wouldn't exist...

Chris




Re: How to display odd/even rows using iterator

2001-04-18 Thread Chris Butler

I used a simple java/jsp hack to do this for something similar
(multiple columns for one resultset), but maybe there's a better way.
One thing I noticed is that bean:define didn't seem to like
an integer primitive as opposed to a String.

  %
 int rowCount= 0;
 int columnMod  = 0;
  %
  logic:iterate id="rowX" name="data" property="aCollection"
  %
 columnMod = rowCount% 2;
 rowCount++;
  %
  bean:define id="col2Flag" value="%= String.valueOf(columnMod) %"/

  logic:notEqual value="1" name="col2Flag"tr/logic:notEqual
td id="textsmall"bean:write name="rowX" property="someVal"//td
  logic:equal value="1" name="col2Flag"/tr/logic:equal

/logic:iterate

logic:notEqual value="1" name="col2Flag"
 td/td
   /tr
/logic:notEqual

chris

At 12:00 PM 4/18/2001 -0400, Zeltser, Mark wrote:
Hello,

I have the following code to build the table:

==
  logic:iterate id="exchangeRate" name="cache" property="displayRates"
   tr
 td class="td0" align="middle"
   bean:write name="exchangeRate" property="currency"
filter="true"/
 /td
 td class="td0" align="middle"
   bean:write name="exchangeRate" property="rate" filter="true"/
 /td
 td class="td0" align="middle"
   bean:write name="exchangeRate" property="rateType"
filter="true"/
 /td
   /tr
 /logic:iterate

==

I would like to set different colors for odd/even rows. How do I do this?

Thanks, Mark.


--
This message is intended only for the personal and confidential use of the 
designated recipient(s) named above.  If you are not the intended 
recipient of this message you are hereby notified that any review, 
dissemination, distribution or copying of this message is strictly 
prohibited.  This communication is for information purposes only and 
should not be regarded as an offer to sell or as a solicitation of an 
offer to buy any financial product, an official confirmation of any 
transaction, or as an official statement of Lehman Brothers Inc.  Email 
transmission cannot be guaranteed to be secure or error-free.  Therefore, 
we do not represent that this information is complete or accurate and it 
should not be relied upon as such.  All information is subject to change 
without notice.




Re: how to cache lists?

2001-04-17 Thread Chris Butler

At 09:15 AM 4/17/2001 -0400, Alex Colic wrote:
Lets say you have a web app that runs over a number of web pages in a wizard
fashion. On each one of these pages you need to present the user with a
select box holding lists. e.g. locations, cities, etc. This data is read
from a database and rarely changes.

How would you cache these lists so that as each user access this site they
do not need to have this info downloaded again?

you could have a singleton data storage class that dumps the
country list into a hashmap.  if the country cache existed, the
class would return the list from there - otherwise it would
go to the database and populate the cache... (1x)

the singleton class is only instantiated once for the app,
or potentially once per cluster node.  use getInstance()
to return the sole instantiation of the class...

ie.
public class MyClass() {

   private static MyClass singleton = new MyClass();
   private HashMap countries = null;

   //constructor
   private MyClass() {
   }

   public getInstance() {
 return singleton;
   }
}

along the lines of that - i think...  caveat -
may have some errors above, i'm writing it off the cuff.

I was thinking in the init() of my ActionServlet to access the database and
get these lists then place them in the session with Application scope. I
think this would allow each user to access the data without reaccessing the
database.

i think there's some additional overhead in putting this in App scope.
Also potentially costs in clustering depending on servlet runner. (weblogic?)

i'm not super familiar with how App scope is managed, but the issue
seems to be more of a db abstraction layer sort of issue rather than
a presentation one.  i'd deal with the data in the layer where it
generally is handled, rather than pushing it all the way up the app
to the presentation layer (Struts).

just my $0.02 though,
chris