【发布时间】:2013-06-07 17:08:56
【问题描述】:
我有一个复合控件如下;
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:h="http://java.sun.com/jsf/html">
<composite:interface>
<composite:attribute name="validatorId"/>
<composite:attribute name="message"/>
</composite:interface>
<composite:implementation>
<div>
<script type="text/javascript">
function #{cc.attrs.validatorId}(){alert('why is it not working :(');};
</script>
<div style="background-color: #F2DEDE;color: #b94a48;border-style: solid;border-color: #FAC3CB;border-width: 1.8px;font-family: Arial;
font-size: 12px;height:17px;vertical-align: middle;padding-left: 8px;padding-right: 8px;padding-top: 2px;display: none;"
id="#{cc.attrs.validatorId}">
#{cc.attrs.message}
<img src="images/close-mini.png" style="cursor: pointer;padding-left: 5px;"/>
</div>
</div>
</composite:implementation> </html>
此控件放置在 xhtml 文件中。javascript 和复合控件按预期方式呈现。但是当向 xhtml 发出请求时,Glassfish 服务器会出现以下异常:
java.lang.IllegalStateException:PWC3999:提交响应后无法创建会话。
可能是什么原因?当我删除javascript函数时不会发生异常。
【问题讨论】:
-
你能包含整个堆栈跟踪吗?
-
stackoverflow.com/… 的副本。添加 JS 代码时发生的事情纯属巧合。当您添加相同数量的纯 HTML 甚至纯文本字节时,也会发生这种情况。