Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
4d897e7a
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4d897e7a
编写于
2月 03, 2010
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lenient evaluation of boolean 'true' attribute expressions in JSP form tag library (SPR-6790)
上级
41ecbc68
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
28 addition
and
20 deletion
+28
-20
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractFormTag.java
...pringframework/web/servlet/tags/form/AbstractFormTag.java
+13
-2
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlInputElementTag.java
...rk/web/servlet/tags/form/AbstractHtmlInputElementTag.java
+3
-3
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/OptionTag.java
.../org/springframework/web/servlet/tags/form/OptionTag.java
+3
-3
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/OptionWriter.java
...g/springframework/web/servlet/tags/form/OptionWriter.java
+2
-3
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/OptionsTag.java
...org/springframework/web/servlet/tags/form/OptionsTag.java
+4
-4
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/SelectTag.java
.../org/springframework/web/servlet/tags/form/SelectTag.java
+3
-5
未找到文件。
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractFormTag.java
浏览文件 @
4d897e7a
/*
* Copyright 2002-20
07
the original author or authors.
* Copyright 2002-20
10
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -17,7 +17,6 @@
package
org.springframework.web.servlet.tags.form
;
import
java.beans.PropertyEditor
;
import
javax.servlet.jsp.JspException
;
import
org.springframework.util.ObjectUtils
;
...
...
@@ -55,6 +54,18 @@ public abstract class AbstractFormTag extends HtmlEscapingAwareTag {
}
}
/**
* Evaluate the supplied value for the supplied attribute name. If the supplied value
* is <code>null</code> then <code>false</code> is returned, otherwise evaluation is
* handled using {@link ExpressionEvaluationUtils#evaluate(String, String, javax.servlet.jsp.PageContext)},
* with subsequent matching against <code>Boolean.TRUE</code> and <code>Boolean.valueOf</code>.
*/
protected
boolean
evaluateBoolean
(
String
attributeName
,
String
value
)
throws
JspException
{
Object
evaluated
=
ExpressionEvaluationUtils
.
evaluate
(
attributeName
,
value
,
this
.
pageContext
);
return
(
Boolean
.
TRUE
.
equals
(
evaluated
)
||
(
evaluated
instanceof
String
&&
Boolean
.
valueOf
((
String
)
evaluated
)));
}
/**
* Optionally writes the supplied value under the supplied attribute name into the supplied
* {@link TagWriter}. In this case, the supplied value is {@link #evaluate evaluated} first
...
...
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractHtmlInputElementTag.java
浏览文件 @
4d897e7a
/*
* Copyright 2002-20
07
the original author or authors.
* Copyright 2002-20
10
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -192,7 +192,7 @@ public abstract class AbstractHtmlInputElementTag extends AbstractHtmlElementTag
* Is the current HTML tag disabled?
*/
protected
boolean
isDisabled
()
throws
JspException
{
return
"true"
.
equals
(
evaluate
(
DISABLED_ATTRIBUTE
,
getDisabled
()
));
return
evaluateBoolean
(
DISABLED_ATTRIBUTE
,
getDisabled
(
));
}
/**
...
...
@@ -202,7 +202,7 @@ public abstract class AbstractHtmlInputElementTag extends AbstractHtmlElementTag
* not affected by them since their values don't change (only their status does.)
*/
protected
boolean
isReadonly
()
throws
JspException
{
return
"true"
.
equals
(
evaluate
(
READONLY_ATTRIBUTE
,
getReadonly
()
));
return
evaluateBoolean
(
READONLY_ATTRIBUTE
,
getReadonly
(
));
}
}
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/OptionTag.java
浏览文件 @
4d897e7a
/*
* Copyright 2002-20
08
the original author or authors.
* Copyright 2002-20
10
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -126,8 +126,8 @@ public class OptionTag extends AbstractHtmlElementBodyTag implements BodyTag {
* Is the current HTML tag disabled?
* @return <code>true</code> if this tag is disabled
*/
protected
boolean
isDisabled
()
{
return
"true"
.
equals
(
getDisabled
());
protected
boolean
isDisabled
()
throws
JspException
{
return
evaluateBoolean
(
DISABLED_ATTRIBUTE
,
getDisabled
());
}
/**
...
...
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/OptionWriter.java
浏览文件 @
4d897e7a
/*
* Copyright 2002-20
08
the original author or authors.
* Copyright 2002-20
10
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -19,7 +19,6 @@ package org.springframework.web.servlet.tags.form;
import
java.util.Collection
;
import
java.util.Iterator
;
import
java.util.Map
;
import
javax.servlet.jsp.JspException
;
import
org.springframework.beans.BeanWrapper
;
...
...
@@ -258,7 +257,7 @@ class OptionWriter {
/**
* Determine whether the option fields should be disabled.
*/
protected
boolean
isOptionDisabled
()
{
protected
boolean
isOptionDisabled
()
throws
JspException
{
return
false
;
}
...
...
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/OptionsTag.java
浏览文件 @
4d897e7a
...
...
@@ -138,8 +138,8 @@ public class OptionsTag extends AbstractHtmlElementTag {
* Is the current HTML tag disabled?
* @return <code>true</code> if this tag is disabled
*/
protected
boolean
isDisabled
()
{
return
"true"
.
equals
(
getDisabled
());
protected
boolean
isDisabled
()
throws
JspException
{
return
evaluateBoolean
(
"disabled"
,
getDisabled
());
}
...
...
@@ -149,7 +149,7 @@ public class OptionsTag extends AbstractHtmlElementTag {
Object
items
=
getItems
();
Object
itemsObject
=
null
;
if
(
items
!=
null
)
{
itemsObject
=
(
items
instanceof
String
?
evaluate
(
"items"
,
(
String
)
items
)
:
items
);
itemsObject
=
(
items
instanceof
String
?
evaluate
(
"items"
,
items
)
:
items
);
}
else
{
Class
<?>
selectTagBoundType
=
((
SelectTag
)
findAncestorWithClass
(
this
,
SelectTag
.
class
))
.
getBindStatus
().
getValueType
();
...
...
@@ -204,7 +204,7 @@ public class OptionsTag extends AbstractHtmlElementTag {
}
@Override
protected
boolean
isOptionDisabled
()
{
protected
boolean
isOptionDisabled
()
throws
JspException
{
return
isDisabled
();
}
...
...
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/SelectTag.java
浏览文件 @
4d897e7a
/*
* Copyright 2002-20
08
the original author or authors.
* Copyright 2002-20
10
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -18,7 +18,6 @@ package org.springframework.web.servlet.tags.form;
import
java.util.Collection
;
import
java.util.Map
;
import
javax.servlet.jsp.JspException
;
import
org.springframework.util.ObjectUtils
;
...
...
@@ -247,12 +246,11 @@ public class SelectTag extends AbstractHtmlInputElementTag {
private
boolean
isMultiple
()
throws
JspException
{
Object
multiple
=
getMultiple
();
if
(
Boolean
.
TRUE
.
equals
(
multiple
)
||
"
true"
.
equals
(
multiple
)
||
"
multiple"
.
equals
(
multiple
))
{
if
(
Boolean
.
TRUE
.
equals
(
multiple
)
||
"multiple"
.
equals
(
multiple
))
{
return
true
;
}
else
if
(
this
.
multiple
instanceof
String
)
{
Object
evaluatedValue
=
evaluate
(
"multiple"
,
multiple
);
return
Boolean
.
TRUE
.
equals
(
evaluatedValue
);
return
evaluateBoolean
(
"multiple"
,
(
String
)
multiple
);
}
return
forceMultiple
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录