Issue Details (XML | Word | Printable)

Key: WW-808
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Claus Ibsen
Reporter: John Patterson
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
WebWork

ParamTag does not convert to string

Created: 15/Jul/05 10:59 AM   Updated: 17/Mar/06 11:44 AM
Component/s: Views
Affects Version/s: 2.1.7
Fix Version/s: 2.2.2


 Description  « Hide
The ParamTag does this



                    Object value = findValue(valueAttr);

instead of this



                    Object value = findValue(valueAttr, String.class);

which means that it bypasses your custom type converters.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Alexandru Popescu added a comment - 16/Feb/06 07:10 PM
Is this still an issue? I cannot find that code in ParamTag. I see something in that type into Param, but it looks oke to me.

./alex
--
.w( the_mindstorm )p.

tm_jee added a comment - 16/Feb/06 10:20 PM
If not mistaken

<param>someThing</param> ----- (1)

<param value="anotherThing"/> ---- (2)

In (1), it would be evaluated to the stack as String while in (2) it will be evaluated to the stack as object.

I guess, if one needs it as string then (1) could be used, it is possible to have eg.

<param>hello %{user.name}</param>

where user.name will be evaluated to the stack and its string value appended.

If it works this way, i don't think it is a bug. :-)

Claus Ibsen added a comment - 26/Feb/06 03:38 PM
@tm

Should both situations 1+2 not work excatly the same way? Otherwise users will get confued, I for sure would.
And I guess %{ ... } expression should always be evaluated.

tm_jee added a comment - 05/Mar/06 04:11 AM
Hi Claus,

Currently they are not working in the same way actually. If we change them it might break some components.... but then we have our little test case to check against.... :-)

> And I guess %{ ... } expression should always be evaluated.

I think it is evaluated in both case, just that in once case it is evaluated to a String while the other to object.

I am not sure if we should change the current behaviour... maybe we could post this in the forum and see what others think about it. What do you think?

Claus Ibsen added a comment - 05/Mar/06 04:45 AM
Hi Toby

Yeah I agree that breaking old components is dangerous. And does the unit test really cover all these situations? WW code coverage is < 40%.

Yes I would be nice the hear others opinions and if anyone had a real use-case with this situation.

And I really think the two different situations should be documented in the javadoc for the .class and at wiki docs.

For a user this could be a hard defect to track down.

Rainer Hermanns added a comment - 16/Mar/06 12:40 PM
Toby, Claus,

what are your suggestions on this?
My expectation would be, that both usages behave similar or it should be clearly outlined in the docs (wiki AND javadocs) pointing out the difference...

What do you think?

Claus Ibsen added a comment - 17/Mar/06 03:05 AM
Rainer

As I have little real life WW experience I can only voice as an outsider.
I would expect the tags to work excatly the same way using both usages. It's just a preference how you write XML.

If we have a migration guide we could write that this behavior is changed.

As the 2.2.2 release is out of the door soon, we could keep as it is and write comments in the javadoc, wiki about this odd behavior.
And for 2.3 we could fix it.

Claus Ibsen added a comment - 17/Mar/06 09:51 AM
Okay I have updated Param.java with a note section about the two situations outlined by Toby (1) and (2).

Claus Ibsen added a comment - 17/Mar/06 11:18 AM
Updatede tag documentation.

If we need to align the tag as a consistent behaviour for both situations we should reopen this and schedule it for a 2.3 or future version where we need to give 3rd party tag developers the change to validate their tags if we change it in WW.

tm_jee added a comment - 17/Mar/06 11:44 AM
Oppss... sorry late reply....

Thx for handling this issue Claus.

I prefered it to be the way it is now, document this behaviour as Claus already did.

I think there might be both behaviour have its particular usage, if we want to have a param that is a string, it makes sense to use <param>...</param>, anything in between that's enclosed with %{} will be evaluated and its toString() called. On the other hand, if we want an object, we could used the value attribute. I guess what i'm trying to say is that both way of using param have their own usage.

Of course this is just my 2 cents :-)