本文整理汇总了Java中org.springframework.web.servlet.tags.form.TagWriter类的典型用法代码示例。如果您正苦于以下问题:Java TagWriter类的具体用法?Java TagWriter怎么用?Java TagWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TagWriter类属于org.springframework.web.servlet.tags.form包,在下文中一共展示了TagWriter类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: writeTagContent
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
@Override
protected int writeTagContent(TagWriter tagWriter) throws JspException {
super.writeTagContent(tagWriter);
if (!isDisabled()) {
// Write out the 'field was present' marker.
tagWriter.startTag("input");
tagWriter.writeAttribute("type", "hidden");
String name = WebDataBinder.DEFAULT_FIELD_MARKER_PREFIX + getName();
tagWriter.writeAttribute("name", name);
tagWriter.writeAttribute("value", processFieldValue(name, "on", getInputType()));
tagWriter.endTag();
}
return SKIP_BODY;
}
开发者ID:pengqiuyuan,项目名称:g2,代码行数:17,代码来源:BSCheckboxesTag.java
示例2: writeObjectEntry
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
/**
* Copy & Paste, 无修正.
*/
private void writeObjectEntry(TagWriter tagWriter, String valueProperty, String labelProperty, Object item,
int itemIndex) throws JspException {
BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(item);
Object renderValue;
if (valueProperty != null) {
renderValue = wrapper.getPropertyValue(valueProperty);
} else if (item instanceof Enum) {
renderValue = ((Enum<?>) item).name();
} else {
renderValue = item;
}
Object renderLabel = (labelProperty != null ? wrapper.getPropertyValue(labelProperty) : item);
writeElementTag(tagWriter, item, renderValue, renderLabel, itemIndex);
}
开发者ID:pengqiuyuan,项目名称:g2,代码行数:19,代码来源:BSAbstractMultiCheckedElementTag.java
示例3: setUp
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
@Before
public void setUp() {
writer = new StringWriter();
formTag = new FormTag();
tagWriter = new TagWriter(writer);
inputTag = new Html5InputTag() {
@Override
protected TagWriter createTagWriter() {
return tagWriter;
}
};
inputTag.setParent(formTag);
pageContext = createAndPopulatePageContext(null);
inputTag.setPageContext(pageContext);
}
开发者ID:arey,项目名称:spring-mvc-toolkit,代码行数:17,代码来源:TestHtml5InputTag.java
示例4: writeMapEntry
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
/**
* Copy & Paste, 无修正.
*/
private void writeMapEntry(TagWriter tagWriter, String valueProperty, String labelProperty, Map.Entry entry,
int itemIndex) throws JspException {
Object mapKey = entry.getKey();
Object mapValue = entry.getValue();
BeanWrapper mapKeyWrapper = PropertyAccessorFactory.forBeanPropertyAccess(mapKey);
BeanWrapper mapValueWrapper = PropertyAccessorFactory.forBeanPropertyAccess(mapValue);
Object renderValue = (valueProperty != null ? mapKeyWrapper.getPropertyValue(valueProperty) : mapKey.toString());
Object renderLabel = (labelProperty != null ? mapValueWrapper.getPropertyValue(labelProperty) : mapValue
.toString());
writeElementTag(tagWriter, mapKey, renderValue, renderLabel, itemIndex);
}
开发者ID:pengqiuyuan,项目名称:g2,代码行数:16,代码来源:BSAbstractMultiCheckedElementTag.java
示例5: writeElementTag
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
/**
* 重载方法,调整元素的输出顺序。
*/
private void writeElementTag(TagWriter tagWriter, Object item, Object value, Object label, int itemIndex)
throws JspException {
String id = resolveId();
String resolvedLabelClass = getInputType();
if (labelCssClass != null) {
resolvedLabelClass += " " + labelCssClass;
}
tagWriter.startTag("label");
tagWriter.writeAttribute("for", id);
tagWriter.writeAttribute("class", resolvedLabelClass);
if (itemIndex > 0) {
Object resolvedDelimiter = evaluate("delimiter", getDelimiter());
if (resolvedDelimiter != null) {
tagWriter.appendValue(resolvedDelimiter.toString());
}
}
tagWriter.startTag("input");
writeOptionalAttribute(tagWriter, "id", id);
writeOptionalAttribute(tagWriter, "name", getName());
writeOptionalAttributes(tagWriter);
tagWriter.writeAttribute("type", getInputType());
renderFromValue(item, value, tagWriter);
tagWriter.endTag();
tagWriter.appendValue(convertToDisplayString(label));
tagWriter.endTag();
}
开发者ID:pengqiuyuan,项目名称:g2,代码行数:36,代码来源:BSAbstractMultiCheckedElementTag.java
示例6: writeCustomTagAttributes
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
@Override
public void writeCustomTagAttributes(TagWriter tagWriter) throws JspException {
String linkAddress = href;
if(keepQueryString){
String qs = WebHolder.getSpringContextHolderRequest().get().getQueryString();
if(StringUtils.isBlank(qs)){
writeHref(tagWriter, linkAddress);
return ;
}
linkAddress += linkAddress.contains("?")?"&":"?";
linkAddress += qs;
}
writeHref(tagWriter, linkAddress);
}
开发者ID:wayshall,项目名称:onetwo,代码行数:16,代码来源:LinkTag.java
示例7: writeTagContent
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
@Override
protected int writeTagContent(TagWriter tagWriter) throws JspException {
PropertyDescriptor propertyDescriptor = getPropertyDescriptor();
if ((propertyDescriptor != null) && !propertyDescriptor.getConstraintDescriptors().isEmpty()) {
annotations = constrainteByAnnotationType(propertyDescriptor);
}
valueType = getBindStatus().getValueType();
return super.writeTagContent(tagWriter);
}
开发者ID:arey,项目名称:spring-mvc-toolkit,代码行数:10,代码来源:Html5InputTag.java
示例8: writeValue
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
@Override
protected void writeValue(TagWriter tagWriter) throws JspException {
super.writeValue(tagWriter);
if (annotations != null) {
writeHtml5Attributes(tagWriter);
}
}
开发者ID:arey,项目名称:spring-mvc-toolkit,代码行数:8,代码来源:Html5InputTag.java
示例9: writeMaxLengthAttribute
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
protected void writeMaxLengthAttribute(TagWriter tagWriter) throws JspException {
if (annotations.containsKey(Size.class)) {
Size size = getAnnotation(Size.class);
if ((size.max() != Integer.MAX_VALUE) && StringUtils.isEmpty(getMaxlength())) {
writeOptionalAttribute(tagWriter, MAXLENGTH_ATTRIBUTE, String.valueOf(size.max()));
}
}
}
开发者ID:arey,项目名称:spring-mvc-toolkit,代码行数:9,代码来源:Html5InputTag.java
示例10: nestingInFormTag
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
/**
* SPR-4022
*/
@SuppressWarnings("serial")
@Test
public void nestingInFormTag() throws JspException {
PageContext pc = createPageContext();
TestBean tb = new TestBean();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
ServletRequestDataBinder binder = new ServletRequestDataBinder(tb, "tb");
CustomDateEditor l = new CustomDateEditor(df, true);
binder.registerCustomEditor(Date.class, l);
pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", binder.getBindingResult());
FormTag formTag = new FormTag() {
@Override
protected TagWriter createTagWriter() {
return new TagWriter(new StringWriter());
}
};
String action = "/form.html";
String commandName = "tb";
String name = "formName";
String enctype = "my/enctype";
String method = "POST";
String onsubmit = "onsubmit";
String onreset = "onreset";
String cssClass = "myClass";
String cssStyle = "myStyle";
String acceptCharset = "iso-8859-1";
formTag.setName(name);
formTag.setCssClass(cssClass);
formTag.setCssStyle(cssStyle);
formTag.setAction(action);
formTag.setCommandName(commandName);
formTag.setEnctype(enctype);
formTag.setMethod(method);
formTag.setOnsubmit(onsubmit);
formTag.setOnreset(onreset);
formTag.setAcceptCharset(acceptCharset);
formTag.setPageContext(pc);
formTag.doStartTag();
BindTag bindTag1 = new BindTag();
bindTag1.setPageContext(pc);
bindTag1.setPath("date");
bindTag1.doStartTag();
bindTag1.doEndTag();
BindTag bindTag2 = new BindTag();
bindTag2.setPageContext(pc);
bindTag2.setPath("tb.date");
bindTag2.doStartTag();
bindTag2.doEndTag();
BindTag bindTag3 = new BindTag();
bindTag3.setPageContext(pc);
bindTag3.setPath("tb");
bindTag3.doStartTag();
bindTag3.doEndTag();
formTag.doEndTag();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:67,代码来源:BindTagTests.java
示例11: createTagWriter
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
protected TagWriter createTagWriter(){
return new TagWriter(pageContext);
}
开发者ID:wayshall,项目名称:onetwo,代码行数:4,代码来源:BaseBodyTag.java
示例12: writeCustomTagAttributes
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
protected void writeCustomTagAttributes(TagWriter tagWriter) throws JspException{
}
开发者ID:wayshall,项目名称:onetwo,代码行数:3,代码来源:BaseBodyTag.java
示例13: writeHref
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
private void writeHref(TagWriter tagWriter, String linkAddress) throws JspException{
if(encodeUrl){
linkAddress = URLEncoder.SAFE_PARAMS_ENCODER.encode(linkAddress);
}
tagWriter.writeAttribute("href", linkAddress);
}
开发者ID:wayshall,项目名称:onetwo,代码行数:7,代码来源:LinkTag.java
示例14: testNestingInFormTag
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
/**
* SPR-4022
*/
@SuppressWarnings("serial")
public void testNestingInFormTag() throws JspException {
PageContext pc = createPageContext();
TestBean tb = new TestBean();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
ServletRequestDataBinder binder = new ServletRequestDataBinder(tb, "tb");
CustomDateEditor l = new CustomDateEditor(df, true);
binder.registerCustomEditor(Date.class, l);
pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", binder.getBindingResult());
FormTag formTag = new FormTag() {
@Override
protected TagWriter createTagWriter() {
return new TagWriter(new StringWriter());
}
};
String action = "/form.html";
String commandName = "tb";
String name = "formName";
String enctype = "my/enctype";
String method = "POST";
String onsubmit = "onsubmit";
String onreset = "onreset";
String cssClass = "myClass";
String cssStyle = "myStyle";
String acceptCharset = "iso-8859-1";
formTag.setName(name);
formTag.setCssClass(cssClass);
formTag.setCssStyle(cssStyle);
formTag.setAction(action);
formTag.setCommandName(commandName);
formTag.setEnctype(enctype);
formTag.setMethod(method);
formTag.setOnsubmit(onsubmit);
formTag.setOnreset(onreset);
formTag.setAcceptCharset(acceptCharset);
formTag.setPageContext(pc);
formTag.doStartTag();
BindTag bindTag1 = new BindTag();
bindTag1.setPageContext(pc);
bindTag1.setPath("date");
bindTag1.doStartTag();
bindTag1.doEndTag();
BindTag bindTag2 = new BindTag();
bindTag2.setPageContext(pc);
bindTag2.setPath("tb.date");
bindTag2.doStartTag();
bindTag2.doEndTag();
BindTag bindTag3 = new BindTag();
bindTag3.setPageContext(pc);
bindTag3.setPath("tb");
bindTag3.doStartTag();
bindTag3.doEndTag();
formTag.doEndTag();
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:66,代码来源:BindTagTests.java
示例15: writeTagContent
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected int writeTagContent(TagWriter tagWriter) throws JspException {
return EVAL_BODY_INCLUDE;
}
开发者ID:ctc-g,项目名称:sinavi-jfw,代码行数:8,代码来源:PageNavigationTag.java
示例16: writeHtml5Attributes
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
protected void writeHtml5Attributes(TagWriter tagWriter) throws JspException {
writeMaxLengthAttribute(tagWriter);
writeRequiredAttribute(tagWriter);
writeMaxAttribute(tagWriter);
writeMinAttribute(tagWriter);
}
开发者ID:arey,项目名称:spring-mvc-toolkit,代码行数:7,代码来源:Html5InputTag.java
示例17: writeRequiredAttribute
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
protected void writeRequiredAttribute(TagWriter tagWriter) throws JspException {
if (annotations.containsKey(NotEmpty.class) || annotations.containsKey(NotNull.class)) {
writeOptionalAttribute(tagWriter, "required", "required");
}
}
开发者ID:arey,项目名称:spring-mvc-toolkit,代码行数:6,代码来源:Html5InputTag.java
示例18: writeMaxAttribute
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
protected void writeMaxAttribute(TagWriter tagWriter) throws JspException {
if (annotations.containsKey(Max.class)) {
Max max = getAnnotation(Max.class);
writeOptionalAttribute(tagWriter, MAX_ATTRIBUTE, String.valueOf(max.value()));
}
}
开发者ID:arey,项目名称:spring-mvc-toolkit,代码行数:7,代码来源:Html5InputTag.java
示例19: writeMinAttribute
import org.springframework.web.servlet.tags.form.TagWriter; //导入依赖的package包/类
protected void writeMinAttribute(TagWriter tagWriter) throws JspException {
if (annotations.containsKey(Min.class)) {
Min min = getAnnotation(Min.class);
writeOptionalAttribute(tagWriter, MIN_ATTRIBUTE, String.valueOf(min.value()));
}
}
开发者ID:arey,项目名称:spring-mvc-toolkit,代码行数:7,代码来源:Html5InputTag.java
注:本文中的org.springframework.web.servlet.tags.form.TagWriter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论