You can add components which are in the <head>.

MyPage.html:
<html>
  <head>
     <link wicket:id="favicon" ..../>
  ...
</head>
.....

MyPage.java:
....
add(new Favicon("favicon"));
....


Favicon.java:

public class Favicon extends WebComponent {

   public Favicon(String id){
     super(id);
   }

   public void onInitialize()
  {
     super.onInitialize();

     add(AttributeModifier.replace("href", generateHref(getPage())))
  }
.....
}


On Sun, Nov 25, 2012 at 7:08 PM, Tim Van Meerbeeck <tim...@gmail.com> wrote:

> Rob,
>
> This is a solution if you want to achieve this! I was just looking into the
> possibility because this is a pretty rare scenario. The favico was designed
> to have a bookmark to a site and have an icon in your favorites so you can
> quickly find the right bookmark. So the scenario to load this dynamically
> (for example for every different bookmarkable page in a wicket application,
> a different favico) is not so common.
>
> Though I had expected to find something in the standard wicket but yeah the
> scenario is quite uncommon. And with overriding this was implemented by
> you.
>
>
> Kind regards,
>
> Tim Van Meerbeeck
>
>
> 2012/11/25 Rob Schroeder <schrdrr...@gmail.com>
>
> > Hi Tim,
> >
> > I ran into the same question a couple of days ago, and in what maybe
> > constitutes overkill for a simpler solution I didn't see, I looked at
> > CssResourceReference and reused as much of the code as seemed to be
> > necessary to make a FaviconResourceReference:
> >
> >
> https://docs.google.com/uc?export=download&id=0B3dKFXxMXAj1dWpCVUJqYzNJYUk
> >
> > With it, you can put your favicon.ico where you said you would, create a
> >
> >   FaviconResourceReference feedReaderFavicon = new
> FaviconResourceReference
> >       (FeedReader.class, "resources/favicon.ico");
> >
> > and add
> >
> >
> >
> response.render(FaviconReferenceHeaderItem.forReference(feedReaderFavicon));
> >
> > to your page's (overridden) renderHead method, just as you would with a
> > page-specific CSS resource.
> >
> > Cheers,
> > Robert
> >
> >
> > On Sat, 24 Nov 2012 21:36:14 +0100, Tim Van Meerbeeck wrote:
> >
> > > Hi
> > >
> > > I got a question about wicket 6 and adding a favicon.ico:
> > >
> > > I am trying to use a StringHeaderItem but I want the favicon.ico to be
> in
> > > the resources folder (normal page:
> > > http://localhost/whatever/page?0standard wicket resource directory:
> > > http://localhost/whatever/resources/*). I think I should use a
> > > ContextRelativeResource to point to the favico but you can'( point that
> > in
> > > stringheaderitem.
> > >
> > > I am looking at the best way to do this in Wicket 6 and above. for
> > earlier
> > > versions of wicket I found some things on the net but version 6 changed
> > > things around and I suppose this will be easy but I can't find it.
> > >
> > > Any help is appreciated
> > >
> > > Tim Van Meerbeeck
> > >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Reply via email to