问题是:在我的action类中,我有一个变量:
private String commentAdd = "yes";
动作类转到reslut.jsp,在reslut.jsp中我有:
<s:set name="allowAddComment" value="commentAdd"/>
<s:if test="%{#allowAddComment=='yes'}">
<script type="text/javascript">
window.close();
</script>
</s:if>
但是它不起作用,专家能给我一些建议吗?谢谢。
发布于 2012-02-24 15:31:29
几件事。
你确定这真的是你想要的吗?这将在呈现该JavaScript后立即关闭窗口。如果这没问题,那就没问题--尽管如果是这样的话,为什么还要费心渲染窗口呢?
发布于 2012-02-24 15:52:33
import com.opensymphony.xwork2.ActionSupport;
public class PageAction extends ActionSupport {
private static final long serialVersionUID = 1L;
private boolean addComment;
public boolean isAddComment() {
return addComment;
}
public void setAddComment(boolean addComment) {
this.addComment = addComment;
}
public String execute() {
return SUCCESS;
}
}
<s:if test="%{addComment}">
<script type="text/javascript">
window.close();
</script>
</s:if>
https://stackoverflow.com/questions/9432417
复制