[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tapestry-user
Subject:    Re: Should @Insert encode whitespace?
From:       andyhot <andyhot () di ! uoa ! gr>
Date:       2007-01-30 22:47:52
Message-ID: 45BFCB18.9060509 () di ! uoa ! gr
[Download RAW message or body]

http://tapestry.apache.org/tapestry4.1/components/general/insert.html

Use the format parameter and provide it with a SpaceToNBSPFormat (that 
you also create)

Must leave raw to true.

Wes Bramhall wrote:
> I have an app that displays a list of filenames to the user. I'm looping
> over a list of File objects and displaying the names using an insert
> component. Here's a barebones example:
>
> <files jwcid="@For" source="ognl:files" value="ognl:loopFile">
> 	<filename jwcid="@Insert" value="ognl:loopFile.name" /><br />
> </files>
>
> It is possible to have filenames like "A  B", "A   B", and "A    B".
> Sent to the insert component, they get rendered as "A  B", "A   B", and
> "A    B" in the HTML source but end up displayed as "A B", "A B", and "A
> B" on the screen. Setting the raw attribute to true doesn't change this
> behavior. Would it be reasonable to encode consecutive spaces as &nbsp;?
> Does anyone have a better idea?
>
>
> For now I'll have to switch to the below code:
>
> <files jwcid="@For" source="ognl:files" value="ognl:loopFile">
> 	<filename jwcid="@Insert" raw="ognl:true" value="ognl:safeName"
> /><br />
> </files>
>
> public String getSafeName()
> {
> 	return getLoopFile().getName().replace(" ", "&nbsp;");
> }
>
> Thanks,
> -Wes
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
>   


-- 
Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic