You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Renato Romano <r....@set-network.com> on 2004/02/26 09:49:29 UTC

Xhtml tag usage question

I tried to insert the xhtml tag in my pages, but the only way I found is
to insert it in each tile that composes my page. It seems it is not
sufficient to put it in the template file, or in the page using the
template. Is there a better approach ?
Any help is appreciated
Renato

____________________________________
Renato Romano
Sistemi e Telematica S.p.A.
Calata Grazie - Vial Al Molo Giano
16127 - GENOVA

e-mail: r.romano@set-network.com
Tel.:   010 2712603
_____________________________________




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Xhtml tag usage question

Posted by Renato Romano <r....@set-network.com>.
Thank you very much for your detailed explanation!!!
Renato

____________________________________
Renato Romano
Sistemi e Telematica S.p.A.
Calata Grazie - Vial Al Molo Giano
16127 - GENOVA

e-mail: r.romano@set-network.com
Tel.:   010 2712603
_____________________________________


-----Original Message-----
From: Niall Pemberton [mailto:niall.pemberton@blueyonder.co.uk] 
Sent: giovedì 26 febbraio 2004 12.36
To: Struts Users Mailing List
Subject: Re: Xhtml tag usage question


Unfortunately it saves the xhtml 'flag' in page scope so there isn't
much you can do about it.

Background: BaseHandlerTag has an isXhtml() method which calls the
TagUtils.isXhtml() method which checks the xhtml 'flag' in page scope.

I did think a solution would be to override the TagUtils.isXhtml()
method to either always return 'true' or check a flag in request scope
(which you would have to set some way) - but unfortunately the instance
variable for TagUtils is both private and final - so theres no way to
extend and implement your own custom TagUtils version in 'vanilla'
struts. If you build your own version of struts, you could change
TagUtils itself, so maybe thats an option for you - but then every time
you take a new struts version you have to re-implement your change.

Another alternative is to extend the struts tags to create 'xhtml'
versions - all you would have to do is override the isXhtml() method
there. For example

public class XhtmlTextTag extends TextTag
   public XhtmlTextTag () {
      super();
    }
  protected boolean isXhtml() {
      return true;
  }
}

So I think you have a few options:
   - put the <html:xhtml> tag in every jsp
   - build your own version of struts and change TagUtils
   - extend the struts tags to create xhtml versions

Personally, I would go with <html:xhtml> for now and try to get struts
changed so that either the scope of the xhtml flag can be customized or
TagUtils can be extended and overriden.

Niall

----- Original Message ----- 
From: "Renato Romano" <r....@set-network.com>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Thursday, February 26, 2004 8:49 AM
Subject: Xhtml tag usage question


> I tried to insert the xhtml tag in my pages, but the only way I found 
> is to insert it in each tile that composes my page. It seems it is not

> sufficient to put it in the template file, or in the page using the 
> template. Is there a better approach ? Any help is appreciated
> Renato
>
> ____________________________________
> Renato Romano
> Sistemi e Telematica S.p.A.
> Calata Grazie - Vial Al Molo Giano
> 16127 - GENOVA
>
> e-mail: r.romano@set-network.com
> Tel.:   010 2712603
> _____________________________________
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Xhtml tag usage question

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
Unfortunately it saves the xhtml 'flag' in page scope so there isn't much
you can do about it.

Background: BaseHandlerTag has an isXhtml() method which calls the
TagUtils.isXhtml() method which checks the xhtml 'flag' in page scope.

I did think a solution would be to override the TagUtils.isXhtml() method to
either always return 'true' or check a flag in request scope (which you
would have to set some way) - but unfortunately the instance variable for
TagUtils is both private and final - so theres no way to extend and
implement your own custom TagUtils version in 'vanilla' struts. If you build
your own version of struts, you could change TagUtils itself, so maybe thats
an option for you - but then every time you take a new struts version you
have to re-implement your change.

Another alternative is to extend the struts tags to create 'xhtml'
versions - all you would have to do is override the isXhtml() method there.
For example

public class XhtmlTextTag extends TextTag
   public XhtmlTextTag () {
      super();
    }
  protected boolean isXhtml() {
      return true;
  }
}

So I think you have a few options:
   - put the <html:xhtml> tag in every jsp
   - build your own version of struts and change TagUtils
   - extend the struts tags to create xhtml versions

Personally, I would go with <html:xhtml> for now and try to get struts
changed so that either the scope of the xhtml flag can be customized or
TagUtils can be extended and overriden.

Niall

----- Original Message ----- 
From: "Renato Romano" <r....@set-network.com>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Thursday, February 26, 2004 8:49 AM
Subject: Xhtml tag usage question


> I tried to insert the xhtml tag in my pages, but the only way I found is
> to insert it in each tile that composes my page. It seems it is not
> sufficient to put it in the template file, or in the page using the
> template. Is there a better approach ?
> Any help is appreciated
> Renato
>
> ____________________________________
> Renato Romano
> Sistemi e Telematica S.p.A.
> Calata Grazie - Vial Al Molo Giano
> 16127 - GENOVA
>
> e-mail: r.romano@set-network.com
> Tel.:   010 2712603
> _____________________________________
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org