Jijoe Vurghese wrote:
> <johan <at> zoom.nu> writes:
>> In my page class I populate 'mailBody' with the text to display in
>>the area and that does not get > converted to >
>
> Hmm...that is strange. The renderComponent method of the TextArea component
> packaged with Tapestry distribution (I'm on version 3.0.3) uses
> IMarkupWriter.print(value); on line# 77 [http://tinyurl.com/d3tfs].
> The Javadoc for IMarkupWriter.print(String) says this method, in turn, invokes
> invokes print(char[], int, int). The latter form of print method states it
> does
> escape "unsafe" characters [http://tinyurl.com/7r985].
>
> And this is the behavior I see when I view the source of the rendered HTML
> page.
>
> Actually, I didn't opt for this behavior by choice. It came with the built-in
> TextArea component.
>
> However, per Howard's suggestion [http://tinyurl.com/ajx6l], I ended up
> creating
> a customized TextArea (HTMLSafeTextArea) that decodes character entities like
> '>' back into '>' when the form rewindes - thus restoring symmetry.
>
> Thanks,
>
> Jijoe
I finally got around to look at this again.
The text that is inserted in the text area is quoted in the HTML (at least the
'>' character which I looked for). This is how it must be, since the text is
not markup it has to be quoted. However, when the browser (IE and firefox)
renders the area the characters are converted back, so I do not see > - I
see a '>' character.
When the area is submitted the string I retrieve also does not contain quoted
characters, I guess that is where you run into problems. The only place I see
quoted characters is if I view page source. I guess we are using the text area
differently or perhaps operate on the values in different steps in the life
cycle.
I gather that you have already solved your problem but perhaps it would be
interesting to compare with how I did it. My application is a webmail so that
is why things are called 'mail' this and that.
I have a page where you can view a mail and then reply to it. When you reply
from the view page it:
1) Gets the mail body (from the mail-server) and inserts a '>' character at the
beginning of every line.
2) It then retrieves the next page in the flow which is a compose mail page.
3) It inserts the quoted mail body string on that page by calling setMailBody
(a property of the compose page).
4) Activates the compose page (cycle.activate)
Here is how the compose mail page is specified.
-- Page specification --
<property-specification name="mailBody" type="java.lang.String"/>
<component id="bodyField" type="TextArea">
<binding name="value" expression="mailBody"/>
</component>
-- Template --
<form jwcid="sendMailForm">
<textarea
jwcid="bodyField"
rows="15"
cols="75"
/>
</form>
This is what the debugger shows me when I step the pages:
Input to textarea (the "reply"-string from step 1 above).
body= "\r\n----- Nested part ----\r\n>and this message is in plain text"
The page source looks like this:
<textarea name="bodyField" cols="75" rows="15">
----- Nested part ----
>and this message is in plain text
</textarea>
This is rendered by the browser as HTML-textarea with the following content:
----- Nested part ----
>and this message is in plain text
When the form is submitted I retrive the contents from textarea by calling
getMailBody() on the page class. This is what I get back:
body= "\r\n----- Nested part ----\r\n>and this message is in plain text"
So however the TextArea component works it works for me :-)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]