• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Bind JSF Component to XML data element

 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Farmers know to never drive a tractor near a honey locust tree. But a tiny ad is okay:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic