Stefan:
I think Scott is right. You can't next quotation marks like brackets.
So, I see three ways to solve your problem:
1.) You can use the single quotation marks:
value="$!data.getRequest().getSession().getAttribute('formula')"
2.) You can escape the nested quotation marks:
value="$!data.getRequest().getSession().getAttribute(\"formula\")"
3.) You can evaluate this expression in advance:
#set ( $value =
$!data.getRequest().getSession().getAttribute("formula") )
value="$value"
I hope this works. I have to admit that I tested none of these three
solutions.
good luck
Matthias Wimmer
-----Original Message-----
From: Weaver, Scott [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 27, 2002 9:31 AM
To: 'Jetspeed Users List'
Subject: RE: Calling method with parameter in Velocity
> 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]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>