Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in custom taglib

 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
THE TAG HANDLER CLASS




THE TLD FILE


THE JSP FILE


THE ERROR MESSAGE
HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
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)

root cause

java.lang.NullPointerException
foo.AdvisorTagHandler.doTag(AdvisorTagHandler.java:22)
org.apache.jsp.callTagWithBody_jsp._jspx_meth_jose_twb_0(callTagWithBody_jsp.java:91)
org.apache.jsp.callTagWithBody_jsp._jspService(callTagWithBody_jsp.java:53)
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)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
Apache Tomcat/5.0.28


The error is pointed to this line


I guess the movieList object is not being recieved from the JSP page to the handler class. I do not know how to make it recieve.

could you help?

ARUL JOSE

[ July 22, 2005: Message edited by: Arul Jose ]
[ July 22, 2005: Message edited by: Bear Bibeault ]
 
Shrinivas Mujumdar
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
By looking at a code it sounds that it should work, perhaps one more way of making a list available to tagHandler would be put this list in a session like
In JSP:
session.setAttribute("movieList",movieList);

In Handler
movieList=(ArrayList)pageContext.getSession().getAttribute("movieList");


regards
Shrinivas
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
perhaps one more way of making a list available to tagHandler would be put this list in a session


Ga! What a messy work-around. Better to find the real problem than resort to something like that.

Arul, your JSP is full of syntax errors. I'm not sure if they're really there or if you were sloppy in writing your post. But look carefully at this line:

<jose:twb movieList="{movieList}" />


Also, in your TLD, I believe that you need to enable rt-expressions for the attribute.
 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I changed the tld file. i added the <rtexprvalue> true </rtexprvalue> line.

its still not working out.

you have said

Arul, your JSP is full of syntax errors. I'm not sure if they're really there or if you were sloppy in writing your post.


i have just copied and pasted the code.

i could not find any other error. please help.

ARUL JOSE
 
Stefan Evans
Bartender
Posts: 1691
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would also register reservations about passing null in this method:
getJspBody().invoke(null);

That couldn't be the source of the null pointer exception could it?
 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
passing null here is to give output to the browser. you can read about it.
 
Sushma Sharma
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Arul,
problem in your code is that you are not checking for movieList to be null in your tag code(doTag() method)...
as in your first invocation of your tag, you are passing only user, the tag will find movieList to be null and it will throw you NullPointerException when you do "movieList.iterator()"...
your could should be



hope this helps
 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
think you did a great reading. Thank you so much.

i also noticed this problem later. now i have corrected it.

now my jsp file is



This is the error message :

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: jsp.error.beans.property.conversion
org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:885)
org.apache.jsp.callTagWithBody_jsp._jspx_meth_jose_twb_0(callTagWithBody_jsp.java:83)
org.apache.jsp.callTagWithBody_jsp._jspService(callTagWithBody_jsp.java:60)
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)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
Apache Tomcat/5.0.28
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the specification now mandates both getter and setter methods for all tag attributes defined in the tld (which you dont have in your tag class)

cheers,
ram.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. Getters are not required.
 
Sushma Sharma
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
arul,

you are not using the correct syntax for EL in your JSP

<jose:twb user="aruljose" movieList="{request.movieList}" />

here it should be ${request.movieList} instead of {request.movieList}

hope it works now
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said earlier, check your JSP for simple syntax errors such as this. You should not be needing to rely upon others to find out where you forgot a $.
 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. i corrected it.



still gettin error

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: jsp.error.beans.property.conversion
org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:885)
org.apache.jsp.callTagWithBody_jsp._jspx_meth_jose_twb_0(callTagWithBody_jsp.java:83)
org.apache.jsp.callTagWithBody_jsp._jspService(callTagWithBody_jsp.java:60)
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)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
Apache Tomcat/5.0.28
 
len atwood
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i have the same problem. my jsp code segment is:

<%@ taglib uri="table_jsp.tld" prefix="tbl" %>
<jsp:useBean id="tableSrc" class="mytable.SimpleTable"
type="mytable.TableDataSource" scope="session" />

<tbl:table rows="10" border="1"
datasource="${tableSrc.source}" />


any help would be greatly appreciated
len

org.apache.jasper.JasperException: jsp.error.beans.property.conversion
org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:885)
org.apache.jsp.tbl_jsp._jspx_meth_tbl_table_0(org.apache.jsp.tbl_jsp:115)
org.apache.jsp.tbl_jsp._jspService(org.apache.jsp.tbl_jsp:87)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
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)
oracle.adf.view.rich.faces.application.DelegatingViewHandler.renderView(DelegatingViewHandler.java:35)
oracle.adfinternal.view.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:146)
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)
oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:310)
oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:183)
oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)
 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you give your jars list?
 
Marco Fung
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your Tld file, have you try to define the movieList rtexprvale to true?

<attribute>
<name>movieList</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic