У меня возникла проблема с проверкой формы JSF в bootstrap modal. Это код из него:Проверка формы JSF с помощью Bootstrap modal - modal закрывается
<div id="loginmodal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h1 class="text-center">Logowanie</h1>
</div>
<div class="modal-body">
<h:form id="loginForm" class="form col-md-12 center-block">
<div class="form-group">
<h:inputText id="login" class="form-control input-lg" a:placeholder="Login" value="#{loginHelper.login}" required="true" requiredMessage="Pole "login" jest wymagane.">
<f:ajax event="blur" render="loginMessage"/>
</h:inputText>
<h:message id="loginMessage" for="login" style="color: red;"/>
</div>
<div class="form-group">
<h:inputSecret id="haslo" class="form-control input-lg" a:placeholder="Hasło" value="#{loginHelper.haslo}" required="true" requiredMessage="Pole "hasło" jest wymagane.">
<f:ajax event="blur" render="hasloMessage"/>
</h:inputSecret>
<h:message id="hasloMessage" for="haslo" style="color: red;"/>
</div>
<div class="form-group">
<p:commandButton class="btn btn-primary btn-lg btn-block" type="submit" value="Zaloguj" action="#{loginHelper.validate}" id="zaloguj"/>
<h:message for="zaloguj" style="color: red;"/>
<span class="pull-right"><a href="#" data-toggle="modal" data-target="#registermodal">Zarejestruj się</a></span>
</div>
</h:form>
</div>
<div class="modal-footer">
<div class="col-md-12">
<button class="btn" data-dismiss="modal" aria-hidden="true">Anuluj</button>
</div>
</div>
</div>
</div>
</div>
Если я использую PrimeFaces р: CommandButton, диалоговое окно не закрывается, когда проверка не пройдена, но не отображается сообщение. С другой стороны, если я использую обычный h: commandButton, диалог всегда закрывается, и вся страница обновляется. После перезагрузки страницы сообщения о проблемах проверки отображаются в диалоговом окне, но мне нужно нажать кнопку, чтобы снова отобразить диалоговое окно.
Что я пытаюсь сказать, это то, что мне нужен простой способ предотвратить закрытие диалогового окна при ошибке проверки, а также динамически показывать ошибки проверки. Как я могу это достичь?