Help! pageContext is NULL in custom tag constructor!

I'm having a problem with a custom tag class, and I'm not sure whether it's because I'm doing something wrong, or because I'm running into a bug with Tomcat, JDK1.4b2, or something else. Basically, I'm finding that the pageContext object is null in the constructor of a custom tag class... something that I'm pretty sure is NOT supposed to happen.
I'm running JDK1.4b2 with Forte CE 3.1 (the bug predates the jumbo fix that brought it up to 3.0) and using Forte's embedded Tomcat.
I'm not sure whether it matters, but here's the sequence of events:
A servlet gets launched,
instantiates an object of type Error_list,
binds Error_list to the request object, and
forwards to a JSP that uses the custom tag defined by ListErrorsTag.
Unfortunately, pageContext is null in ErrorListTag's constructor, so the attempt to get the request object from the pageContext object generates a NullPointerException.
The SERVLET: *****************************************
// relevant lines from the servlet instantiating the object, binding it, and forwarding...
     Error_list errors = new Error_list("BAD_THINGS", "crash and burn");
     request.setAttribute("errors",errors);
     ServletContext sc = this.getServletContext();
     RequestDispatcher rd = sc.getRequestDispatcher("admin_category_create.jsp");
     rd.forward(request,response);
The JSP: ************************************************
In the JSP "admin_category_create.jsp" itself, I specify the taglib:
     <%@ taglib uri='/WEB-INF/AdminTags.tld' prefix = 'admin' %>
and reference it:
     <admin:listErrors>The errors will be listed here</admin:listErrors>
The Explosion of the Taglib: ************************
// beginning of Taglib class:
public class ListErrorsTag extends BodyTagSupport {
    private Error_list errors;
    public ListErrorsTag() {
    super()
    try {
         if (pageContext == null)
             System.out.println("uh oh! pageContext is null");
         ServletRequest request = pageContext.getRequest();
         errors = (Error_list)request.getAttribute("errors");
    catch (NullPointerException e) {
         System.out.println("boom!");
The Result: **************************************
Tomcat's error log:
uh oh! pageContext is null
boom!
if I eliminate the try/catch and allow the NullPointerException to take place, I get:
Error: 500
Location: /admin_category_create.jsp
Internal Servlet Error:
javax.servlet.ServletException
     at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:459)
     at _0002fadmin_0005fcategory_0005fcreate_0002ejspadmin_0005fcategory_0005fcreate_jsp_0._jspService(_0002fadmin_0005fcategory_0005fcreate_0002ejspadmin_0005fcategory_0005fcreate_jsp_0.java:338)
     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
     at org.netbeans.modules.web.tomcat.JspServlet.service(JspServlet.java:91)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
     at org.apache.tomcat.core.Handler.service(Handler.java:286)
     at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
     at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:194)
     at admin.processRequest(admin.java:126)
     at admin.doPost(admin.java:144)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
     at org.apache.tomcat.core.Handler.service(Handler.java:286)
     at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
     at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
     at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
     at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
     at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
     at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
     at java.lang.Thread.run(Thread.java:539)
Root cause:
java.lang.NullPointerException
     at AdminTags.ListErrorsTag.(ListErrorsTag.java:32)
     at _0002fadmin_0005fcategory_0005fcreate_0002ejspadmin_0005fcategory_0005fcreate_jsp_0._jspService(_0002fadmin_0005fcategory_0005fcreate_0002ejspadmin_0005fcategory_0005fcreate_jsp_0.java:272)
     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
     at org.netbeans.modules.web.tomcat.JspServlet.service(JspServlet.java:91)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
     at org.apache.tomcat.core.Handler.service(Handler.java:286)
     at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
     at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:194)
     at admin.processRequest(admin.java:126)
     at admin.doPost(admin.java:144)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
     at org.apache.tomcat.core.Handler.service(Handler.java:286)
     at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
     at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
     at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
     at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
     at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
     at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
     at java.lang.Thread.run(Thread.java:539)

Doing a little more experimentation, I discovered that pageContext is null in the constructor, but not null in the otherDoStartTagOperations() method (called by the doStartTag() method of the tag's class... it's something Forte forces you to do).
Is this normal? I was under the impression that pageContext is supposed to be defined EVERYWHERE in any class that extends BodyTagSupport... including the class' own constructor.
On a related topic, is there documentation somewhere as to what, exactly, Forte is doing behind the scenes when it's managing a taglib (how it keeps track of them, where it puts config files, how the entries it makes in them are different or extended from the normal layout, etc.)? At the moment, I suspect that half of the grief I'm having with writing taglibs is caused by Forte itself forcing me to do things in a roundabout way that bears little resemblance to the ways shown in different books on the topic (and in fact all but ensures that nearly every published example will fail and require major rewriting because of the way it forces tag classes to be structured), but I don't see any easy way to let Forte handle compiling the classes and testing them with its embedded Tomcat, but do the config file housekeeping myself I can be in control of it.

Similar Messages

