You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Daniel Jue <te...@gmail.com> on 2007/06/04 23:10:11 UTC

[T5.0.5 SNAPSHOT] Proper way to inject Assets like CSS

Hi, this was working this morning, until the latest and greatest
snapshot came out today.   How should we go about injecting a css file
now?

I had this:

	@Inject
	@Path("context:css/IEISStyle.css")
	private Asset style;



<head>
<link rel="stylesheet" type="text/css" t:id="style" href="prop:style"/>
</head>

And it was working fine.

But now I get this:

org.apache.tapestry.ioc.internal.util.TapestryException
Embedded component 'style' has no type. You should specify a type in
the component template, or define the component inside class
mil.army.oacsim.IEIS2.components.border using the @Component
annotation on a private instance variable.

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


Re: [T5.0.5 SNAPSHOT] Proper way to inject Assets like CSS

Posted by Howard Lewis Ship <hl...@gmail.com>.
On 6/4/07, Daniel Jue <te...@gmail.com> wrote:
>
> Thank you Howard,
> that works like a charm!
>
> FWIW,
> Removing the t:id parameters and keeping
>
> href="prop:style"


That will work if there's a t:type, but not for ordinary elements.


seemed to work for the style sheet, but not for the images.
>
> Changed all the "prop:abc" to "${abc}" and now everything is working fine.
>
>
> Daniel
>
> On 6/4/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> > Because expansions are now supported inside attributes (of non-component
> > elements), the need for the Any components has gone away.  Now if you
> > specified a t:id you must define the type (it doesn't default to Any).
> >
> > You can rewrite your template as:
> >
> > <link rel="stylesheet" type="text/css"  href="${style}"/>
> >
> > On 6/4/07, Daniel Jue <te...@gmail.com> wrote:
> > >
> > > Hi, this was working this morning, until the latest and greatest
> > > snapshot came out today.   How should we go about injecting a css file
> > > now?
> > >
> > > I had this:
> > >
> > >         @Inject
> > >         @Path("context:css/IEISStyle.css")
> > >         private Asset style;
> > >
> > >
> > >
> > > <head>
> > > <link rel="stylesheet" type="text/css" t:id="style"
> href="prop:style"/>
> > > </head>
> > >
> > > And it was working fine.
> > >
> > > But now I get this:
> > >
> > > org.apache.tapestry.ioc.internal.util.TapestryException
> > > Embedded component 'style' has no type. You should specify a type in
> > > the component template, or define the component inside class
> > > mil.army.oacsim.IEIS2.components.border using the @Component
> > > annotation on a private instance variable.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> >
> > --
> > Howard M. Lewis Ship
> > TWD Consulting, Inc.
> > Independent J2EE / Open-Source Java Consultant
> > Creator and PMC Chair, Apache Tapestry
> > Creator, Apache HiveMind
> >
> > Professional Tapestry training, mentoring, support
> > and project work.  http://howardlewisship.com
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

Re: [T5.0.5 SNAPSHOT] Proper way to inject Assets like CSS

Posted by Daniel Jue <te...@gmail.com>.
Thank you Howard,
that works like a charm!

FWIW,
Removing the t:id parameters and keeping

href="prop:style"

seemed to work for the style sheet, but not for the images.

Changed all the "prop:abc" to "${abc}" and now everything is working fine.


Daniel

On 6/4/07, Howard Lewis Ship <hl...@gmail.com> wrote:
> Because expansions are now supported inside attributes (of non-component
> elements), the need for the Any components has gone away.  Now if you
> specified a t:id you must define the type (it doesn't default to Any).
>
> You can rewrite your template as:
>
> <link rel="stylesheet" type="text/css"  href="${style}"/>
>
> On 6/4/07, Daniel Jue <te...@gmail.com> wrote:
> >
> > Hi, this was working this morning, until the latest and greatest
> > snapshot came out today.   How should we go about injecting a css file
> > now?
> >
> > I had this:
> >
> >         @Inject
> >         @Path("context:css/IEISStyle.css")
> >         private Asset style;
> >
> >
> >
> > <head>
> > <link rel="stylesheet" type="text/css" t:id="style" href="prop:style"/>
> > </head>
> >
> > And it was working fine.
> >
> > But now I get this:
> >
> > org.apache.tapestry.ioc.internal.util.TapestryException
> > Embedded component 'style' has no type. You should specify a type in
> > the component template, or define the component inside class
> > mil.army.oacsim.IEIS2.components.border using the @Component
> > annotation on a private instance variable.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Howard M. Lewis Ship
> TWD Consulting, Inc.
> Independent J2EE / Open-Source Java Consultant
> Creator and PMC Chair, Apache Tapestry
> Creator, Apache HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
>

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


Re: [T5.0.5 SNAPSHOT] Proper way to inject Assets like CSS

Posted by Howard Lewis Ship <hl...@gmail.com>.
Because expansions are now supported inside attributes (of non-component
elements), the need for the Any components has gone away.  Now if you
specified a t:id you must define the type (it doesn't default to Any).

You can rewrite your template as:

<link rel="stylesheet" type="text/css"  href="${style}"/>

On 6/4/07, Daniel Jue <te...@gmail.com> wrote:
>
> Hi, this was working this morning, until the latest and greatest
> snapshot came out today.   How should we go about injecting a css file
> now?
>
> I had this:
>
>         @Inject
>         @Path("context:css/IEISStyle.css")
>         private Asset style;
>
>
>
> <head>
> <link rel="stylesheet" type="text/css" t:id="style" href="prop:style"/>
> </head>
>
> And it was working fine.
>
> But now I get this:
>
> org.apache.tapestry.ioc.internal.util.TapestryException
> Embedded component 'style' has no type. You should specify a type in
> the component template, or define the component inside class
> mil.army.oacsim.IEIS2.components.border using the @Component
> annotation on a private instance variable.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

Re: [T5.0.5 SNAPSHOT] Proper way to inject Assets like CSS

Posted by Daniel Jue <te...@gmail.com>.
Sorry, my initial post was misleading.  It's not just CSS files, it's
all the injected Assets I have (images, etc).

For code like this, T5 also gives an error saying that I need to give a type.

@Inject
@Path("context:images/OACSIMLogo_Trans_DS2.jpg")
private Asset ieislogo;

<img t:id="ieislogo" src="prop:ieislogo" />

Is this related to the deprecation of the Any component, because that
was implicitly created for us in the past?

Daniel


On 6/4/07, Daniel Jue <te...@gmail.com> wrote:
> Hi, this was working this morning, until the latest and greatest
> snapshot came out today.   How should we go about injecting a css file
> now?
>
> I had this:
>
>         @Inject
>         @Path("context:css/IEISStyle.css")
>         private Asset style;
>
>
>
> <head>
> <link rel="stylesheet" type="text/css" t:id="style" href="prop:style"/>
> </head>
>
> And it was working fine.
>
> But now I get this:
>
> org.apache.tapestry.ioc.internal.util.TapestryException
> Embedded component 'style' has no type. You should specify a type in
> the component template, or define the component inside class
> mil.army.oacsim.IEIS2.components.border using the @Component
> annotation on a private instance variable.
>

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