Hi, I have a page that contains two forms, one for search and one for 
save/update.  If I use a single entity instance for both forms, everything 
works well enough, but the search field is sync'd with the save/update field.  
If I try to have two entity instances (one for the search form, one for the 
save/update form) I get a:

javax.el.PropertyNotFoundException: /lender.xhtml @22,71 
value="#{searchLender.lenderCode}": Target Unreachable, identifier 
'searchLender' resolved to null

LenderManagerAction:
        @In
  |     private Lender searchLender;
  | 
  |     @In
  |     private Lender lender;
  | 
  |     @In
  |     private FacesMessages facesMessages;
  | 
  |     public String search()
  |     {
  |             Query query = 
entityManager.createNamedQuery(Lender.class.getSimpleName() + ".findByCode");
  |             query.setParameter("lenderCode", searchLender.getLenderCode());
  |             try {
  |                     lender = (Lender)query.getSingleResult();
  |             } catch (NoResultException e) {
  |                     logger.info(e.getMessage());
  |                     facesMessages.add("Lender not found for code:  " + 
searchLender.getLenderCode());
  |                     return null;
  |             }
  |             return PAGE_LENDER;
  |     }
  | 

lender.xhtml:

        <h:panelGrid columns="2" rowClasses="prop" columnClasses="name,value">
  |             <h:outputLabel for="searchLender">Lender Code</h:outputLabel>
  |             <h:inputText value="#{searchLender.lenderCode}" size="6"/>
  |         </h:panelGrid>
  |         <div class="actionButtons">
  |             <h:commandButton type="submit" value="Search" 
action="#{lenderManager.search}"/>
  |         </div>
  | 

All I have to do to make this work is remove "searchLender" from the session 
bean, and point the search form to the common "lender" entity.  Is there a 
problem with having two instances of the same entity type?

Thanks,

Jon

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104687#4104687

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104687
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to