protected void populateParams() { try { if (StringUtils.isNotBlank(minRows)) { this.setDynamicAttribute(null, "minRows", minRows); } if (StringUtils.isNotBlank(maxRows)) { this.setDynamicAttribute(null, "maxRows", maxRows); } if (StringUtils.isNotBlank(afterAdd)) { this.setDynamicAttribute(null, "afterAdd", afterAdd); } } catch (JspException e) { e.printStackTrace(); } super.populateParams(); DynamicTable uiBean = ((DynamicTable) component); if (id == null) { // 设置ID随机 uiBean.setId("dynamictable_" + RandomStringUtils.randomAlphabetic(10)); } if (cssClass == null) { uiBean.setCssClass("table table-striped table-condensed"); } }
public void testSimple() { BeanTag tag = new BeanTag(); tag.setPageContext(pageContext); tag.setName("com.opensymphony.webwork.TestAction"); try { tag.doStartTag(); tag.component.addParameter("result", "success"); assertEquals("success", stack.findValue("result")); // TestAction from bean tag, Action from execution and DefaultTextProvider assertEquals(3, stack.size()); tag.doEndTag(); assertEquals(2, stack.size()); } catch (JspException ex) { ex.printStackTrace(); fail(); } request.verify(); pageContext.verify(); }
protected void populateParams() { // 此段落必须放在super.populateParams()之前 try { if (StringUtils.isNotBlank(autoValidate)) { this.setDynamicAttribute(null, "autoValidate", autoValidate); } } catch (JspException e) { e.printStackTrace(); } super.populateParams(); UIBean uiBean = ((UIBean) component); if (id == null) { String formid = "form_" + RandomStringUtils.randomAlphabetic(10); uiBean.setId(formid); // 将id属性设置到pageContext中,便于前端JS代码进行对象分组控制 pageContext.setAttribute("closestFormId", formid); } if (this.theme == null) { uiBean.setTheme("bootstrap"); } }