• Post Reply Bookmark Topic Watch Topic
  • New Topic

Bind JSF Component to XML data element

 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi Guys,

I am looking for solution like xforms where we can bind input component to our xml data model but should work with JSF.

If I explain in other way, In my managed bean I have a field for whole xml data, (may be xml as String, Stream, JSON, or DOM Document) and from my view (xhtml) I need to access / display some xml element using xpath or similar technique.

eg,

model
<employee>
<id>01</id>
<name>Mali</name>
</employee>

view
<h:input value"//employee/name">

Why I need such solution,
My Java Model is very dynamic, which can be changed from client to client, So I like to pass data in xml, and store in xml format, (db2, oracle supports xml data), So I need change only view, and keep services untouch,

Thanks
 
Tim Holloway
Bartender
Posts: 18417
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, you might be better off using Cocoon, which is designed for XML, rather than JSF.

JSF is designed to run as a classical Model/View/Controller framework using JavaBeans (POJOs) for the models. You can adapt JSF to an XML backend using something like JAXB to convert the underlying XML to a directed graph of POJOs. And take advantage of the fact that JSF View EL isn't compiled until run-time to reduce dependency on pre-defined objects and properties. However, it would take a fair amount of care to make a workable framework out of that, so I'd definitely look at Cocoon first.
 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:Actually, you might be better off using Cocoon, which is designed for XML, rather than JSF.

JSF is designed to run as a classical Model/View/Controller framework using JavaBeans (POJOs) for the models. You can adapt JSF to an XML backend using something like JAXB to convert the underlying XML to a directed graph of POJOs. And take advantage of the fact that JSF View EL isn't compiled until run-time to reduce dependency on pre-defined objects and properties. However, it would take a fair amount of care to make a workable framework out of that, so I'd definitely look at Cocoon first.


Hi Tim,

Thanks for the prompt reply.

JAXB would not work for me since I will have to change to core model. I will look into Cocoon.

Thanks again.
Chaminda
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!