  • Unable to recognise BigDecimal as Null in Custom tag

    I have written a tag for displaying monetary values which should display '-' if value is null but it always renders null values as 0.00
    <%@ tag body-content="empty" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 
    <%@ attribute name="value" required="true" type="java.math.BigDecimal" %>
    <c:choose>
      <c:when test="${empty value}">-</c:when>
      <c:otherwise>  
        <fmt:formatNumber value="${value}" groupingUsed="true" minFractionDigits="${2}" maxFractionDigits="${2}"/>
      </c:otherwise> 
    </c:choose>
    <c:if test="${empty val[column.prop]}">NULL</c:if>                                                    
    <mytag:fmtmoney value="${val[column.prop]}"/>First line just put in as a test
    should display NULL- but displays NULL0.00

    Ok I worked out what was happening but to be seems counter inuitive, the value being passed to the tag comes froma BigDecimal variable but if it is null it has no type. This null gets passed to the tag and the ExpressionLanguage Coercion rules convert it to zero, so in my tag cant differentiate between zero and null.
    If I change the type of the attribute to a String it works because nulls get converted to empty String and ${empty var} returns true for empty Strings.
    If I changed the type to a user defined class it works because user defined classes keep nulls as nulls.

  • Obj PageContext null in a Custom Tag

    Hi Every body
    I'm Mauricio and my problem is :
    I did a Custom tag and when I invoke it the PageContext object in the tag is null, I don't know why.
    Any suggestion about the reason of this problem, will be a great help.
    The source of Custom tag is :
    package expert.esecurity.tag;
    import java.io.IOException;
    import javax.servlet.ServletRequest;
    import javax.servlet.jsp.JspException;
    import javax.servlet.jsp.JspWriter;
    import javax.servlet.jsp.PageContext;
    import javax.servlet.jsp.tagext.TagSupport;
    public class SE_TagDynamicAction extends TagSupport
    private PageContext objPageContext;
    private String sbClazz;
    private String sbMethod;
    public void setPageContext(PageContext objPageContext)
    this.objPageContext = objPageContext;
    public void setSbClazz(String sbClazz)
    this.sbClazz = sbClazz;
    public void setSbMethod(String sbMethod)
    this.sbMethod = sbMethod;
    public int doStartTag() throws JspException
    try
    if(objPageContext!=null){ //the obj objPageContext is null
    JspWriter out = pageContext.getOut();
    ServletRequest objServletRequest = pageContext.getRequest();
         //Do the functionality and print reult
         out.print( result );
    else{
    throw new JspException("Object pageContext of the SE_TagDynamicAction tag is null");
    catch (BA_UTException objBA_UTException)
    throw new JspException(objBA_UTException.getMessage());
    catch (IOException objIOException)
    throw new JspException(objIOException.getMessage());
    return SKIP_BODY;
    public int doEndTag()
    return EVAL_PAGE;
    }

    Your setPageContext didn't make the context null, the context was never null. YOUR objPageContext, however, was null.
    Did you notice that you were checking for the existing of YOUR objPageContext (i.e != null) yet you were pulling, however you were pulling the request and writers from the default pageContext:
    try
    if(objPageContext !=null){ //the obj objPageContext is null
    JspWriter out = pageContext.getOut(); // See, you didn't use objPageContext.getOut();
    ServletRequest objServletRequest = pageContext.getRequest();// or objPageContext.getRequest();
    //Do the functionality and print reult
    out.print( result );
    else{
    throw new JspException("Object pageContext of the SE_TagDynamicAction tag is null");
    }The point is, the setPageContext method is not guaranteed to be invoked by the system, this is there so YOU can assign a different pageContext if necessary. Therefore the setPageContext method was never called (as you never explicitly called it) and therefore your objPageContext was null. BUT, the default pageContext class variable was NOT null.
    HTH.

  • Custom Tag using object as an attribute.

    I have read up on trying to pass an object as an attribute to a custom tag.
    Is it true that the only way to do this is to put the object, using a "key name" in the pageContext
    Then in the custom tag, set an attribute equal to the "Key Name"
    Then in the TagHandler, to do a lookup using the "Key Name"
    We can not just past objects into the attribute?
    And what is this about using EL or JSP2.0
    sorry sort of new to the whole game.

    Certainly you can pass objects to tags.
    However you need to use a runtime expression to do that.
    such as <%= expr %> or (with JSP2.0) ${expr}
    If you look at the JSTL library, it uses the EL and passes in objects all the time. However the EL actually accesses the page/request etc attributes as its variable space, so you are still technically using attributes.
    Is it true that the only way to do this is to put the object, using a "key name" in the pageContext
    then in the custom tag, set an attribute equal to the "Key Name"
    then in the TagHandler, to do a lookup using the "Key Name"That is one way of doing it. The struts libraries use this method extensively. It is more suited to JSP1.2.
    Sometimes it is easier/neater just to put the value into a scoped attribute, and pass in the name of that attribute. That way you don't need to worrry about the type of the attribute at all in your JSP.
    Hope this helps some,
    evnafets

  • Custom Tag Calling

    Can someone describe the process that JSF Servers use to call a tag. I'm writing a custom tag (actually a library of them) and I need one to call another tag.
    in other words:
    instead of:
    <my:tag1> <my:tag2>
    i'm creating a class called my:tag3, that will call both my:tag1 and my:tag2.
    That's the short of it, my:tag3 is actually going to do some nifty stuff on the back end, but thats not required for this question. So, how do I get my:tag3's encodeEnd(...) function to create my:tag1 and my:tag2 in the javacode?
    Thanks for any help.

    I'm writing a custom tag [...] and I need one to call another tag.
    in other words:
    instead of:
    <my:tag1> <my:tag2>
    i'm creating a class called my:tag3, that will call both my:tag1 and my:tag2.Do you really need JSP tags for <my:tag1> and <my:tag2>? A tag is just one way of creating a JSF component.
    Another way is to associate (in faces-config.xml) a JSF component (of type UITag3) with the tag <my:tag3>. This UITag3 will have 2 sub-components, of type UITag1 and UITag2 and these components are created (and added to the UITag3 component) in the setProperties() method in UITag3Tag.
    For example:
    public class MyTag3Tag extends UIComponentTag {
        public String getComponentType() { return "my.tag3"; }
        public String getRendererType() { return null; }
        protected void setProperties(UIComponent component) {
            super.setProperties(component);
            List children = component.getChildren();       
            UITag1 child1 = new UITag1();
            child1.setValue("XXX");
            children.add(child1);
            UITag2 child2 = new UITag2();
            child2.setValue("YYY");
            children.add(child2);
    }Geoff Rimmer

  • Custome Tags in ADF

    Any body can help in in working with custom tags in ADF?

    Hi,
    <af:panelPartialRoot>
    is not needed because both components already support partial page refresh
    action="indexPage"
    is not a valid property for af:poll
    pollListener="#{poller.processPollEvent}"/>
    pollListener handles the poll event, but what are you trying to do in the polling code ?
    see: http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/poll.html
    http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/progressIndicator.html
    Frank

  • Exception while passing null as param in custom tag

    Hi,
    I am using Oracle 10g AS(10.1.2). In my j2ee application,while passing NULL as parameter in custom tags, i am getting exception. But it was working fine with oracle 9i as.
    for example:
    This is my code in jsp:
    <%
    String str =null;
    %>
    <test:getInfo id="<%=str%>" />
    While executing the above code, I am getting the following exception :
    javax.servlet.ServletException
    at com.evermind.server.http.EvermindPageContext.handlePageThrowable(EvermindPageContext.java:595)
    at com.evermind.server.http.EvermindPageContext.handlePageException(EvermindPageContext.java:537)
    at ListAlerts.jspService(_ListAlerts.java:1827)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:350)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:121)
    at com.evermind.server.http.GetParametersRequestDispatcher.newInclude(GetParametersRequestDispatcher.java:80)
    at com.evermind.server.http.GetParametersRequestDispatcher.include(GetParametersRequestDispatcher.java:34)
    at com.evermind.server.http.EvermindPageContext.include(EvermindPageContext.java:267)
    at Content.jspService(_Content.java:181)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:350)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:121)
    at com.evermind.server.http.GetParametersRequestDispatcher.newInclude(GetParametersRequestDispatcher.java:80)
    at com.evermind.server.http.GetParametersRequestDispatcher.include(GetParametersRequestDispatcher.java:34)
    at com.evermind.server.http.EvermindPageContext.include(EvermindPageContext.java:267)
    at Main.jspService(_Main.java:360)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:350)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222)
    at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.java:845)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:734)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:98)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
    at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    at java.lang.Thread.run(Thread.java:534)
    Please help me....

    Hello,
    I do not remember exactly how the null where handle in Oracle 9iAS. Have you tested what is the differences in the way the <%= null %> is returned in both 9iAS and 10.1.2?
    You may just have to modify the way the value is sent to the bean from the tag.
    Regards
    Tugdual Grall

  • Custom tag help

    Hi there,
    I was wondering if someone might help me construct a custom tag handler class that either allows or denies access to a given JSP page? I'll start by showing the code I want to replace in all my JSP pages:
    <%
      String companyID = (String)session.getAttribute("companyID");
      String administratorID = (String)session.getAttribute("administratorID"); 
      if(companyID == null || administratorID == null)
         out.println(ServletUtilities.headWithTitle("ACCESS DENIED") +
        <body><h1>ACCESS DENIED</h1><a href=\"/scholastic/Login.jsp\">Return to Login Page</a></body></html>");
         return;
      else
    %>What this code is doing is extracting from the session object the companyID and administratorID. Both of these were placed into the session object when the user logged into the system. As we know, when a session times out, these IDs no longer exist, thus I test for null. If either value is null, then I create HTML markup that instructs the user to login again.
    So, what would be better is a custom tag that I can call just once, like so:
    <%@ taglib uri="stlib-taglib.tld" prifix="stlib" %>
    <stlib:allow_admin_access />
    The behaviour I want is to prevent the rest of the JSP from loading if the custom tag is unable to obtain the companyID and administratorID from the session object.
    I've not create custom tags before and would like some guidance on the tag handler class. Perhaps declare it:
    public class AllowAdminAccess extends TagSupport
      public int doStartTag(){...}
      public int doEndTag(){...}
    }Please advise,
    Alan

    Ok, I obtained a tutorial I found on the net and am trying to make it work on my application. So far, this is what I have:
    <!-- web.xml -->
    <filter>
          <filter-name>AccessFilter</filter-name>
          <filter-class>mvcs.AccessFilter</filter-class>
          <description>This filter attempts of obtain a User object from the HttpSession.  The User object would have been placed their identifying the user when he/she logged in.  If it doesn't exist, the session has probably timed out, or this is an unauthorized user.  If the User object is null the person is redirected to the Login.jsp page.</description>
          <init-param>
            <param-name>login_page</param-name>
            <param-value>/scholastic/Login.jsp</param-value>
          </init-param>
        </filter>
        <filter-mapping>
             <filter-name>AccessFilter</filter-name>
             <url-pattern>/*</url-pattern>
        </filter-mapping>
    <!-- AccessFilter class -->
    import java.io.IOException;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class AccessFilter implements Filter {
      protected FilterConfig filterConfig;
      private final static String FILTER_APPLIED = "_filter_applied"; 
      public void init(FilterConfig config) throws ServletException {
        this.filterConfig = config;   
      public void doFilter(ServletRequest request, ServletResponse response,
                       FilterChain chain) throws IOException, ServletException
        boolean authorized = false;
        // Ensure that filter is only applied once per request.
        if (request.getAttribute(FILTER_APPLIED) == null)
          request.setAttribute(FILTER_APPLIED, Boolean.TRUE);
          if(request instanceof HttpServletRequest)
            HttpSession session = ((HttpServletRequest)request).getSession(false);
            if(session != null)
              User user = (User)session.getAttribute("scholastic.tracks.user");
              if(user != null)
                 authorized = true;
        if(authorized)
          chain.doFilter(request, response);
          return;
        else if(filterConfig != null)
          String login_page = filterConfig.getInitParameter("login_page");
          System.out.println("login_page: " + login_page);
          if(login_page != null && !login_page.equals(""))
            System.out.println("Step1");
            filterConfig.getServletContext().getRequestDispatcher(login_page).forward(request, response);
            System.out.println("Step2");
            return;
        throw new ServletException("Unauthorized access, unable to forward to login page");
      public void destroy() { }
    }The directory structure for my application goes like this:
    webapps/scholastic/Login.jsp
    webapps/scholastic/*.jsp
    webapps/scholastic/admin/*.jsp
    webapps/scholastic/WEB-INF/classes/servlets.class
    Now, when I launch the browser and try to go to http://localhost:8080/scholastic/Login.jsp AccessFilter kicks in and since there is no User object in the session object yet, authorized will remain false. The logic continues to the line:
    filterConfig.getServletContext().getRequestDispatcher(login_page).forward(request, response);
    But in the end I wind up with a Page Not Found 404 error.
    I tried changing the <param-value>/scholastic/Login.jsp</param-value> to just <param-value>/Login.jsp</param-value> but this resulted in an endless loop condition with the Tomcat container. "/scholastic/Login.jsp" is the correct relative URL. So I'm stuck at this point.
    Please advise,
    Alan

  • Custom tag or help in reading an image file into the HTTP stream

    Since under WL we do not deploy our app physically there is no physical
              directory to write our dynamic images to (via kavachart).
              I can call their bean with:
              response.setContentType("image/png");
              ServletOutputStream output = response.getOutputStream();
              but that only allows the image back not the housing page. I can use an
              iframe but there are other issues and was wondering if anyone has idea on a
              custom tag the can easily read a physical directory outside of WL's space
              and include an image file in the http stream. Our app server and webservers
              are in separate zones so I can not just write to some virtual directory on
              the webserver and then serve it up w/ a simple <img> tag.
              BTW Kavachart has some tags referred to in their thin doc but I did not have
              good luck w/ their suggestions.
              Thanks in advance.
              dmg
              [email protected]
              

    Hi joe.com,
    Thanks for the response. It's greatly appreciated. Actually, I'm trying to run this on an Nokia SDK (s80 emulator) and eventually a windows mobile emulator.
    I was wondering if the JSR is the problem. I'm currently using jsr 62 and I'm thinking of trying to 216 to get PP 1.1. I'm wondering if 62 maybe limiting file io?
    any help is appreciated.

  • Help with session in custom tag

    Hello,
    I want to create a tag that returns true if the session is valid.
    <s:Expired>
    do something
    </s:Expired>
    How do you get the session in a *.java file that is not a servlet?
    I'm new to tags, ans am using JSTL 1.1 and Tomcat 5.0.19
    Thanks
    Frank

    In a custom tag you have a pagecontext object as a member of your class
    with it you can do something like
    HttpServletRequest request = (HttpServletRequest) pageContext.getAttribute(PageContext.REQUEST);
    then it's the usual
    request.getSession()

  • PageContext in Custom tag?

    Hi,
    How can a custom tag handler obtain instance of PageContext?

    Hi
    When you extend TagSupport or BodyTagSupport the "pageContext" object which is a protected member of the TagSupport class is automatically available to your TagHandler class.
    Keep me posted.
    Good Luck!
    Eshwar Rao
    Developer Technical Support
    Sun microsystems
    http://www.sun.com/developers/support

  • Does Inprise 4.1 support Custom Tag? Please Help!

    Hi there
    Does Inprise 4.1 support Custom Tag? If so, could you please tell me where to place the .tld file and the classese or just tell me where to find information about that.
    Thank you very much!
    From
    Edmund

    Please help!! I still can't work it out...

  • Help with the custom tag

    Hi
    i want to make a custom tag encapsulating certain functionalities of existing tags in one tag namely tomahawk dataPanel and html facets.
    Where can I get the source for html jsf tags so that I can look into it and modify.
    Thanks

    Originally posted by: mbuc.edp-progetti.it
    Would you like to know a fine workaround?
    If you have in your jsps a reference to the tld like this:
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    make a C:\WEB-INF\ directory on your PC and copy in there your tlds
    (C:\WEB-INF\struts-html.tld). The same for linux: /WEB-INF/struts-html.tld.
    So you do not have to change anything in web.xml nor in the jsp pages!
    Bye,
    Marco.
    "marco" <[email protected]> ha scritto nel messaggio
    news:cfhrgj$bcj$[email protected]..
    > Davis,
    > thanks for the reply. I followed your suggestion and now I am able to see
    > the code assist working.
    > I am currently using the lomboz editor, but one thing that is missing in
    > lomboz and is present in the structured editor (and in Intellij Idea) is
    the
    > ability to see where a tag is opened and closed, also for html tags.
    Perhaps
    > to someone this should seem not so important, but for me it is very
    usefull!
    >
    > As a first impression, I can only make a lot compliments to both
    > contributions (ObjectWeb and IBM).
    >
    > Bye,
    > Marco.
    >
    >
    > "David Williams" <[email protected]> ha scritto nel messaggio
    > news:[email protected]..
    > >
    > > No, you're not missing anything. Its just with that version of code the
    > > "tld resolver" (that knows where to look for TLD's) is not correct. I
    > > haven't tried it with struts, but with a minor test I tried,
    > > I just made a copy of the TLD to put in the same folder as the JSP file.
    > > Then the editor (and content asssit), can find it and all should be ok.
    Of
    > > course, I'm not suggesting this for a long term solution, but just to
    see
    > > if it allows you to get a little further in evaluating overall.
    >
    >

  • How to add a reference to help for a custom tag

    Hello,
    I would like to add an icon (question mark icon) to my custom tag (in tag libraries view). Then, when I press this icon I would like to see some .html page with description of a tag as it is done for a struts tags.
    Is it possible?
    If yes please tell me how to do it.
    Thanks,
    Damian

    There are a variety of customization options available for BEA Workshop. Through metadata you can define renderings for custom tags, tag appearance in the tag libraries view, customize the tag editors, and much more.
    Information about customization can be found at the following link: http://workshopstudio.bea.com/docs/tlei.htm
    Adding custom tag documention to the Tag Libraries view is not currently a configuration option but would be a useful addition. I will file an enchancement request for this functionality.

  • Why doesn't my custom tag work?

    First, my backend database is MS Access. Nothing I can do about that, unfortunately.
    I have defined three custom tags (no body, no attributes) to display report information from my project tracking/metrics Access database:
    <prefix:showProjectInfo />
    <prefix:showProjectTeam />
    <prefix:showProjectHistory />
    In my JSP, the first tag I use, <prefix:showProjectInfo />, works perfectly. However, <prefix:showProjectTeam /> gives no output.
    First, here is the tld file that defines the tags (report.tld):
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE taglib
            PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
            "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
        <tlib-version>1.0</tlib-version>
        <jsp-version>1.2</jsp-version>
        <short-name>report</short-name>
        <uri>/report</uri>   
        <!-- Forte4J_TLDX:  This comment contains code generation information. Do not delete.
        <tldx>
            <tagHandlerGenerationRoot>classes</tagHandlerGenerationRoot>
        </tldx>
        -->
        <!-- A validator verifies that the tags are used correctly at JSP
             translation time. Validator entries look like this:
          <validator>
              <validator-class>com.mycompany.TagLibValidator</validator-class>
              <init-param>
                 <param-name>parameter</param-name>
                 <param-value>value</param-value>
           </init-param>
          </validator>
       -->
       <!-- A tag library can register Servlet Context event listeners in
            case it needs to react to such events. Listener entries look
            like this:
         <listener>
             <listener-class>com.mycompany.TagLibListener</listener-class>
         </listener>
       -->
       <tag>
            <name>showProjectInfo</name>
            <tag-class>mil.usaf.rad.metrics.report.showProjectInfoTag</tag-class>
            <body-content>empty</body-content>
            <description>Shows the basic project information</description>       
       </tag>
       <tag>
            <name>showProjectTeam</name>
            <tag-class>mil.usaf.rad.metrics.report.showProjectTeamTag</tag-class>
            <body-content>empty</body-content>
       </tag>
       <tag>
            <name>showProjectHistory</name>
            <tag-class>mil.usaf.rad.metrics.report.showProjectHistoryTag</tag-class>
            <body-content>empty</body-content>
       </tag>
    </taglib>Next, here is the relevant section of web.xml that defines this taglib:
      <taglib>
            <taglib-uri>/WEB-INF/report.tld</taglib-uri>
            <taglib-location>/WEB-INF/report.tld</taglib-location>
      </taglib>Next, the code for showProjectTeamTag.java:
    * showProjectTeam.java
    * Created on March 9, 2005, 10:46 AM
    package mil.usaf.rad.metrics.report;
    import java.io.*;
    import java.sql.*;
    import java.lang.Integer;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    * @author  jason.ferguson
    public class showProjectTeamTag extends TagSupport
        public showProjectTeamTag()
            super();
        public int doAfterBody() throws JspException
            HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
            int pr_id = Integer.parseInt(req.getParameter("pr_id"));
            JspWriter out = pageContext.getOut();
            Connection conn = null;
            Statement stmt = null;
            ResultSet rs = null;
            try
               out.print("test");
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               conn = DriverManager.getConnection("jdbc:odbc:Metrics");
            catch (Exception e)
                throw new JspException(e.getMessage());
            String queryGetTeam = "SELECT Projects.pr_id, Accounts.name AS Name, Sum(Schedule.hours) AS SumOfhours FROM tblTAAccounts AS Accounts INNER JOIN ((tblTAScheduleEntries AS Schedule INNER JOIN tblProjectRelease AS ProjectRelease ON Schedule.projectID = ProjectRelease.tblFKTimeAccntProject) INNER JOIN tblPMProjects AS Projects ON ProjectRelease.Release_ID = Projects.pr_id) ON Accounts.accountID = Schedule.accountID WHERE Projects.pr_id=" + pr_id + " GROUP BY Projects.pr_id, Accounts.name, ProjectRelease.Release_number, Projects.Project_name";
            try
                out.print(queryGetTeam);
                stmt = conn.createStatement();
                rs = stmt.executeQuery(queryGetTeam);
                if (rs == null)
                    out.print("No Results!");
                out.print("<table>\n");
                out.print("<tr>\n");
                out.print("<th>Name</th>\n");
                out.print("<th>Total Hours</th>\n");
                out.print("</tr>\n");
                while(rs.next())
                    out.print("<tr>\n");
                    out.print("<td>" + rs.getString("Name") + "</td>\n");
                    out.print("<td>" + rs.getInt("SumOfhours") + "</td>\n");
                    out.print("</tr>\n");
                out.print("</table>\n");
                rs.close();
                stmt.close();
                conn.close();
            catch (Exception e)
                throw new JspException(e.getMessage());
            return SKIP_BODY;
    }Finally, projectdetail.jsp, where the tag is called:
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@page import="java.sql.*" %>
    <%@page import="java.lang.Integer" %>
    <%@taglib uri="/WEB-INF/report.tld" prefix="report" %>
    <html>
    <head><title>Project Detail</title></head>
    <body>
    <h1 align="center">Project Status</h1>
    <h3>Project Description</h3>
    <report:showProjectInfo />
    <h3>Team Members</h3>
    <report:showProjectTeam />
    </body>
    </html>The first tag, <report:showProjectInfo />, works fine. However, I get no output whatsoever when the system encounters <report:showProjectTeam />. I am a relative newbie at this, so any help is appreciated.
    Jason

    It doesnt seem to matter if the code is in doStartTag(), doEndTag(), orr any of the other functions.
    I also put, as the first item in the function:
    System.out.println("TEST");Nothing.
    Just as an aside, here is the code for the <prefix:showProjectInfo />. Maybe I made a mistake in it? I closed the resultset and connection...
    import java.io.*;
    import java.sql.*;
    import java.lang.Integer;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.servlet.jsp.*;
    import javax.servlet.jsp.tagext.*;
    * @author  jason.ferguson
    public class showProjectInfoTag extends BodyTagSupport
        public int doEndTag() throws JspException
            HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
            int pr_id = Integer.parseInt(req.getParameter("pr_id"));
            JspWriter out = pageContext.getOut();
            Connection conn = null;
            Statement stmt = null;
            ResultSet rs = null;
            try
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                conn = DriverManager.getConnection("jdbc:odbc:Metrics");
            catch (Exception e)
                throw new JspException(e.getMessage());
            String queryProjectInfo = "SELECT * FROM tblPMProjects WHERE pr_id=" + pr_id;
            try
                stmt = conn.createStatement();
                rs = stmt.executeQuery(queryProjectInfo);
                while (rs.next())
                    out.print("<table border=\"1\" style=\"border-collapse:collapse\">\n");
                    out.print("<tr>\n");
                    out.print("<td><b>Project Name:</b>" + rs.getString("Project_name") + "</td>\n");
                    out.print("<td align=\"right\"><b>RAD Number:</b>" + rs.getString("tblProjectNumber") + "</td>\n");
                    out.print("</tr>\n");
                    out.print("<tr>\n");
                    out.print("<td>Project description: " + rs.getString("Project_description") + "</td>\n");
                    out.print("</tr>\n");
                    out.print("<tr>\n");
                    out.print("<td>Customer: " + rs.getString("Customer_POC") + "</td>");
                    out.print("<tr>\n");
                    out.print("<tr>\n");
                    out.print("<td>Customer Unit: " + rs.getString("Customer_OFC") + "</td>\n");
                    out.print("</tr>\n");
                    out.print("<tr>\n");
                    out.print("<td>Customer Phone: " + rs.getString("Customer_phone") + "</td>\n");
                    out.print("</tr>\n");
                    out.print("</table>\n");
                    rs.close();
                    stmt.close();
                    conn.close();
            catch (Exception e)
                throw new JspException(e.getMessage());
            finally
                //conn.close();
            return SKIP_BODY;

Maybe you are looking for

  • PC users not able to open my TextEdit documents

    I'm the secretary for a non profit org and when I try to send my minutes to other members (which I type up in TextEdit) they can't open them or they're in some garbled format. I have a Word 2004 test drive and when it expires I can buy it for around

  • Hierarchy Objects - Authorisation in Roles

    Hi I have created a role which is causing me few problems. The role is reporting role and the queries associated to it have 0MAST_CCTR & 0ORGUNIT in them. when I run the queries I got a error message: No authority for the node from characteristic 0MA

  • SAX mapping

    Hi, I have Java SAX mapping for IDOC-to-JDBC scenario. Sometimes it happens that, XI starts to create first XML SQL message, then in one moment stops(this XML hasn't right structure) and starts with second. With second, XI ends OK, but this has, XML

  • Connecting XI to MSSQL Server

    Hi,   I want to connect to Mssql Server from XI, I have downloaded and JDBC driver of MSSql server. Is this enough to connect to XI server or else i have to do any other configuration in XI server. How to know that JDBC Adapter is enabled in XI Serve

  • Call view object from ViewController [SOLVED]

    I'm using a valueChangeListener method in a managed bean, which I'd like to use to call a method on a view object. How can I call the view object from a managed bean class? Regards