0
私はSpringコントローラで設定されているフリーメーカのa属性の値をチェックしています。フリーメーカ "if" nullの条件
@RequestMapping(value = PATH, method = RequestMethod.GET)
public String doAction(@RequestParam(name = EMAIL, required = false) String email,
RedirectAttributes redirectAttributes) {
//Some actions
...
...
redirectAttributes.addAttribute("token", "token");
return AUTH_OAUTH_PW_PATH + VERIFY_PATH;
}
The freemarker check is like:
The html component should appear only if the value of the attribute "token" is not found.
<#if !(token?has_content)>
<br></br>
<div id="divId">
<p><a href="link" id="id1">Hello</a></p>
</div>
</#if>
トークンに値が設定されていない場合でも、ftlハイパーリンクが表示されます。
OPは 'token'がある場合、それは*見つからない*現れるべきであると述べました。 (しかし、 '!token?has_content'はもっと冗長であっても、' null'のために 'true'でなければなりません。なぜなら、それがなぜ機能しないのか確かめてください。) – ddekany
私はこれを試しました。 htmlが消える。 –