This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

custom converter  RSS feed

 
rosaria italia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, my problem is custom converter:
my faces-config:
<converter>
<description> Prova Converter </description>
<converter-id>TelephoneNumber</converter-id>
<converter-class>
it.istream.jsf.PhoneNumberConverter
</converter-class>
</converter>

my class
public class PhoneNumberConverter {
public Object getAsObject(FacesContext ctx, UIComponent component, String value){....}
public String getAsString(FacesContext ctx, UIComponent component, Object value) {...}
my jsp<h utputText value="TEL" styleClass="tabHeaderBlack"></h utputText>
<h:inputText id="tel" required="true" >
<f:converter converterId="TelephoneNumber" />
</h:inputText>

WHY I have this error?


javax.servlet.ServletException: javax.servlet.jsp.JspException: null
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:842)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.editUser_jsp._jspService(editUser_jsp.java:330)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)


root cause

java.lang.ClassCastException
com.sun.faces.application.ApplicationImpl.createConverter(ApplicationImpl.java:452)
javax.faces.webapp.ConverterTag.createConverter(ConverterTag.java:166)
javax.faces.webapp.ConverterTag.doStartTag(ConverterTag.java:110)
org.apache.jsp.editUser_jsp._jspx_meth_f_converter_0(editUser_jsp.java:896)
org.apache.jsp.editUser_jsp._jspx_meth_h_inputText_4(editUser_jsp.java:876)
org.apache.jsp.editUser_jsp._jspService(editUser_jsp.java:261)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did your class implements the Converter interface ?

Thanks,
 
rosaria italia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rajeev!

Now I have other problems, as soon possible I'll send an other reply for to explain mistakes...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!