public int doStartTag() {
    
    if (skip_condition) {
        return SKIP_BODY;
    }
    return super.doStartTag()
}

Nico.

> Nico,
> 
> Thanks for your response.
> However, what will happen to the existing code in the doStartTag of the
> org.apache.struts.taglib.html.LinkTag?
> Because I will still need the existing functionality of the
> org.apache.struts.taglib.html.LinkTag as well !!
> Should I make a call to the super.doStartTag()?
> 
> Please advise.
> 
> Thanks.
> Sanjay
> 
> -----Original Message-----
> From: Nicolas De Loof [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 31, 2003 6:25 PM
> To: Struts Users Mailing List
> Subject: Re: Custom Link Tag
> 
> 
> Place your code in doStartTag as it can return SKIP_BODY to exclude body
> from resulting HTML.
> 
> return EVAL_BODY_INCLUDE if you want the body to be included
> 
> Nico.
> 
> > Hi,
> > 
> > I am writing a custom tag: MyLinkTag that extends the
> > org.apache.struts.taglib.html.LinkTag.
> > 
> > MyLinkTag has two fields. They are 
> > showAlways : Boolean & alternateLink : String. 
> > 
> > The functionality of the MyLinkTag is captured in the following code
> > snippet:
> >
> ****************************************************************************
> > *******
> > HttpServletRequest request = pageContext.getRequest();
> > ActionMappings actionMappings =
> > (ActionMappings)request.getAttribute(Action.MAPPINGS_KEY); 
> > String path = getHref();
> > ActionMapping actionMapping = actionMappings.findMapping(path);
> > String[] roleNames = actionMapping.getRoleNames();
> > boolean userInRole = false;
> > for(int i=0; i<roleNames.length(); i++)
> > {
> > userInRole = request.isUserInRole(roleNames);
> > if(!userInRole){
> > if((alternateLink != null) && !("".equals(alternateLink))){
> > setHref(alternateLink);
> > }
> > else{
> > if(showAlways){
> > setDisabled(true);
> > }
> > else{
> > //don't show the link
> > return SKIP_BODY;
> > }
> > }
> > }//end if !userInRole
> > }//end for loop
> >
> ****************************************************************************
> > *******
> > 
> > The problem is I don't know where to place this code i.e. in which method:
> > doStartTag() or doEndTag() or doAfterBody() or any other?? 
> > What method should I override??
> > And what should be the return [integer] values?? 
> > 
> > Thanks in advance.
> > Sanjay
> > 
> > ____________________________________________________
> > This message contains information that may be privileged or confidential
> and
> > is the property of the Cap Gemini Ernst & Young Group. It is intended only
> > for the person to whom it is addressed. If you are not the intended
> > recipient, you are not authorised to read, print, retain, copy,
> disseminate,
> > distribute, or use this message or any part thereof. If you receive this
> > message in error, please notify the sender immediately and delete all
> copies
> > of this message.
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ____________________________________________________
> This message contains information that may be privileged or confidential and
> is the property of the Cap Gemini Ernst & Young Group. It is intended only
> for the person to whom it is addressed. If you are not the intended
> recipient, you are not authorised to read, print, retain, copy, disseminate,
> distribute, or use this message or any part thereof. If you receive this
> message in error, please notify the sender immediately and delete all copies
> of this message.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to