You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tarun Dewan <ta...@nucleussoftware.com> on 2003/05/26 14:37:51 UTC

Extending STRUTS!!!

Hi All,

In our project we are trying to extend some struts classes for displaying
TextBox, Select, TextArea with different CSS classes.

While working for the same, i found that in Struts Souces there are two
packages org.apache.struts.tabglib (which is actually used by Struts
Framework and most of the classes are marked as final) and
org.apache.struts.tabglib.html (with higher versions than the earlier).

Pls. advise if i should modify classes in org.apache.struts.tabglib packages
or extend classes in org.apache.struts.tabglib.html package.

Eagerly waiting for favorable response.

Thanks & regards,

Tarun Dewan.

Note : Example of modification required is as follows :

package org.apache.struts.taglib.html.nuc.los;

import org.apache.struts.taglib.html.TextTag;

/**
 * @author Tarun
 *
 * This class is extended from org.apache.struts.taglib.html.TextTag
 * to provide additional Facitlities to HTML TextBox object
 */
public class NucTextTag extends TextTag {

    /**
     * Construct a new instance of this tag.
     */
    public NucTextTag() {

 super();
 this.type = "text";

    }

    /**
     * The named Type associated with this tag.
     * This will define whether element is to be displayed as Mandatory
     * or Enable or Incomplete or Normal
     */
    private String displayClass = null;

    public String getDisplayClass() {
        return displayClass;
    }

    public void setDisplayClass(String displayClass) {
        this.displayClass = displayClass;
        if(this.displayClass == null)
        {
         this.displayClass = "N";
        }
        if(this.displayClass.equals("M"))
        {
         setStyleClass("MAND");
        }
        else if(this.displayClass.equals("D"))
        {
         setStyleClass("DABL");
         setDisabled(false);
        }
        else if (this.displayClass.equals("I"))
        {
         setStyleClass("INCO");
        }
        else
        {
         setStyleClass("NORM");
        }
    }
}



RE: Extending STRUTS!!!

Posted by Tarun Dewan <ta...@nucleussoftware.com>.
We're using Version 1.0.2.

Thanks & regards,

Tarun Dewan.
-----Original Message-----
From: Nicolas De Loof [mailto:nicolas.deloof@cgey.com]
Sent: Monday, May 26, 2003 6:13 PM
To: Struts Users Mailing List; tarun.dewan@nucleussoftware.com
Subject: Re: Extending STRUTS!!!


In 2003-05-25 nightly build sources, org.apache.struts.tabglib is an empty
package. What version of Struts are you using
?

Perhaps are those classes old version of Struts tags : I think in 1.0.2
they're was a deprecated struts.tld that
included all tags, that where dispatched in specialized packages.

Nico.



> Hi All,
>
> In our project we are trying to extend some struts classes for displaying
> TextBox, Select, TextArea with different CSS classes.
>
> While working for the same, i found that in Struts Souces there are two
> packages org.apache.struts.tabglib (which is actually used by Struts
> Framework and most of the classes are marked as final) and
> org.apache.struts.tabglib.html (with higher versions than the earlier).
>
> Pls. advise if i should modify classes in org.apache.struts.tabglib
packages
> or extend classes in org.apache.struts.tabglib.html package.
>
> Eagerly waiting for favorable response.
>
> Thanks & regards,
>
> Tarun Dewan.
>
> Note : Example of modification required is as follows :
>
> package org.apache.struts.taglib.html.nuc.los;
>
> import org.apache.struts.taglib.html.TextTag;
>
> /**
>  * @author Tarun
>  *
>  * This class is extended from org.apache.struts.taglib.html.TextTag
>  * to provide additional Facitlities to HTML TextBox object
>  */
> public class NucTextTag extends TextTag {
>
>     /**
>      * Construct a new instance of this tag.
>      */
>     public NucTextTag() {
>
>  super();
>  this.type = "text";
>
>     }
>
>     /**
>      * The named Type associated with this tag.
>      * This will define whether element is to be displayed as Mandatory
>      * or Enable or Incomplete or Normal
>      */
>     private String displayClass = null;
>
>     public String getDisplayClass() {
>         return displayClass;
>     }
>
>     public void setDisplayClass(String displayClass) {
>         this.displayClass = displayClass;
>         if(this.displayClass == null)
>         {
>          this.displayClass = "N";
>         }
>         if(this.displayClass.equals("M"))
>         {
>          setStyleClass("MAND");
>         }
>         else if(this.displayClass.equals("D"))
>         {
>          setStyleClass("DABL");
>          setDisabled(false);
>         }
>         else if (this.displayClass.equals("I"))
>         {
>          setStyleClass("INCO");
>         }
>         else
>         {
>          setStyleClass("NORM");
>         }
>     }
> }
>
>
>


---------------------------------------------------------------------
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: Extending STRUTS!!!

Posted by Nicolas De Loof <ni...@cgey.com>.
In 2003-05-25 nightly build sources, org.apache.struts.tabglib is an empty package. What version of Struts are you using
?

Perhaps are those classes old version of Struts tags : I think in 1.0.2 they're was a deprecated struts.tld that
included all tags, that where dispatched in specialized packages.

Nico.



> Hi All,
>
> In our project we are trying to extend some struts classes for displaying
> TextBox, Select, TextArea with different CSS classes.
>
> While working for the same, i found that in Struts Souces there are two
> packages org.apache.struts.tabglib (which is actually used by Struts
> Framework and most of the classes are marked as final) and
> org.apache.struts.tabglib.html (with higher versions than the earlier).
>
> Pls. advise if i should modify classes in org.apache.struts.tabglib packages
> or extend classes in org.apache.struts.tabglib.html package.
>
> Eagerly waiting for favorable response.
>
> Thanks & regards,
>
> Tarun Dewan.
>
> Note : Example of modification required is as follows :
>
> package org.apache.struts.taglib.html.nuc.los;
>
> import org.apache.struts.taglib.html.TextTag;
>
> /**
>  * @author Tarun
>  *
>  * This class is extended from org.apache.struts.taglib.html.TextTag
>  * to provide additional Facitlities to HTML TextBox object
>  */
> public class NucTextTag extends TextTag {
>
>     /**
>      * Construct a new instance of this tag.
>      */
>     public NucTextTag() {
>
>  super();
>  this.type = "text";
>
>     }
>
>     /**
>      * The named Type associated with this tag.
>      * This will define whether element is to be displayed as Mandatory
>      * or Enable or Incomplete or Normal
>      */
>     private String displayClass = null;
>
>     public String getDisplayClass() {
>         return displayClass;
>     }
>
>     public void setDisplayClass(String displayClass) {
>         this.displayClass = displayClass;
>         if(this.displayClass == null)
>         {
>          this.displayClass = "N";
>         }
>         if(this.displayClass.equals("M"))
>         {
>          setStyleClass("MAND");
>         }
>         else if(this.displayClass.equals("D"))
>         {
>          setStyleClass("DABL");
>          setDisabled(false);
>         }
>         else if (this.displayClass.equals("I"))
>         {
>          setStyleClass("INCO");
>         }
>         else
>         {
>          setStyleClass("NORM");
>         }
>     }
> }
>
>
>


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