问题描述
现在,如果我在 Struts2 中使用 <s:if> 标记,我可以获得任何想要的结果
Now I can get any desired results if I use the <s:if> tag in Struts2
<s:if test="status==1"> //do some stuff </s:if>
但我不知道如何让当前执行的动作,我期待像
but I don't know how to get the action currently executed, I am expecting like
<s:if test="action==addaction"> //do some stuff </s:if>
推荐答案
可以从上下文中获取动作名称
You can get action name from the context
<s:if test="#context['struts.actionMapping'].name=='addaction'"> do some stuff </s:if>