struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <davelnew...@gmail.com>
Subject Re: "/" character an invalid key?
Date Thu, 07 Jul 2011 12:56:14 GMT
My first guess would be that OGNL is trying to evaluate it, although
since it's a string, not sure that makes any sense.

I don't know how your DB is laid out or how what sounds like ad-hoc
structures are being created, but is a text ID really the only thing
you have available?

Dave

On Thursday, July 7, 2011, Eric Lentz <Eric.Lentz@sherwin.com> wrote:
> I'm using Struts 2.2.1.
>
> I have a use case whereby form fields are generated dynamically and some
> of them are select lists. Since it is a database driven list of fields,
> the labels presented for the user are also used as keys for the map that
> the form posts back to. Using alternate keys is not desirable.
>
> That's brief background to attempt at justification for what I'm doing. To
> provide a simple example, this is the equivalent to one of the select
> lists that gets created:
>         <s:select list="#{'Interior':'Interior','Exterior':'Exterior'}"
>                           name='foo["Interior/Exterior"]'
>                           headerKey="-1"
>                           headerValue="Select One" />
>
> Interior/Exterior, as a key, seems to be an issue. Using that on a test
> form and a test action that has the following:
>
>                 if(foo == null) {
>                         bar = "Foo is null";
>                 }
>                 else if(foo.containsKey("Interior/Exterior")) {
>                         bar = foo.get("Interior/Exterior");
>                 }
>                 else {
>                         bar = "Not Found";
>                 }
>
> bar always gets assigned "Foo is null".
>
> Any ideas why the "/" character contained in a key would make it invalid?
> I tested using that exact key in a map and Java is fine with it. Since foo
> is null, it appears to not be passed at all. I tried various escaping
> (e.g., "\/"), but it still comes back null when "/" is in the key.
>
> The page, action and configuration I used to test this is here:
> http://www.chopapp.com/#32ycxelq
>

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


Mime
View raw message