开发者

empty keyword in Struts

开发者 https://www.devze.com 2023-01-20 02:06 出处:网络
Is there an empty keyword in Struts 2 (like in JSP)? For example in JSP I write: <c:if test=\"${empty var}\">

Is there an empty keyword in Struts 2 (like in JSP)?

For example in JSP I write:

<c:if test="${empty var}">

Thanks开发者_JAVA技巧


Just test for null.

And to acheive the same effect than the JSTL empty keyword with strings (which means "null or empty"), you need two checks (yes it is tiresome):

<s:if test="foo != null && foo != ''">
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号