code_prettify

2016年1月30日 星期六

format all files in eclipse

Work under package explorer.
Right click on target(folder) > source > format

2016年1月13日 星期三

JSP custom tag attribute reused

依照 JSP spec, custom tag的 instance會被 pooled及 reused.
stack overflow

公司系統的 custom tag dbText沒有在適當的地方(doEndTag()) release掉所有屬性
造成其中一個用來可以取代 property做為 input name的 not required屬性 showName一旦使用過
會因為 tag handler instance pooled的關係
如果後續使用時沒指定 showName,就會一直沿用最後一次使用的值
showName = showName == null ? property : null;
而且這段程式碼還位於不見得一定會被執行到的位置
衍伸出產生沒有 name屬性 input的 bug