views:

297

answers:

0

Hello

In my webapp I've just inserted some <rich:inplaceInput> elements to allow XML JAXB unmarshalled data coming into a table to be editable.

Briefly:

<h:outputText value="Directory:" />
<rich:inplaceInput value="#{f.dir}"
    defaultLabel="click to edit" showControls="true">
    <a4j:support event="onviewactivated" reRender="table" />
</rich:inplaceInput>

<h:outputText value="Remap:" />
<rich:inplaceInput value="#{f.remap}"
    defaultLabel="click to edit" showControls="true">
    <a4j:support event="onviewactivated" reRender="table" />
</rich:inplaceInput>

This all goes ok, and at render I see both components correctly allowing me to edit them inplace. In the xml I've pulled out though #{f.remap} is null. I get

Directory: /path/to/dir
Remap:     click to edit

Now if I click and edit either field and enter text or leave them blank or empty them of contents, on pressing enter or clicking the tick, the app crashes with this:

SEVERE: JSF1054: (Phase ID: PROCESS_VALIDATIONS 3, View ID: /index.xhtml) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@1ad552c]
20-Apr-2010 12:16:20 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Faces Servlet threw exception
javax.el.PropertyNotFoundException: /nodeConfig.xhtml @128,61 value="#{f.remap}": Target Unreachable, 'remap' returned null
    at com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)..

because the remap tag was missing from that element subtree in the processed XML file.

What's the best way to overcome this problem? I'd like it so that if someone changes the Directory, but leaves remap alone, the marshalled XML file gets a new dir but the remap tags are still missing. But if someone enters data into the remap, I'd like to create an instance of a remapType class from my JAXB'd schema ready for the associated XML tags to be added in when marshalling.

I'm thinking validation's required but I can see from the RF demo there's a <rich:ajaxValidator>, <a4j:support> validation, there's a validator attribute for the <rich:inplaceInput> and there's a separate bean validation so I'm a bit confused about my options. I'm not using Seam or Hibernate. Any help appreciated.