You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Narayana S <na...@gmail.com> on 2008/09/24 13:51:48 UTC

Extending Struts Tags

Hi

       i missed my previous email about the same topic, one guy helped me to
implement struts UI tag customization. i could extend the Bean and Tag
classes to implement the required behavior.

now based on some value from the database i want to stop rendering of the
control itself. means for example i have a field visible , if it is false i
should not display the control at all.. how can i stop tag rendering can any
one help me to do this...

Thanks in advance.

Re: Extending Struts Tags

Posted by Narayana S <na...@gmail.com>.
Thanks Jishnu and Albert.

          now i am overriding doStart and doEnd tag also. here i am getting
the visibility value from DB and calling Component.inject if visibility is
allowed. your inputs helped to quickly find out the solution,,,

Thanks a lot.

On Wed, Sep 24, 2008 at 7:39 PM, Alberto Flores <af...@umd.edu> wrote:

> Assumming you are talking about Struts 2, I would recommend checking out
> the source code and trace how the UIBean delegates to the Component class
> (super class). All Struts2 ui objects are subclasses of "Component".
> Additionally, UIBean adds a set of methods that are very useful
> (particularly the logic on evaluateParams() and evaluateExtraParams().
>  These classes add your friend.
>
> Although not the best solutions, my strategy for hiding a component on
> certain criteria was to modify the theme used in the rendering engine (e.g.
> override the getTheme() method) You'll then need to create your own template
> with blank HTML (or whatever suits your needs).
>
> Granted, this does not stop processing of the component, you still do
> unnecessary operations (loading the template map, doing a bunch of unneeded
> comparison).  But I think there's little you could do about that other than
> possibly throwing you own exception which could arguably be better in
> performance that those operations.
>
> Only a thought!
>
>
>
> Narayana S wrote:
>
>> Hi
>>
>>       i missed my previous email about the same topic, one guy helped me
>> to
>> implement struts UI tag customization. i could extend the Bean and Tag
>> classes to implement the required behavior.
>>
>> now based on some value from the database i want to stop rendering of the
>> control itself. means for example i have a field visible , if it is false
>> i
>> should not display the control at all.. how can i stop tag rendering can
>> any
>> one help me to do this...
>>
>> Thanks in advance.
>>
>>
> --
> --
> Alberto
> http://www.linkedin.com/in/aflores
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

Re: Extending Struts Tags

Posted by Alberto Flores <af...@umd.edu>.
Assumming you are talking about Struts 2, I would recommend checking out 
the source code and trace how the UIBean delegates to the Component 
class (super class). All Struts2 ui objects are subclasses of 
"Component". Additionally, UIBean adds a set of methods that are very 
useful (particularly the logic on evaluateParams() and 
evaluateExtraParams().  These classes add your friend.

Although not the best solutions, my strategy for hiding a component on 
certain criteria was to modify the theme used in the rendering engine 
(e.g. override the getTheme() method) You'll then need to create your 
own template with blank HTML (or whatever suits your needs).

Granted, this does not stop processing of the component, you still do 
unnecessary operations (loading the template map, doing a bunch of 
unneeded comparison).  But I think there's little you could do about 
that other than possibly throwing you own exception which could arguably 
be better in performance that those operations.

Only a thought!


Narayana S wrote:
> Hi
> 
>        i missed my previous email about the same topic, one guy helped me to
> implement struts UI tag customization. i could extend the Bean and Tag
> classes to implement the required behavior.
> 
> now based on some value from the database i want to stop rendering of the
> control itself. means for example i have a field visible , if it is false i
> should not display the control at all.. how can i stop tag rendering can any
> one help me to do this...
> 
> Thanks in advance.
> 

-- 
--
Alberto
http://www.linkedin.com/in/aflores


RE: Extending Struts Tags

Posted by Jishnu Viswanath <ji...@tavant.com>.
Cant you put if condition in the ftl?

Regards,

Jishnu Viswanath

Software Engineer

*(+9180)41190300 - 222(Ext) ll * ( + 91 ) 9731209330ll

Tavant Technologies Inc.,

www.tavant.com

PEOPLE :: PASSION :: EXCELLENCE

-----Original Message-----
From: Narayana S [mailto:narayanasgs1@gmail.com] 
Sent: Wednesday, September 24, 2008 5:22 PM
To: Struts Users Mailing List
Subject: Extending Struts Tags

Hi

       i missed my previous email about the same topic, one guy helped
me to
implement struts UI tag customization. i could extend the Bean and Tag
classes to implement the required behavior.

now based on some value from the database i want to stop rendering of
the
control itself. means for example i have a field visible , if it is
false i
should not display the control at all.. how can i stop tag rendering can
any
one help me to do this...

Thanks in advance.
Any comments or statements made in this email are not necessarily those of Tavant Technologies.
The information transmitted is intended only for the person or entity to which it is addressed and may 
contain confidential and/or privileged material. If you have received this in error, please contact the 
sender and delete the material from any computer. All e-mails sent from or to Tavant Technologies 
may be subject to our monitoring procedures.


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