Vote count:
0
I have a JPA Entity, and in this entity I have a field that is Annotated by:
import javax.persistence.*;
....
@Column(nullable=false, unique=true)
private String name;
Then I have a form on a XHTML Page wich the following form:
<h:form>
<p:panel header="Party Creation">
<h:panelGrid columns="3" id="regGrid">
<h:outputLabel for="name">Name: </h:outputLabel>
<p:inputText id="name" value="#{partyCreationBean.party.name}" />
<h:message for="name" />
When the form is submitted, the system will call the following method
private Party createNewParty(PartyDTO party_dto) {
Party p = new Party(party_dto);
em.persist(p);
....
Everything is working fine. If i try to insert a name that is already present in the database, then i will have an exception on the console (but i will not see anything on the page).
My problem is thet I'd like to show a message on the
but i have no idea about how to do. Maybe i can catch the exception but then i don't know how to make the message appear, but also I tought that should be a more elegant way than catch the Exception... Anyway, how shall i do it?!
thankyou very much in advance, Samuele.
asked 1 min ago
Aucun commentaire:
Enregistrer un commentaire