Curly braces in ${bsh; ...}

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Curly braces in ${bsh; ...}

X Gylee
I tried to use a Java method in a form widget:

<display description="${bsh: String.format(&quot;%,d&quot;, new Integer[]
{12345});}" />

However, OFBiz treated the first closing curly, which is the end of an array
initializer, as the end of the whole ${bsh: ... }, and this created an
incorrect output.
I have tried to replace the array curlies with &#x7b; and &#x7d;, but they
had no effects.
Is there a way to escape inner curlies?

I am using OFBiz from trunk rev 612332 (Jan 16, 2008).
Reply | Threaded
Open this post in threaded view
|

Re: Curly braces in ${bsh; ...}

Dimitri Unruh-2
I guess you should try this one:

&#123; for {
and
&#125; for }


Viele Grüße
Best Regards




Dimitri Unruh
Consultant AEW
Agrenon GmbH
Johanniskirchplatz 6
33615 Bielefeld
Deutschland
Fon: +49 521 5247-0
Fax: +49 521 5247-250
Mobil: +49 160 90 57 55 13


Company and Management Headquarters:
Agrenon GmbH, Johanniskirchplatz 6, 33615 Bielefeld, Deutschland, Fon: +49 521 5247-0, Fax: +49 521 5247-250, www.agrenon.com

Court Registration: Amtsgericht Bielefeld HRB 36795
Chief Executive Officer: Dirk Osterkamp

----------------------------------------------------------------------------------------------------
This e-mail may contain trade secrets or privileged, undisclosed, or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying, or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation.
----------------------------------------------------------------------------------------------------

Besuchen Sie uns!
11. SAP-Kongress fuer
Handel & Konsumgueter
13. - 14. Februar 2008
Congress Center Messe Leipzig
Reply | Threaded
Open this post in threaded view
|

Re: Curly braces in ${bsh; ...}

X Gylee
In reply to this post by X Gylee
Thx for your response Dimitri. However, as I stated before in my question, I
have tried replacing the curlies with &#x7b; and &#x7d; which are the same
as &#123; and &#125;. And they didn't work.
In the meantime, I have looked at the source code for the string parser. Up
to my understanding, it seems that the firstly-found closing-curly is
determined as the closing of the whole ${bsh: ... }, and this makes any
statement with curlies fail. Could one of the developers verify this?


From: "Dimitri Unruh" <[hidden email]>
To: [hidden email]
Date: Wed, 30 Jan 2008 09:58:13 +0100
Subject: Re: Curly braces in ${bsh; ...}
I guess you should try this one:

&#123; for {
and
&#125; for }
Reply | Threaded
Open this post in threaded view
|

Re: Curly braces in ${bsh; ...}

David E Jones

Yes, that sounds correct. This isn't a fancy Java-aware parser, just a  
simple utility for flexibility.

We are considering moving to use Apache Commons EL for these sorts of  
strings, but it wouldn't be totally backward compatible so it is  
something tabled for the future when we want to put in the effort and  
after a point where a release is complete or something so that it can  
be part of an upgrade path.

There are lots of ways to code the same thing in Java, and usually an  
alternative can be found. If not then it is always possible to write a  
static Java method to take care of the details.

Please remember that this "feature" is meant for limited use  
convenience and it is not really meant to be the way data is prepared  
or gathered.

-David


On Jan 30, 2008, at 7:24 PM, X Gylee wrote:

> Thx for your response Dimitri. However, as I stated before in my  
> question, I
> have tried replacing the curlies with &#x7b; and &#x7d; which are  
> the same
> as &#123; and &#125;. And they didn't work.
> In the meantime, I have looked at the source code for the string  
> parser. Up
> to my understanding, it seems that the firstly-found closing-curly is
> determined as the closing of the whole ${bsh: ... }, and this makes  
> any
> statement with curlies fail. Could one of the developers verify this?
>
>
> From: "Dimitri Unruh" <[hidden email]>
> To: [hidden email]
> Date: Wed, 30 Jan 2008 09:58:13 +0100
> Subject: Re: Curly braces in ${bsh; ...}
> I guess you should try this one:
>
> &#123; for {
> and
> &#125; for }