`

About Tag state in struts

阅读更多

In struts, there is only one tag instance with one tag, so if there is one state field in tag class, please don't forget to revert the value of the state field before returning .
For example:
public class UserDefinedTableTag   extends TagSupport
{
   private boolean isAddRichScript = false;
   public int doEndTag() throws JspException {

   
    isAddRichScript = false;
        return EVAL_PAGE;

    }
private void addNote(UserDefinedTableColumnConfig userDefinedTableColumnConfig, StringBuffer outStr) {
                if("T".equals(userDefinedTableColumnConfig.getRichHtml()))
        {
            if(!isAddRichScript)
            {
                isAddRichScript = true;
                outStr.append(richScript);
            }
            outStr.append(richHtml);
        }
            }
}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics