You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Giridhar reddy <gi...@gmail.com> on 2013/08/23 04:04:26 UTC

Need help: in displaying text with html character entities and new line

Hello,

I have the input string which contains "price range<10-100>\n least price =
20"

I need the output as:
price range<10-100>
least price=20

I tried jwcid=@InsertText. But, it is still printing the output in one line
as
"price range<10-100>\nleastprice=20"

If I keep raw=true, I am not getting replaced < with &lt. again, output is
not coming as expected.

Any ideas over this how to get the desired output.

Thanks!
Giri

Re: Need help: in displaying text with html character entities and new line

Posted by Giridhar reddy <gi...@gmail.com>.
Thank you for the reply.

If I use raw=true, I again has to replace <'> in my input string as well.

I found a way to make insert text to work for my \n.  I replaced all my \n
in my input string with java.lang.System.getProperty("line.separator").

After the above replacement, InsertText worked for me (it replaced \n with
<br/>. After this replacement, I used raw=false to get the desired output.


On Fri, Aug 23, 2013 at 5:07 PM, Thiago H de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Thu, 22 Aug 2013 23:04:26 -0300, Giridhar reddy <
> giri.kailasam@gmail.com> wrote:
>
>  Hello,
>>
>
> Hi!
>
>
>  I have the input string which contains "price range<10-100>\n least price
>> = 20"
>>
>> I need the output as:
>> price range<10-100>
>> least price=20
>>
>> I tried jwcid=@InsertText. But, it is still printing the output in one
>> line
>> as
>> "price range<10-100>\nleastprice=20"
>>
>> If I keep raw=true, I am not getting replaced < with &lt. again, output
>> is not coming as expected.
>>
>> Any ideas over this how to get the desired output.
>>
>
> Read the component documentation: http://tapestry.apache.org/**
> tapestry4.1/components/**general/inserttext.html<http://tapestry.apache.org/tapestry4.1/components/general/inserttext.html>.
> Look at the raw parameter: when set to true, it won't replace characters.
> The line break handling will need to be done by yourself, something that an
> input.replaceAll("\n", "<br/>") should solve.
>
> --
> Thiago H. de Paula Figueiredo
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<us...@tapestry.apache.org>
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Need help: in displaying text with html character entities and new line

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 22 Aug 2013 23:04:26 -0300, Giridhar reddy  
<gi...@gmail.com> wrote:

> Hello,

Hi!

> I have the input string which contains "price range<10-100>\n least  
> price = 20"
>
> I need the output as:
> price range<10-100>
> least price=20
>
> I tried jwcid=@InsertText. But, it is still printing the output in one  
> line
> as
> "price range<10-100>\nleastprice=20"
>
> If I keep raw=true, I am not getting replaced < with &lt. again, output  
> is not coming as expected.
>
> Any ideas over this how to get the desired output.

Read the component documentation:  
http://tapestry.apache.org/tapestry4.1/components/general/inserttext.html.  
Look at the raw parameter: when set to true, it won't replace characters.  
The line break handling will need to be done by yourself, something that  
an input.replaceAll("\n", "<br/>") should solve.

-- 
Thiago H. de Paula Figueiredo

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