For now I use the following workaround

public class CleanBorder extends Border {
        private boolean savedStripWicketTags; 

        public CleanBorder(String id) {
                super(id);
                setRenderBodyOnly(true);
                getBodyContainer().setRenderBodyOnly(true);
        }

        public CleanBorder(String id, IModel<?> model) {
                super(id, model);
                setRenderBodyOnly(true);
                getBodyContainer().setRenderBodyOnly(true);
        }
        
        @Override
        protected void onAfterRender() {
                super.onAfterRender();
        
Application.get().getMarkupSettings().setStripWicketTags(savedStripWicketTags);
        }
        
        @Override
        protected void onBeforeRender() {
                savedStripWicketTags =
Application.get().getMarkupSettings().getStripWicketTags();
                Application.get().getMarkupSettings().setStripWicketTags(true);
                super.onBeforeRender();
        }


that looks like a hack. I would prefer a settings on the MarkupContainer
that by default uses the application settings but in case of border can be
overridden.


Vladimir K wrote:
> 
> I'm trying to convert main menu into components to control visibility of
> items depending on the user logged in and the context.
> I use borders to wrap menu item into <li> tags.
> 
> The problem is that the rendered markup contains additional
> <wicket:border>
> and <wicket:body> tags. They breaks the menu and it is eventually
> displayed
> as the simple list.
> 
> Stripping wicket tags at the application level would obviously solve the
> problem. But I'd like to keep wicket tags for most markup and strip only
> for
> menu.
> 
> Can I override Border class somehow and strip wicket tags manually?
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-strip-wicket-tags-for-particular-component-tp24568122p24568909.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to