Re: Consistency?

2013-06-27 Thread Chris Pratt
Try using the second form in all three spots.  I believe it should work.
  (*Chris*)


On Thu, Jun 27, 2013 at 1:38 PM, Eric Lentz ericle...@outfastsource.comwrote:

 My questions are: Is there a better place to discuss this? Could this ever
 be enhanced?

 The issue:
 I'd love to see more consistency in the way we must access indexed values
 when iterating. Consider the example below and note that there are 3
 distinct ways in which I must access the index value. I can't tell you how
 many times this has caused errors (and wasted time). Any chance that this
 could be revised in some later version of Struts so there is just 1 way to
 access in every attribute of every Struts element?

 s:iterator value=foos status=stat 

 s:textfield name=foos[%{#stat.index}].aString
 value=%{foos[#stat.index].aString} /

 s:property value=foos[#stat.index].aString /

 /s:iterator

 Summary:
 1: foos[%{#stat.index}].aString
 2: %{foos[#stat.index].aString}
 3: foos[#stat.index].aString

 Anyone else grieved by this or am I doing something wrong?

 - Eric



Re: Consistency?

2013-06-27 Thread Dave Newton
On Thu, Jun 27, 2013 at 4:38 PM, Eric Lentz  ericle...@outfastsource.com
wrote:

 s:textfield name=foos[%{#stat.index}].aString
 value=%{foos[#stat.index].aString} /


Here you're doing to explicitly different things:

1. Provide a name (a string) with an embedded expression evaluation.
2. Execute an OGNL expression to retrieve a value.

Normalizing these things to be the same thing makes no sense, because
they're different things and must be treated as such. How would you propose
to make them the same but end up with different results?


 s:property value=foos[#stat.index].aString /


Here you're choosing not to explicitly wrap the OGNL expression in %{}.

IIRC there's an option to force the use of %{}, but  this is the same thing
as in the value attribute above, you'd just decided not to wrap it in the
OGNL escape.

At best there are two different things, and I'm not really sure how they
could be the same thing if they're used manually as values.

The *actual* solution is to provide indexed tags.

Dave


Re: Consistency?

2013-06-27 Thread Eric Reed
I agree, you should be using indexed tags, and they are two different things as 
Dave has stated.


 Dave Newton davelnew...@gmail.com 6/27/2013 5:19 PM 
On Thu, Jun 27, 2013 at 4:38 PM, Eric Lentz  ericle...@outfastsource.com
wrote:

 s:textfield name=foos[%{#stat.index}].aString
 value=%{foos[#stat.index].aString} /


Here you're doing to explicitly different things:

1. Provide a name (a string) with an embedded expression evaluation.
2. Execute an OGNL expression to retrieve a value.

Normalizing these things to be the same thing makes no sense, because
they're different things and must be treated as such. How would you propose
to make them the same but end up with different results?


 s:property value=foos[#stat.index].aString /


Here you're choosing not to explicitly wrap the OGNL expression in %{}.

IIRC there's an option to force the use of %{}, but  this is the same thing
as in the value attribute above, you'd just decided not to wrap it in the
OGNL escape.

At best there are two different things, and I'm not really sure how they
could be the same thing if they're used manually as values.

The *actual* solution is to provide indexed tags.

Dave


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Consistency?

2013-06-27 Thread Eric Lentz
Good discussion. Thanks guys. Some replies:

Chris: No joy on using the second form on all.
Dave:
 How would you propose to make them the same but end up with different
results?

I understand what you're saying and get it. You're clear depiction of the
separation of tasks is helpful. Maybe I'm just not a fan of building an
expression within an attribute and it has been confusing for those for whom
I've introduced Struts 2. I'd rather that OGNL was there to figure out how
to access beans by way of getter/setter and Struts know that if I put
foos[n].aString in a value tag that I actually want a value (getters)
versus putting the same thing in the name tag that I'm intending to write
to fields (setters). That's what I want a framework for: To figure things
out for me so I don't have to work (or think) so hard. I've been using
Struts 2 for years and only just recently realized that # referred to a
context! Maybe I'm just dense, but it has taken awhile to really grasp all
the moving parts.

It's a trade-off. Part of me still wants the power of OGNL (though I don't
find I use more than even a fraction of its power), but if I had to pick, I
think I'd go for simplicity for the typical use case which I believe I'm
illustrating.

Dave/Eric R:
What do you mean by indexed tags?

- Eric

On Thu, Jun 27, 2013 at 6:04 PM, Eric Reed ere...@mail.nysed.gov wrote:

 I agree, you should be using indexed tags, and they are two different
 things as Dave has stated.


  Dave Newton davelnew...@gmail.com 6/27/2013 5:19 PM 
 On Thu, Jun 27, 2013 at 4:38 PM, Eric Lentz  ericle...@outfastsource.com
 wrote:

  s:textfield name=foos[%{#stat.index}].aString
  value=%{foos[#stat.index].aString} /
 

 Here you're doing to explicitly different things:

 1. Provide a name (a string) with an embedded expression evaluation.
 2. Execute an OGNL expression to retrieve a value.

 Normalizing these things to be the same thing makes no sense, because
 they're different things and must be treated as such. How would you propose
 to make them the same but end up with different results?


  s:property value=foos[#stat.index].aString /
 

 Here you're choosing not to explicitly wrap the OGNL expression in %{}.

 IIRC there's an option to force the use of %{}, but  this is the same thing
 as in the value attribute above, you'd just decided not to wrap it in the
 OGNL escape.

 At best there are two different things, and I'm not really sure how they
 could be the same thing if they're used manually as values.

 The *actual* solution is to provide indexed tags.

 Dave


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org