[jboss-user] [JBoss Seam] - Error during model data update
yoav200
do-not-reply at jboss.com
Wed Jan 10 10:50:29 EST 2007
I'm struggling this problem for some time now...
Here is my code that generates the problem, I must add that NO exception is thrown, the console is silent...
| @Stateful
| @Name("tripsManager")
| @Interceptors(SeamInterceptor.class)
| public class TripsManagerBean implements TripsManagerLocal, Serializable {
|
|
| @Logger
| private Log logger;
|
| @EJB
| TripServiceLocal tripService;
|
| @RequestParameter
| Long id;
|
| @DataModel
| List<Trip> tripList;
|
| @DataModelSelection
| @Out(required = false,scope=ScopeType.CONVERSATION)
| private Trip selectedTrip;
|
|
| public TripsManagerBean() {
| super();
| }
|
|
| @Factory("tripList")
| public void findTripsByUser() {
| logger.info("Getting trip list...");
| tripList = tripService.findTripsByUser(userName);
| }
|
| public String selectTrip() {
| logger.info("Selected trip: " + selectedTrip.getId());
| return "selectTrip";
| }
|
| public String selectTripForEdit() {
| logger.info("Selected trip: " + selectedTrip.getId());
| return null;
| }
|
| public void editTrip() {
|
| try {
| tripService.updateTripDetails(selectedTrip);
|
| logger.info("edit trip " + selectedTrip.getId() + " successfully");
| } catch (Exception e) {
| logger.error("fail to edit trip", e);
|
| }
| }
|
| public void deleteTrip() {
| try {
| tripService.deleteTrip(selectedTrip);
| tripList.remove(selectedTrip);
| logger.info("delete trip " + selectedTrip.getId() + " successfully");
| } catch (Exception e) {
| logger.error("fail to delete Trip", e);
| }
| }
|
| public void cancel() {
| // TODO Auto-generated method stub
|
| }
|
| @Remove
| @Destroy
| public void destroy() {
| }
| }
|
| @Stateless
| @Name("tripEdit")
| @Interceptors(SeamInterceptor.class)
| public class TripEditAction implements TripEditLocal,Serializable {
|
|
| public static final int ACTION_SUCCESS = 100;
|
| public static final int ACTION_FAIL = 101;
|
| @Logger
| private Log logger;
|
| @EJB
| TripServiceLocal tripService;
|
| @In(create=true, scope=ScopeType.CONVERSATION)
| Trip selectedTrip;
|
| private int responseStatus;
|
| public TripEditAction() {
| super();
| }
|
| public int getResponseStatus() {
| return responseStatus;
| }
|
| public void setResponseStatus(int responseStatus) {
| this.responseStatus = responseStatus;
| }
|
| public void editTrip() {
| setResponseStatus(ACTION_FAIL);
| try {
| tripService.updateTripDetails(selectedTrip);
| setResponseStatus(ACTION_SUCCESS);
| logger.info("edit trip " + selectedTrip.getId() + " successfully");
| } catch (Exception e) {
| logger.error("fail to edit trip", e);
| setResponseStatus(ACTION_FAIL);
| }
| }
|
| public void cancel() {
| logger.error("Clear add new trip Form");
| }
|
| }
my web page is this:
| <t:div styleClass="content">
| <h:outputText value="<h3>Edit Trip</h3>" escape="false" />
| <t:div styleClass="inner_content_green medium" style="background-color:#FFFFFF;">
| <h:form id="editTripForm">
|
| <h:panelGrid id="editTripTable" columns="2" border="0" style="width:99%;">
| <h:panelGroup>
| <h:outputText value="Trip name<br/>" escape="false" />
| <t:inputText id="name" value="#{selectedTrip.name}" styleClass="text" required="true" />
| <t:inputHidden id="id" value="#{selectedTrip.id}" />
| <t:inputHidden id="responseStatus" value="#{tripEdit.responseStatus}" />
| <h:outputText value="<br/>" escape="false" />
| <t:message for="name" styleClass="errorMsg" forceSpan="true" >
| <h:outputText value=" " escape="false"/>
| </t:message>
| </h:panelGroup>
| <h:panelGroup>
| <h:outputText value="Date:<br/>" escape="false" />
| <h:inputText id="startDate" value="#{selectedTrip.startDate.time}" styleClass="text" required="true">
| <f:convertDateTime pattern="dd/MM/yyyy"/>
| </h:inputText>
| <h:graphicImage url="images/calendar/calendar.gif"
| alt="Click to open Calendar"
| onclick="displayCalendar(document.getElementById('editTripView:editTripForm:startDate'),'dd/mm/yyyy',this)"
| style="border:0px;vertical-align:top;"/>
| <t:message for="startDate" styleClass="errorMsg" forceSpan="true" >
| <h:outputText value=" " escape="false"/>
| </t:message>
| </h:panelGroup>
|
| <h:panelGroup>
| <h:outputText value="Country<br/>" escape="false" />
| <h:inputText id="country" value="#{selectedTrip.country}" styleClass="text" required="true"/>
| <h:outputText value="<br/>" escape="false" />
| <t:message for="country" styleClass="errorMsg" forceSpan="true" >
| <h:outputText value=" " escape="false"/>
| </t:message>
| </h:panelGroup>
| <h:panelGroup>
| <h:outputText value="City<br/>" escape="false" />
| <h:inputText id="city" value="#{selectedTrip.city}" styleClass="text" required="true"/>
| <h:outputText value="<br/>" escape="false" />
| <t:message for="city" styleClass="errorMsg" forceSpan="true" >
| <h:outputText value=" " escape="false"/>
| </t:message>
| </h:panelGroup>
|
| <a4j:commandButton value="Edit Trip"
| action="#{tripEdit.editTrip}"
| styleClass="submit"
| reRender="myTripsTable,editTripTable"
| oncomplete="checkResponseStatus('editTripView:editTripForm:responseStatus');" />
|
| <a4j:commandButton value="Cancel"
| action="#{tripEdit.cancel}"
| styleClass="submit"
| reRender="editTripTable"
| onclick="closePopup();return false;" />
|
| </h:panelGrid>
| </h:form>
| </t:div>
| </t:div>
| </f:subview>
|
When I try to save changes (press Edit Trip button) I get "Error during model data update" for all fields.
I really don't understand what the problem is, every thing looks fine. Or is it???
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4000007#4000007
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4000007
More information about the jboss-user
mailing list