0

I'd like to build VXML using JSF2.0 but I didn't find any supporting tags. What we've proposed is writing xhtml pages with vxml data (having references to backing bean where ever value needs to get replaced) by having content type as 'text/xml' so client can read the xml directly.

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">

<f:view contentType="text/xml">
    <vxml>
         <log>Caught the event </log>
         <prompt bargein="true">
            <audio src="built-in: #{myBackingBean.prompt}" />
         </prompt>
    </vxml>
</f:view>
</html>

But when ever I try to launch above xhtml page in a browser or using a REST webservice client -

1) I'm not seeing xml returned. But just Caught the event as output in browser. REST client is not seeing any output. 2) myBackingBean.prompt value is not getting replaced

Can any one suggest please? We do not want to use plain old servlets to construct the xml. We'd like to write XML manually but need values to be replaced from backing bean.

MyFist
  • 413
  • 7
  • 19
  • You're using a HTML base in order to render your xml. Use `ui:composition` directly instead. Have a [look](http://stackoverflow.com/a/25780442/1199132). – Aritz Apr 21 '15 at 07:24
  • In fact I've seen your other post already and tried with `ui:composition` in vain. I could still see output as 'Caught the event'. – MyFist Apr 21 '15 at 07:29
  • Open the page source code in your browser and see what you're getting right now. – Aritz Apr 21 '15 at 07:31
  • I could see all my xslt content as is in view source. How ever browser is just showing 'Caught the event'. Also noticed #{myBackingBean.prompt} is not displaying the value returned by backing bean. Am I missing some thing? – MyFist Apr 21 '15 at 07:40
  • Then your JSF servlet is not being hit for some reason. You probably misconfigured it, check out your web.xml. The `FacesServlet` class must be invoked. – Aritz Apr 21 '15 at 07:44
  • OK. Now error seems to be generating blank html as follows. Not sure why content type is still coming as text/html. - – MyFist Apr 21 '15 at 08:27
  • Thanks. It all worked now. Issue seems to be the page am pointing. After changing the url-pattern to /faces/pages/page1.xhtml it worked. How ever my web.xml has url-patterns /faces/* and *.xhtml pointing to FacesServlet but it doesn't seems to be redirecting *xhtml to FacesServlet. Any idea? – MyFist Apr 21 '15 at 08:54

0 Answers0