> This seems not to work, so I dropped the ! to see the variable itself. The
> textt field gives
> 
> $!data.getRequest().getSession().getAttribute(
> 
> I assume velocity has problems with the "", because it seems to stop
> reading

The reason you see it like that is because
$data.getRequest().getSession().getAttribute("formula") is returning null or
is an invalid statement.  The value that is placed in the <input> tag's
"value" attribute is literally:

value="$data.getRequest().getSession().getAttribute("formula")"

This causes the form field to display incorrectly because of invalidly
nested double quotes (").  If you view the source you will see the <input>
tag in its entirety:

<input type="text"
value="$data.getRequest().getSession().getAttribute("formula")">

Also, you can clean this code up by directly accessing the HttpSession
object through RunData without accessing the HttpRequest first.

$data.getSession() or in a more velocity-correct manner $data.Session


Scott



> -----Original Message-----
> From: Stefan Kuhn [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 27, 2002 6:09 AM
> To: Jetspeed Users List
> Subject: Calling method with parameter in Velocity
> 
> Hi everybody,
> I've got a velocity portlet. This portlet should contain RunData as $data.
> I
> want to use this to give a session attribute to a text field:
> 
> value="$!data.getRequest().getSession().getAttribute("formula")"
> 
> This seems not to work, so I dropped the ! to see the variable itself. The
> textt field gives
> 
> $!data.getRequest().getSession().getAttribute(
> 
> I assume velocity has problems with the "", because it seems to stop
> reading
> there. Is there any way to escape the "" ? According to velocity doc, this
> should not be necessary, but ... it's not working
> Thanks for answers
> Stefan
> 
> --
> To unsubscribe, e-mail:   <mailto:jetspeed-user-
> [EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:jetspeed-user-
> [EMAIL PROTECTED]>

Reply via email to