HeaderContributor is definitely the standard way of doing this
(StyleSheetReference is only used once in all of Wicket code).  I would
suggest figuring out how to get the HeaderContributor working.  Open a new
thread on what's not working, and paste your code (where you add the HC in
java and your HTML for your base page template that all your other pages
extend from, if you have one, or any page that you added the HC to).

If you don't figure out why HeaderContributor isn't working, it is likely
that other Wicket extensions and components will not work because they will
not be able to contribute their JS or CSS to the head.

-- 
Jeremy Thomerson
http://www.wickettraining.com

On Wed, Feb 18, 2009 at 4:05 PM, rjilani <[email protected]> wrote:

>
> Thanks Jeremy for your suggestions. You were right the wicket link for
> style
> sheet was not in <wicket:panel> tag and putting the link under panel tag
> resolved the issue.
>
> One other observation though and it worked too, I put both the style sheet
> linked at the page level and added both the refrences in the constructor of
> the page and vola it worked. E.g
>
> <link wicket:id="stylesheet"/>
> <link wicket:id="stylesheetPanel"/>
>
> add(new StyleSheetReference("stylesheet", PBNASLogin.class, "login.css"));
> in page constructor
>
> add(new StyleSheetReference("stylesheetPanel", RegisteredUserPanel.class,
> "register.css")); //in page constructor too
>
> BTW even though HeaderContributor.forCss looks the most elegant solution,
> it
> never worked for me.
>
> Regards,
> RJ.
>
>
>
> Jeremy Thomerson-5 wrote:
> >
> > Your error didn't include WHICH components failed to render.  Here are a
> > couple suggestions:
> >
> > 1 - in your panel, is the <link> tag inside the <wicket:panel> tag - this
> > would be my first guess as to your problem.
> > 2 - why not just use HeaderContributor.forCss(RegisteredUserPanel.class,
> > "register.css") in your panel (and the same in your page) - these will
> add
> > the link for you, and in the head, where it should be.  You don't have to
> > put a component in the page then.
> >
> > --
> > Jeremy Thomerson
> > http://www.wickettraining.com
> >
> >
> > On Wed, Feb 18, 2009 at 3:31 PM, rjilani <[email protected]>
> > wrote:
> >
> >>
> >> Hi: Gurus, I am attaching two separate style sheets one for a page and
> >> one
> >> for the panel.
> >>
> >> I am attaching the style sheets in my Java code  like this
> >>
> >>  add(new StyleSheetReference("stylesheet", PBNASLogin.class,
> >> "login.css"));
> >> //in page constructor
> >>
> >>  add(new StyleSheetReference("stylesheetPanel",
> >> RegisteredUserPanel.class,
> >> "register.css")); //in panel constructor
> >>
> >> here is the html mark up for page and panel respectively
> >>
> >> <link wicket:id="stylesheet"/>
> >> <link wicket:id="stylesheetPanel"/>
> >>
> >> but when I run the code I got the following wicket error
> >>
> >> The component(s) below failed to render. A common problem is that you
> >> have
> >> added a component in code but forgot to reference it in the markup (thus
> >> the
> >> component will never be rendered)
> >>
> >> My question is that is it possible to add 2 separate style sheets in a
> >> parent child markup, if yes, what is the root cause of the above error.
> >>
> >> Thanks,
> >> RJ.
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/sepearte-stylesheet-refrences-for-page-and-panel-tp22088667p22088667.html
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/sepearte-stylesheet-refrences-for-page-and-panel-tp22088667p22089319.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to