Thread: Cannot access jspContext implicit object inside custom tag file
Created on: 04/11/11 11:53 AM
Joined: 04/08/11 Posts: 17
Cannot access jspContext implicit object inside custom tag file
04/11/11 11:53 AM
I am unable to access the jspContext implicit objects from within a .tag files because the jspContext object in the compiled java file has private access:
Here is a sample file (testTag.tag) that demonstrates the issue:
This is a test tag.
Here is a JPS file that calls this custom tag: [code] <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> <%@ taglib tagdir="/WEB-INF/tags" prefix="testTags" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Test for tagdir tags.</title> </head> <body> This is my JSP page. <testTags:testTag/> <br> </body> </html> [\code]
Here is the error I’m getting:
_testTag_xtag.java:54: jspContext has private access in javax.servlet.jsp.tagext.SimpleTagSupport
I'm pretty sure this is a bug, since I beleive that all scripting languages are required to provide access to the jspContext object inside tag files.
That work around worked. I think it might be a good idea for you to look into changing this maybe because according to the spec the jspContext object is supposed to be made available. It would make things easier for developers (like me) who are trying to migrate their code onto ServletExec from other platforms like Tomcat.