You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Rudolf Baloun <Ru...@atron.de> on 2005/11/22 10:50:26 UTC
How to add Body - Attributes ?
Hi,
i use Tapestry 4 Beta 13.
I open with a buttonclick a new window.
In some cases i want to add a body-attribute
(onload="javascript:window.print();").
How can i realize it?
Code:
public formSubmit(IRequestCycle cycle){
.......
final HttpServletResponse response =
iRequestCycle.getRequestContext().getResponse();
.....
// HERE I NEED SOMETHING LIKE:
// resonse.addBodyAttribute("onload=\"javascript:window.print();\"");
}
Any help would be nice.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: How to add Body - Attributes ?
Posted by Jesse Kuhnert <jk...@gmail.com>.
Your body is already being rendered by a component, ie I'm assuming
you have a <span jwcid="@Body" > somewhere in your project.
Define a new component, called MyBody or whatever you like, give it a
jwc file that points to the component class you would like to handle
the component, and then be sure to define a .html file to go along
with it that specifies <span jwcid="@RenderBody"> so that your
components body is written...Preferrably you will extend Body to do
this I think?
Otherwise, since Body is already a component there is absolutely no
reason why you couldn't just write the attribute directly on the <span
jwcid="@Body" onload="javascript:window.open();" > tag right? Not sure
what you are trying to do...
On 11/22/05, Rudolf Baloun <Ru...@atron.de> wrote:
> Hi,
>
> i use Tapestry 4 Beta 13.
> I open with a buttonclick a new window.
> In some cases i want to add a body-attribute
> (onload="javascript:window.print();").
> How can i realize it?
>
> Code:
>
> public formSubmit(IRequestCycle cycle){
> .......
> final HttpServletResponse response =
> iRequestCycle.getRequestContext().getResponse();
> .....
> // HERE I NEED SOMETHING LIKE:
> // resonse.addBodyAttribute("onload=\"javascript:window.print();\"");
> }
>
> Any help would be nice.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: How to add Body - Attributes ?
Posted by Ivano <i....@mclink.it>.
The following refers to Tapestry 3.0.3:
you want to use a Body and a Script component in your page.
The script defines in the referred .script file a <initialization>
block, where you can put your javascript code. This will be
automagically included in a function
that gets called by the Body component from the onload.
Have a look at documentation for the Body and Script components to get
the details.
Bye
Ivano.
Rudolf Baloun wrote:
> Hi,
>
> i use Tapestry 4 Beta 13.
> I open with a buttonclick a new window.
> In some cases i want to add a body-attribute
> (onload="javascript:window.print();").
> How can i realize it?
>
> Code:
>
> public formSubmit(IRequestCycle cycle){
> .......
> final HttpServletResponse response =
> iRequestCycle.getRequestContext().getResponse();
> .....
> // HERE I NEED SOMETHING LIKE:
> // resonse.addBodyAttribute("onload=\"javascript:window.print();\"");
> }
>
> Any help would be nice.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org