开发者

checking equality of value from property file in JSP

开发者 https://www.devze.com 2023-03-23 06:44 出处:网络
I am usi开发者_开发技巧ng property file for customizing messages, mean while I am setting priority in the property file, can I test the equality of priority in JSP using <c:if> tag. for message

I am usi开发者_开发技巧ng property file for customizing messages, mean while I am setting priority in the property file, can I test the equality of priority in JSP using <c:if> tag. for message display in JSP I am using <fmt:message> tag.

eg:

in property file:

priority.key=1

in jsp:

<c:if "<fmt:message "priority.key"\> ==1" >Hi</c:if> 


The <fmt:message> has a var attribute which allows you to set the bundle value as a page scoped variable.

<fmt:message key="priority.key" var="priorityKey" />

This way it's available by ${priorityKey}. You could then just use it as such in the <c:if>.

<c:if test="${priorityKey == 1}">Hi</c:if>


May be this combination will help you:

http://www.roseindia.net/jstl/jstl-el.shtml and http://www.roseindia.net/jsp/simple-jsp-example/JSTLPropertyAccess.shtml

Personally for me it is very hard to understand your question. Please add more description or code.

0

精彩评论

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

关注公众号