You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Fidel Chavarria <fi...@gmail.com> on 2007/05/03 21:03:11 UTC

[T5] How to call Assets in component template

I want to use the asset component instead of  <link rel="stylesheet"
type="text/css" media="screen" href="css/screen.css"/>

what i should do?

********My component class ******
package net.caimito.savila.tapestry.components;

import org.apache.tapestry.Asset;
import org.apache.tapestry.annotations.Inject;

/**
 * @author  mailto:fidel@caimito.net Fidel Chavarria 
 *
 */
public class ActionLayout {

	@Inject("context:css/screen.css")
	private Asset cssFile;

	public Asset getCssFile() {
		return cssFile;
	}
}


********** component Template ******

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<link rel="stylesheet" type="text/css" media="screen"
href="css/screen.css"/>
</head>
-- 
View this message in context: http://www.nabble.com/-T5--How-to-call--Assets-in-component-template-tf3688366.html#a10311227
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: [T5] How to call Asserts in component template

Posted by Robert Zeigler <ro...@scazdl.org>.
Make link an "any" component.  Then change href to be:
href="prop:cssFile"

Tapestry will "do the right thing" for you.
Or, more completely:
<link t:type="Any" href="prop:cssFile" .... />

Robert


On May 3, 2007, at 5/32:03 PM , Fidel Chavarria wrote:

>
> I want to use the asset component instead of  <link rel="stylesheet"
> type="text/css" media="screen" href="css/screen.css"/>
>
> what i should do?
>
> ********My component class ******
> package net.caimito.savila.tapestry.components;
>
> import org.apache.tapestry.Asset;
> import org.apache.tapestry.annotations.Inject;
>
> /**
>  * @author  mailto:fidel@caimito.net Fidel Chavarria
>  *
>  */
> public class ActionLayout {
>
> 	@Inject("context:css/screen.css")
> 	private Asset cssFile;
>
> 	public Asset getCssFile() {
> 		return cssFile;
> 	}
> }
>
>
> ********** component Template ******
>
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <head>
> <link rel="stylesheet" type="text/css" media="screen"
> href="css/screen.css"/>
> </head>
> --  
> View this message in context: http://www.nabble.com/-T5--How-to- 
> call--Asserts-in-component-template-tf3688366.html#a10311227
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


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