RE: Passing variables for logic:iterate

2003-09-15 Thread Robert Taylor
I don't believe that  is "smart" enough to know that
if the value for the offset or length attribute is not an integer then
attempt to "find" the named value in all scopes.

You can do something like this:






Or you could use Struts-EL which provides a JSTL like syntax.

robert

> -Original Message-
> From: Gregory F. March [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 15, 2003 12:00 PM
> To: [EMAIL PROTECTED]
> Subject: Passing variables for logic:iterate
> 
> 
> 
> Ok, this is probably a dumb questio, but here it goes...
> 
> I am trying to iterate over a portion of a list.  I have calculated the
> portion (the offset and length) in my action.  I have two entries in my
> DynaValidatorForm:
> 
>   
>   
> 
> And I am doing a myform.set("pageOffset", String.valueOf(myCalcOffset));
> etc.
> 
> The iterate is:
> 
> name="bfData"
>  type="...lc.web.dto.BfFullEntryData"
>  offset="pageOffset"
>  length="pageLength"
>  indexId="index">
> 
> It just plain doesn't work.  If I substitute something like "5" for
> pageOffset or pageLength,  it works like a champ.
> 
> What am I missing?  It's got to be something simple...
> 
> Thanks,
> 
> /greg
> 
> --
> Gregory F. March-=-http://www.gfm.net:81/~march-=-
> AIM:GfmNet
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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



RE: Passing variables for logic:iterate

2003-09-15 Thread Mainguy, Mike
1st, Thank you, I didn't realize the logic:Iterate tag had those two
properties, so you've indirectly saved me some effort.

2nd, After looking at the source code for the iterate tag, it looks like it
tries to look up those two values straight out of the pageContext.  This
would imply to me, that it doesn't look up the property on the form as it
appears you want it to do.   (i.e. if you do a
request.setParameter("pageOffset","5") in your Action Class) or use a
 tag on your jsp page, it should work
correctly.
I think both ways are valid, but my gut is that the way you where going at
it is the way anybody unfamiliar with the tag would try to use it.  

Perhaps this is a candidate for refactoring, I'd personally like a way to
choose either way.  It just seems bad practice to have one field be sucked
from the bean, and two others be read from the page context (and it appears
to be a simple 2 line fix).



-Original Message-
From: Gregory F. March [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 15, 2003 12:00 PM
To: [EMAIL PROTECTED]
Subject: Passing variables for logic:iterate



Ok, this is probably a dumb questio, but here it goes...

I am trying to iterate over a portion of a list.  I have calculated the
portion (the offset and length) in my action.  I have two entries in my
DynaValidatorForm:

  
  

And I am doing a myform.set("pageOffset", String.valueOf(myCalcOffset));
etc.

The iterate is:

  

It just plain doesn't work.  If I substitute something like "5" for
pageOffset or pageLength,  it works like a champ.

What am I missing?  It's got to be something simple...

Thanks,

/greg

--
Gregory F. March-=-http://www.gfm.net:81/~march-=-AIM:GfmNet

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


This message and its contents (to include attachments) are the property of Kmart 
Corporation (Kmart) and may contain confidential and proprietary information. You are 
hereby notified that any disclosure, copying, or distribution of this message, or the 
taking of any action based on information contained herein is strictly prohibited. 
Unauthorized use of information contained herein may subject you to civil and criminal 
prosecution and penalties. If you are not the intended recipient, you should delete 
this message immediately.



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



RE: Passing variables for logic:iterate

2003-09-15 Thread Robert Taylor
Damn! I hate being lazy. Thanks Mike for correcting my sub-par answer.
I should have looked at the source before responding.

robert

> -Original Message-
> From: Mainguy, Mike [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 15, 2003 12:26 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Passing variables for logic:iterate
>
>
> 1st, Thank you, I didn't realize the logic:Iterate tag had those two
> properties, so you've indirectly saved me some effort.
>
> 2nd, After looking at the source code for the iterate tag, it
> looks like it
> tries to look up those two values straight out of the pageContext.  This
> would imply to me, that it doesn't look up the property on the form as it
> appears you want it to do.   (i.e. if you do a
> request.setParameter("pageOffset","5") in your Action Class) or use a
>  tag on your jsp page, it should work
> correctly.
> I think both ways are valid, but my gut is that the way you where going at
> it is the way anybody unfamiliar with the tag would try to use it.
>
> Perhaps this is a candidate for refactoring, I'd personally like a way to
> choose either way.  It just seems bad practice to have one field be sucked
> from the bean, and two others be read from the page context (and
> it appears
> to be a simple 2 line fix).
>
>
>
> -Original Message-
> From: Gregory F. March [mailto:[EMAIL PROTECTED]
> Sent: Monday, September 15, 2003 12:00 PM
> To: [EMAIL PROTECTED]
> Subject: Passing variables for logic:iterate
>
>
>
> Ok, this is probably a dumb questio, but here it goes...
>
> I am trying to iterate over a portion of a list.  I have calculated the
> portion (the offset and length) in my action.  I have two entries in my
> DynaValidatorForm:
>
>   
>   
>
> And I am doing a myform.set("pageOffset", String.valueOf(myCalcOffset));
> etc.
>
> The iterate is:
>
> name="bfData"
>  type="...lc.web.dto.BfFullEntryData"
>  offset="pageOffset"
>  length="pageLength"
>  indexId="index">
>
> It just plain doesn't work.  If I substitute something like "5" for
> pageOffset or pageLength,  it works like a champ.
>
> What am I missing?  It's got to be something simple...
>
> Thanks,
>
> /greg
>
> --
> Gregory F. March-=-http://www.gfm.net:81/~march-=-
> AIM:GfmNet
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> This message and its contents (to include attachments) are the
> property of Kmart Corporation (Kmart) and may contain
> confidential and proprietary information. You are hereby notified
> that any disclosure, copying, or distribution of this message, or
> the taking of any action based on information contained herein is
> strictly prohibited. Unauthorized use of information contained
> herein may subject you to civil and criminal prosecution and
> penalties. If you are not the intended recipient, you should
> delete this message immediately.
>
>
>
> -
> 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: Passing variables for logic:iterate

2003-09-15 Thread Gregory F. March

On Sep 15, 2003, "Mainguy, Mike" <[EMAIL PROTECTED]>  wrote:

 |1st, Thank you, I didn't realize the logic:Iterate tag had those two
 |properties, so you've indirectly saved me some effort.
 :

Thanks for the answers...

As a first go-round, I'm trying the bean:define suggestion from Robert.

On (I believe) the logic:iterate tag, I am getting:

[Exception in:/bf/search/results.jsp] java.lang.String

and I can't figure out why.  How does one go about debugging this kind
of thing?

Thanks!

/greg



--
Gregory F. March-=-http://www.gfm.net:81/~march-=-AIM:GfmNet

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



Re: Passing variables for logic:iterate

2003-09-15 Thread Susan Bradeen
On 09/15/2003 01:36:51 PM "Gregory F. March" wrote:

> On Sep 15, 2003, "Mainguy, Mike" <[EMAIL PROTECTED]>  wrote:
> 
> |1st, Thank you, I didn't realize the logic:Iterate tag had those two
> |properties, so you've indirectly saved me some effort.
> :
> 
> Thanks for the answers...
> 
> As a first go-round, I'm trying the bean:define suggestion from Robert.
> 
> On (I believe) the logic:iterate tag, I am getting:
> 
> [Exception in:/bf/search/results.jsp] java.lang.String
> 
> and I can't figure out why.  How does one go about debugging this kind
> of thing?
> 

I think this might be one of those cases where you go through "comment out 
parts of your JSP code and try again" iterations to find what is causing 
the error. Not very elegant, but it has worked for me. 

Susan Bradeen

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

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



Re: Passing variables for logic:iterate

2003-09-15 Thread Gregory F. March

On Sep 15, 2003, "Susan Bradeen" <[EMAIL PROTECTED]>  wrote:

 |I think this might be one of those cases where you go through "comment out 
 |parts of your JSP code and try again" iterations to find what is causing 
 |the error. Not very elegant, but it has worked for me. 

Thanks Susan, that's what I wound up doing.  Still not sure what it was
(maybe an empty string for one of my iterate properties?).

Too bad it doesn't give some form of a stack trace...

/greg

--
Gregory F. March-=-http://www.gfm.net:81/~march-=-AIM:GfmNet

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



Re: Passing variables for logic:iterate

2003-09-15 Thread Jason Lea
Gregory F. March wrote:

On Sep 15, 2003, "Susan Bradeen" <[EMAIL PROTECTED]>  wrote:

 |I think this might be one of those cases where you go through "comment out 
 |parts of your JSP code and try again" iterations to find what is causing 
 |the error. Not very elegant, but it has worked for me. 

Thanks Susan, that's what I wound up doing.  Still not sure what it was
(maybe an empty string for one of my iterate properties?).
Too bad it doesn't give some form of a stack trace...

/greg

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

You said you have these entries in your form:


But the logic:iterate tag offset and length attributes need the following:

"This can be either an integer that directly expresses the desired 
value, or the name of a JSP bean (in any scope) of type 
java.lang.Integer that defines the desired value."

You need to pass it Integer objects or put the actual values into the tag.

JSTL might be a better way with the  tag.

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