You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by BrettS <br...@gmail.com> on 2010/02/22 11:46:54 UTC
Disable HTML Encoding In Widgets
Hi,
I have a problem with OFBiz doing HTML encoding of characters that I don't
want encoded. Specifically, OFBiz is replacing "<" and ">" with: < >
(encoded strings) in a widget.
Can someone tell me how to fix this issue please? Details as follows.
I have the following snippet of code in a file called browser.ftl file:
----------------------------------------
<html>
<head>
${browserProfile.metaTag}
...
----------------------------------------
${browserProfile.metaTag} *should* return a string in this format:
<meta name="foo" content="foo2"/>
If I map the browser.ftl file in controller.xml via a widget as shown below:
<view-map name="browser" type="screen"
page="component://ecommerce/widget/BrowserScreens.xml#browser"/>
then unfortunately, OFBiz will replace "<" and ">" with encoded strings.
However, if (as a test) I map the browser.ftl file *directly* as shown
below:
<view-map name="browser" type="ftl" page="browser.ftl"/>
Then, OFBiz does *not* encode the string and I get the correct output.
Any suggestions how I can stop my widget encoding these characters?
Regards
Brett S
P.S. this is what BrowserScreens.xml looks like.
----------------------------------------
<screen name="CommonDecorator">
<section>
<widgets>
<platform-specific><html><html-template
location="component://ecommerce/webapp/ecommerce/browser/includes/header.ftl"/></html></platform-specific>
<decorator-section-include name="body"/>
<platform-specific><html><html-template
location="component://ecommerce/webapp/ecommerce/browser/includes/footer.ftl"/></html></platform-specific>
</widgets>
</section>
</screen>
<screen name="browser">
<section>
<widgets>
<decorator-screen name="CommonDecorator">
<decorator-section name="body">
<platform-specific><html><html-template
location="component://ecommerce/webapp/ecommerce/browser.ftl"/></html></platform-specific>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
----------------------------------------
--
View this message in context: http://n4.nabble.com/Disable-HTML-Encoding-In-Widgets-tp1564243p1564243.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.
Re: Disable HTML Encoding In Widgets
Posted by BrettS <br...@gmail.com>.
That did the trick.
Thanks Scott!
Regards
Brett S
--
View this message in context: http://n4.nabble.com/Disable-HTML-Encoding-In-Widgets-tp1564243p1565456.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.
Re: Disable HTML Encoding In Widgets
Posted by Scott Gray <sc...@hotwaxmedia.com>.
Hi Brett,
You need to wrap the variable in the following method:
${StringUtil.wrapString(browserProfile.metaTag)}
Regards
Scott
HotWax Media
http://www.hotwaxmedia.com
On 22/02/2010, at 3:46 AM, BrettS wrote:
>
> Hi,
>
> I have a problem with OFBiz doing HTML encoding of characters that I don't
> want encoded. Specifically, OFBiz is replacing "<" and ">" with: < >
> (encoded strings) in a widget.
>
> Can someone tell me how to fix this issue please? Details as follows.
>
> I have the following snippet of code in a file called browser.ftl file:
> ----------------------------------------
> <html>
> <head>
> ${browserProfile.metaTag}
> ...
> ----------------------------------------
> ${browserProfile.metaTag} *should* return a string in this format:
> <meta name="foo" content="foo2"/>
>
>
> If I map the browser.ftl file in controller.xml via a widget as shown below:
> <view-map name="browser" type="screen"
> page="component://ecommerce/widget/BrowserScreens.xml#browser"/>
>
> then unfortunately, OFBiz will replace "<" and ">" with encoded strings.
>
> However, if (as a test) I map the browser.ftl file *directly* as shown
> below:
> <view-map name="browser" type="ftl" page="browser.ftl"/>
>
> Then, OFBiz does *not* encode the string and I get the correct output.
>
> Any suggestions how I can stop my widget encoding these characters?
>
> Regards
>
> Brett S
>
> P.S. this is what BrowserScreens.xml looks like.
>
>
> ----------------------------------------
> <screen name="CommonDecorator">
> <section>
> <widgets>
> <platform-specific><html><html-template
> location="component://ecommerce/webapp/ecommerce/browser/includes/header.ftl"/></html></platform-specific>
>
> <decorator-section-include name="body"/>
>
> <platform-specific><html><html-template
> location="component://ecommerce/webapp/ecommerce/browser/includes/footer.ftl"/></html></platform-specific>
> </widgets>
> </section>
> </screen>
>
> <screen name="browser">
> <section>
> <widgets>
> <decorator-screen name="CommonDecorator">
> <decorator-section name="body">
> <platform-specific><html><html-template
> location="component://ecommerce/webapp/ecommerce/browser.ftl"/></html></platform-specific>
> </decorator-section>
> </decorator-screen>
> </widgets>
> </section>
> </screen>
>
> ----------------------------------------
> --
> View this message in context: http://n4.nabble.com/Disable-HTML-Encoding-In-Widgets-tp1564243p1564243.html
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.