这个问题在这里已有答案:
我有一个复合控制如下;
<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和复合控件呈现为预期的方式 . 但是当在Glassfish服务器上发生异常后向xhtml发出请求时:
java.lang.IllegalStateException:PWC3999:在提交响应后无法创建会话 .
可能是什么原因?当我删除javascript函数时不会发生异常 .
1 回答
在复合控件中添加以下预呈现侦听器,
在侦听器功能中,
重新启动会话 . 谢谢@BalusC .