dev@jsftemplating.java.net

Re: Pleas can you help

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Thu, 29 Nov 2007 10:24:11 -0800

Hi Stuart,

If you're not already on the dev_at_jsftemplating.dev.java.net email alias,
you may want to join that list. You can find it on the JSFT web site
(https://jsftemplating.dev.java.net).

The problem is that JSFT does wrap MethodExpressions automatically by
default. For now, it's up to the individual ComponentFactory's to
create a MethodExpression (instead of a ValueBinding, which it does do
by default). I may enhance JSFT to try to do this correctly in the
future... at least for action/actionListener properties, which are standard.

There are 2 easy ways around this problem, and probably many other
approaches as well. The reason this issue hasn't been targeted to be
addressed sooner is that most JSFTemplating developers use the "command"
event instead of using an action/actionListener. To do this you would do:

<webuijsf:hyperlink action="gosomewhere">
    <ui:event type="command">
       navigate("/nextPage.jsf");
    </ui:event>
</webuijsf:hyperlink>

No need for any faces-config.xml file entries at all. Instead of
"navigate" you can also do "redirect". And... you may also do any king
of processing you can think of. You can have as many handlers per event
as you'd like... they get executed in the order you write them. You can
do coditionals if ("#{something}=foo") { doThis(); }, etc. There is
some information on this at: https://jsftemplating.dev.java.net/doc/
More information on this will be published soon (I plan to focus on this
during my Christmas vacation).

The 2nd way to get around this problem uses a special syntax to create a
MethodExpression from within the template file:

    <webuijsf:hyperlink action="$methodExpression{gosomewhere}" />

That should work for an "action" property. The following should work
for an actionListener property:

    <webuijsf:hyperlink action="$methodExpression{gosomewhere,true}" />

For a MethodBinding (only works for actionListener property on JSF 1.1
components):

    <webuijsf:hyperlink action="$methodBinding{gosomewhere}" />

I hope this helps... let me (and the rest of the dev_at_jsftemplating email
list) know if you have more questions / problems. I am taking time off
at the moment to do some work on my house... so I may not respond
quickly. The email list is your best resource.

Good luck!

Ken

Stuart Russell wrote:
> Hi ken
> Im a senior j2ee architect within engineering and I require your
> assistence if possible,
>
> Basically I have had to convert a facelets app over to using
> jsftemplating to allow the woodstock components + dynafaces to
> function correctly.
> I am getting the error within my application
>
> *type* Exception report
>
> *message*
>
> *description* _The server encountered an internal error () that
> prevented it from fulfilling this request._
>
> *exception*
>
> org.apache.jasper.JasperException: javax.servlet.ServletException:
> Could not find type conversion for type "class
> javax.faces.el.MethodBinding" (value = "sqlReports"
> org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:532)
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:408)
>
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
>
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
> *root cause*
>
> javax.servlet.ServletException: Could not find type conversion for
> type "class javax.faces.el.MethodBinding" (value = "sqlReports"
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
> org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:699)
>
> org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:670)
>
> org.apache.jsp.index_jsp._jspService(index_jsp.java:54)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
>
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
>
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
> *root cause*
>
> java.lang.IllegalArgumentException: Could not find type conversion for
> type "class javax.faces.el.MethodBinding" (value = "sqlReports"
> com.sun.jsftemplating.util.TypeConverter.asType(TypeConverter.java:260)
>
> com.sun.jsftemplating.component.factory.ComponentFactoryBase.setOption(ComponentFactoryBase.java:169)
>
> com.sun.jsftemplating.component.factory.ComponentFactoryBase.setOptions(ComponentFactoryBase.java:104)
>
> com.sun.jsftemplating.component.factory.basic.GenericFactory.create(GenericFactory.java:86)
>
> com.sun.jsftemplating.component.ComponentUtil.createChildComponent(ComponentUtil.java:397)
>
> com.sun.jsftemplating.layout.descriptors.LayoutComponent.getChild(LayoutComponent.java:277)
>
> com.sun.jsftemplating.layout.LayoutViewHandler.buildUIComponentTree(LayoutViewHandler.java:528)
>
> com.sun.jsftemplating.layout.LayoutViewHandler.buildUIComponentTree(LayoutViewHandler.java:543)
>
> com.sun.jsftemplating.layout.LayoutViewHandler.buildUIComponentTree(LayoutViewHandler.java:543)
>
> com.sun.jsftemplating.layout.LayoutViewHandler.buildUIComponentTree(LayoutViewHandler.java:482)
>
> com.sun.jsftemplating.layout.LayoutViewHandler.buildUIComponentTree(LayoutViewHandler.java:520)
>
> com.sun.jsftemplating.layout.LayoutViewHandler.buildUIComponentTree(LayoutViewHandler.java:543)
>
> com.sun.jsftemplating.layout.LayoutViewHandler.buildUIComponentTree(LayoutViewHandler.java:543)
>
> com.sun.jsftemplating.layout.LayoutViewHandler.buildUIComponentTree(LayoutViewHandler.java:543)
>
> com.sun.jsftemplating.layout.LayoutViewHandler.buildUIComponentTree(LayoutViewHandler.java:543)
>
> com.sun.jsftemplating.layout.LayoutViewHandler.buildUIComponentTree(LayoutViewHandler.java:482)
>
> com.sun.jsftemplating.layout.LayoutViewHandler.createView(LayoutViewHandler.java:234)
>
> com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:201)
>
> com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248)
> com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
> com.sun.faces.extensions.avatar.lifecycle.PartialTraversalLifecycle.execute(PartialTraversalLifecycle.java:94)
>
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
> org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:699)
>
> org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:670)
>
> org.apache.jsp.index_jsp._jspService(index_jsp.java:54)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
>
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
>
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>
> *note* _The full stack trace of the root cause is available in the
> Apache Tomcat/6.0.10 logs._
>
>
> This is caused by the action= or actionExpression= on any one of my
> components
> eg <webuijsf:hyperlink action="gosomewhere" />
>
> I obviously have this defined in my faces config file to redirect to
> another page.
>
> I am completely dead in the water as there is little in the way of
> documentation to using facelets syntax within jsftemplating ( which
> seems to work ).
>
> I have no idea what I have to set up within my web.xml to activate
> templating . Do i requre something else ??
>
>
> I would really appreciate your help in this matter as I am getting
> pressure to complete this project .
>
> Thanks
> Stu
>
>