struts2 - How do you compare 2 struts param in a struts if -
i'm still pretty new struts , having trouble trying compare 2 struts params in struts if statement. trying find if current year param equal checkyear param
if equal want execute code. if not equal execute other code..
sample code:
<s:param name="currentyear"> <s:date name="%{new java.util.date()}" format="yyyy" /> </s:param> <s:param name="checkyear"> <s:date format="yyyy" name="#year"/> </s:param> <s:if test="${checkyear == legendyear}"> code executed </s:if>
i don't understand purpose of '$','%', or '{}' in test part of if statement if or how need apply have check params.
thank in advance!
inside struts2 tags, use ognl. refer small language guide see how works.
in ognl, %{}
means want force evaluation of expression; needed somewhere, while superfluos somewhere else. in <s:if/>
, not needed, because test=""
evaluate content default.
${}
not exists in ognl, jsp el. search on stackoverflow nice answer on if curious.
{}
alone in ognl list projection... don't need now.
Comments
Post a Comment