Get pageContext in a tag file

How can I get pageContext variable in a tag file? I'm trying something like
<%tagBean.init(pageContext);%> and compiler says it cannot resolve pageContext.
Thanks for help.
Denis Krukovsky
http://dotuseful.sourceforge.net/

<%tagBean.init(pageContext);%>looks more like a jsp scriptlet rather than a tag class in which case you shouldnt be getting a compiler error as pageContext is a implicit jsp object of type javax.servlet.jsp.PageContext and hence avbl by default to all jsp pages.
Now if you are coding a tag class and your tag extends TagSupport, pageContext is again a protected super class variable.
However if your tag class implements the tag interface (brave path :)?), you should build the pageContext object yourself
Cheers,
ram.

Similar Messages

  • How to get accessed to pagecontext in a tag file in JSP2.0

    I am writing a custom tag using JSP 2.0 to clean up the JSP pages for a big website.
    Now a question comes up. I need to access pageContext variable in my tag file since I need to get the bean using a lookup method. I know in JSP2.0 there is jspContext implicit object instead of pageContext. But this is not the end of the story.
    then I read Denis' post. and his solution are these two line codes:
    <%
    PageContext pageCtx = (PageContext)jspContext;
    tagBean.init(pageCtx);
    %>
    I am confused here what the tagBean here. Is that a webBean? and how can I get this object in my tag so that I could initialize the pagecontext and reference it?
    thanks in advance

    The lookup method just returned me a null. So I believe that there is
    some trick behind this simple cast.First I would double check your basic assumptions.
    Is the attribute you are looking up actually there? That would be a simpler explanation for why the lookup method returned null.
    Try a jspContext.findAttribute() , specific request/session.getAttribute() to see if you actually retrieve anything.
    Also be aware that the RequestUtils.lookup() method has been deprecated in Struts 1.2, in favour of org.apache.struts.taglib.TagUtils.lookup().
    Cheers,
    evnafets

  • PageContext.setAttribute in tag file

    All,
    If I put the code below in a tag file, I get a whole bunch of compile errors. (If I put it in a jsp, it works fine.)
    Does anyone have any idea why?
    (I am using jbuilder, jsp2.0)
    <%@ taglib prefix="c" uri="http://jakarta.apache.org/jstl/core" %>
    <%
         String[] myStrings = new String[3];
         myStrings[0] = "coke";
         myStrings[1] = "pepsi";
         myStrings[2] = "7-up";
         pageContext.setAttribute("myStrings", myStrings);
    %>
    <html>
    <body>
    <h1>Welcome to index.jsp</h1>
    <h2>Some soft drinks available are...<h2>
    <c:if test="${!empty myStrings}">
    <ul>
    <c:forEach items="${myStrings}" var="s">
    <li><c:out value="${s}" />
    </c:forEach>
    </ul>
    </c:if>
    </body>
    </html>
    Patrick

    If I put the code below in a tag file, I get a whole bunch of compile errors. (If I put it in a jsp, it works fine.)
    Does anyone have any idea why?Yes.
    1. The implicit variable is jspContext
    2. This jspContext variable, though referring to the PageContext object is a super class type i.e. it is of type JspContext
    So you will have to cast and then use it in your tag files
    PageContext pageCtx = (PageContext)jspContext;
    //now use the pageCtx object.Hope that helps
    cheers,
    ram.

  • WLS does not handle reusable jar with tag-files?

    I want to encapsulate some tag-files in a re-usable jar that can be included in multiple applications. According to all the documentation that I've found what I need to do is create a jar file containing:
    META-INF/taglib.tld
    META-INF/tags/myTag.tag
    where the taglib.tld contains (among other things):
    <uri>myTag</uri>
    <tag-file>
    <name>someName</name>
    <path>META-INF/tags/myTag.tag</path>
    </tag-file>
    Then I am supposed to take that jar file and put it in my web application under WEB-INF/lib,
    and in my index.jsp I can refer to <%@taglib prefix="myt" uri="myTag">
    However when I do this (on wls 12c) the application seems to deploy ok but when I try to access index.jsp I get:
    weblogic.servlet.jsp.CompilationException: Failed to compile JSP /index.jsp
    index.jsp:14:4: No tag library could be found with this URI. Possible causes could be that the URI is incorrect, or that there were errors during parsing of the .tld file.
    <%@taglib prefix="tags" uri="myt" %>
    Related facts:
    1. When I deploy these projects in Glassfish it works . as I expected based on the documentation with no errors.
    2. If I copy the tag files and tld with no modification directly into the web application as:
    <my web app>/WEB-INF/taglib.tld
    and <my web app>/META-INF/tags/myTag.tag
    then it does work. However, that prevents me from packaging the tag-files as a re-usable jar.
    (Facts 1 & 2 seem to imply that the files are correct and that WebLogic is not handling the jar correctly?)
    3. I've seen suggestions that there needs to be a <taglib> entry in web.xml. I have tried this and...
    - the text I've seen on the web generates an error. It seems to need to be within a <jsp-config> entry in web.xml.
    - even with this I still get the same error.
    Does anyone have a suggestion for how to get Weblogic to handle tag-files inside a re-usable jar?
    Do you have an example jar you can point me to just to see that it works on my system?
    Is there some special configuration needed by Weblogic to tell it to handle this construct?
    And finally, the error message is saying that one of two things is wrong:
    Either:
    A) it cannot find the referenced taglib file, or
    B) the tld file failed to compile.
    Is there any way for me to find out which of these is happening? The error messages in WLS do not seem to give any more info, so I cannot easily distinguish between these possibilities.
    Thanks for your assistance.

    After 3 days of seeing this error, immediately after posting this request the problem disappeared. Sigh.
    So for now this problem is closed. If it comes back I'll re-post.

  • Prompt to Tag files after scanning

    I do a lot scanning with ScanSnap and I'd like to be able to get a prompt to Tag files as they appear in my scan folder as .pdf's. I looked around in automator and didn't see anything that would fit the bill... and I'm not well versed at scripting - anything out there that will fit the bill ?

    I do a lot scanning with ScanSnap and I'd like to be able to get a prompt to Tag files as they appear in my scan folder as .pdf's. I looked around in automator and didn't see anything that would fit the bill... and I'm not well versed at scripting - anything out there that will fit the bill ?

  • How do I get PSE to read tag info on updated jpg files?

    Using PSE9 on 2 PCs. Files are stored locally on each, and updates synced via Windows Mesh.
    Use case issue:
    1) Add tag to jpg on PC1 using PSE.
    2) Execute PSE "write to file" command before closing app
    3) Confirm on PC2 via Windows Explorer that tag info is updated on local file
    4) Open PSE on PC2, bur additional tag info is not recognized by PSE.
    5) Tried to re-import test files in PSE using "Get Files" function, but tag data was still not read by PSE.
    6) Manually added new tag to tag list, reloaded PSE, but new tag info still not read on file.
    7) Ran Optimize and Repair catalog functions, but problem persisits.
    How do I get PSE to read tag info on updated jpg files without rebuilding the entire catalog every time I edit a file?

    Simple : you can't.
    Why ? Because the tags are stored in the database of the catalog. When you 'write' metadata to files, you can see it does work. The new tags are written to the files. But the new tags are ignored by the catalog in the second computer. You'd have to delete the file entry from the catalog and reimport it, supposing the tag is already in the tag list. Otherwise the tag would appear in the 'imported tags' category.
    The Organizer is not meant to be a multi-user database.
    What you can do to share media and catalogs between two computers having the same Elements version is to store the media files and the catalog on an external drive you can plug to each computer when needed. Note that the drives should be recognized with the same drive letter.

  • [weblogic-9.1] JSP 2.0 tag file gets compiled but not reloaded

    I am trying to use a JSP 2.0 tag file on weblogic 9.1. Everything works as expected until I reload the page after changing the tag file. Consider the following files, simple.jsp and simple.tag:
    h5. /simple.jsp
    &lt;%@ page language="java" %&gt;
    &lt;%@ taglib prefix="sandbox" tagdir="/WEB-INF/tags" %&gt;
    &lt;html&gt;
    &lt;body&gt;
    This output comes from the jsp.
    &lt;sandbox:simple&gt;
    &lt;/sandbox:simple&gt;
    &lt;/body&gt;
    &lt;/html&gt;h5. /WEB-INF/tags/simple.tag
    &lt;%@ tag language="java" %&gt;
    <div>This output comes from a tag file
    </div>The output of a call to simple.jsp is:
    <html><head>
    </head><body>
    This output comes from the JSP.
    <div>This output comes from a tag file</div>
    </body></html>So far, so good. Now I change the content of simple.tag to
    <%@ tag language="java" %>
    <div>This output comes from *simple.tag*<div>On a new call to simple.jsp,
    1. Weblogic notices that the file has been changed,
    2. generates the TagHandler .java file
    3. compiles the .java file
    But the new class file seems not to be loaded by weblogic; the resulting HTML does not change. It is not a browser cache issue, as I can see Javelin compilation errors. E.g., changing the tag file content to
    <%@ tag language="j" %>
    <div>This output comes from simple.tag</div>leads to the following (expected) error:
    Compilation of JSP File '/sandbox/simple.jsp' failed:
    simple.tag:1:18: "j" is not a valid setting for the language attribute.
    <%@ tag language="j" %>
    ^-^
    Changes to the .jsp file are reflected in the HTML output.
    Am I missing something? Is there any flag I have to set in my weblogic configuration?

    You are right in saying that decoding has nothing to
    do with rendering per se.I will go even further than Erik did, and dispute this statement.
    Consider that you are generating an <input> tag for a text field. Among other things, you have to generate a "name" attribute. Who decides what to put there? The renderer that actually created the markup.
    The "renderer" really does
    two completely different things. But both should
    nevertheless be separate from the component
    implementation itself. You could still have the
    renderer doing the decoding part, which arguably would
    rarely change, and somehow delegate the actual
    rendering to an implementation in a tag file.Whether you implement decoding in a separate class or inside the component, what request parameter name do you look for? It is not reasonable to assume that ALL possible renderers will choose the same parameter name ... hence, decoding and encoding are inextricably linked (the code doing the decoding has to know what kind of markup the code doing the encoding actually created). In JavaServer Faces, the current APIs create that linkage by requiring that the decode and encode be done by the same class (either the component, if you are not delegating, or the renderer if you are).
    Craig

  • JSP 2.0 tag files for rendering JSF components

    Over the weekend I read up on new JSP 2.0 features (dunno why I waited this long??) ... I really liked the tag file feature ...
    I was wondering if it were a good idea to use these tag files as renderers for JSF components - ok, this ties us to a JSP only solution but how many in here would be using a non-JSP solution anyway?
    I was thinking along the foll. lines:
    <myComponent id="myComponent1" attr1="value1" attr2=value2">
        <myComponentRenderer var="myComponent1" />
    </myComponent>
    myComponentRenderer can be implemented as a tag file in myComponentRenderer.tag ... The myComponent tag delegates the business logic processing to its associated UIComponent and then sets this component as a pageContext attribute with the id "myComponent1" ... myComponentRenderer in turn gets a reference to this UIComponent and renders it ...
    Again, if one wants a different way of rendering, make another tag file myComponentRenderer2.tag or change myComponentRenderer.tag itself ...
    Indeed, this may not work for components with complicated rendering logic but I believe that's only the 20% case ...
    Comments?
    P.S.:
    I've picked this up from http://forums.java.sun.com/thread.jsp?forum=427&thread=381052&tstart=0&trange=15
    This also compliments another topic: http://forums.java.sun.com/thread.jsp?forum=427&thread=413515&tstart=0&trange=15

    You are right in saying that decoding has nothing to
    do with rendering per se.I will go even further than Erik did, and dispute this statement.
    Consider that you are generating an <input> tag for a text field. Among other things, you have to generate a "name" attribute. Who decides what to put there? The renderer that actually created the markup.
    The "renderer" really does
    two completely different things. But both should
    nevertheless be separate from the component
    implementation itself. You could still have the
    renderer doing the decoding part, which arguably would
    rarely change, and somehow delegate the actual
    rendering to an implementation in a tag file.Whether you implement decoding in a separate class or inside the component, what request parameter name do you look for? It is not reasonable to assume that ALL possible renderers will choose the same parameter name ... hence, decoding and encoding are inextricably linked (the code doing the decoding has to know what kind of markup the code doing the encoding actually created). In JavaServer Faces, the current APIs create that linkage by requiring that the decode and encode be done by the same class (either the component, if you are not delegating, or the renderer if you are).
    Craig

  • Recursive calls by JSP tag files fail to compile

    We're hitting an issue with recursive calls in JSP tag files. I found one unanswered post in the General forum - [Tag Files used recursivily throws exception|https://forums.oracle.com/forums/thread.jspa?threadID=853300] - and was wondering if anyone else has hit this or knows of any work-arounds/patches or knows how to raise suspected bugs with Oracle (when you don't have an official support relationship for WebLogic)?
    Example tag file - /WEB-INF/tags/recurse/hello.tag:
    <%@ tag body-content="empty" %>
    <%@ attribute name="name" required="true" type="java.lang.String"%>
    <%@ attribute name="depth" required="true" type="java.lang.Number"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="r" uri="/WEB-INF/tags/recurse/recurse.tld" %>
    <table border="1" cellpadding="3" cellspacing="3">
    <tr>
    <td>
    Hello ${name} [${depth}]
    </td>
    <c:if test="${depth > 1}">
    <td>
    <r:hello name="${name}" depth="${depth-1}"/>
    </td>
    </c:if>
    </tr>
    </table>
    Example tld file - /WEB-INF/tags/recurse/recurse.tld:
    <?xml version="1.0" encoding="UTF-8" ?>
    <taglib xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
    version="2.1">
    <description>Library with Recursive tag</description>
    <tlib-version>1.0</tlib-version>
    <shortname>r</shortname>
    <tag-file>
    <name>hello</name>
    <path>/WEB-INF/tags/recurse/hello.tag</path>
    </tag-file>
    </taglib>
    Example jsp file - /recurse/test.jsp:
    <%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="r" uri="/WEB-INF/tags/recurse/recurse.tld" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Recursive Tag-file Test</title>
    </head>
    <body>
    <c:set var="name" value="${pageContext.request.remoteUser}"/>
    <c:set var="depth" value="${5}"/>
    <p>Welcome ${name}, here are ${depth} greetings</p>
    <r:hello name="${name}" depth="${depth}"/>
    </body>
    </html>
    The expected result from this example would be to get nested 5 HTML tables.
    The current behaviour, is the following is shown on screen when loading the test.jsp:
    Compilation of JSP File '/recurse/test.jsp' failed:
    hello.tag:15:6: Current file's JSP version conflicts with current tag "r:hello"'s.
                        <r:hello name="${name}" depth="${depth-1}"/>
    ^-----^
    hello.tag:15:6: Current file's JSP version conflicts with current tag "r:hello"'s.
                        <r:hello name="${name}" depth="${depth-1}"/>
    ^-----^
    I believe the "JSP version conflicts with current tag" message is misleading (you also get the same error referring to the tag file's folder via a tagdir reference from the JSP and defining an 'implicit.tld' which declares version="2.1"). If you take the recursive <r:hello .../> call out of hello.tag the JSP and tag file compile and function fine. I tried the work around mentioned in the forum post mentioned above, taking the recursive call out, deploying, then putting the recursive tag call back in and just updating the tag file doesn't seem to work for me.
    Using "weblogic.appc" you get a few more messages, though the issue is the same - tag file doesn't compile:
    test.jsp:15:6: The tag handler class was not found "jsp_servlet._tags._recurse.__hello_tag".
    <r:hello name="${name}" depth="${depth}"/>
    ^-----^
    test.jsp:15:14: This attribute is not recognized.
    <r:hello name="${name}" depth="${depth}"/>
    ^--^
    test.jsp:15:29: This attribute is not recognized.
    <r:hello name="${name}" depth="${depth}"/>
    ^---^
    hello.tag:15:6: The tag handler class was not found "jsp_servlet._tags._recurse.__hello_tag".
    <r:hello name="${name}" depth="${depth-1}"/>
    ^-----^
    hello.tag:15:6: Current file's JSP version conflicts with current tag "r:hello"'s.
    <r:hello name="${name}" depth="${depth-1}"/>
    ^-----^
    Happy to send this example as an ear/war for anyone that's interested.
    At this stage, WebLogic seems to be the only servlet container with this limitation.
    This has been tested with WebLogic 10.3.3.0 and 12.1.1.0.
    The context for this is that the issue is present in a (larger) enterprise application. The above simple example with recursive tags is what we have isolated as the problem.
    Although I/we may not have a support relationship for WebLogic, our clients will, so if the solution is apply an already existing patch that solution would be acceptable.

    Somethings definitely wrong with your gcc installation.
    Which gcc are you using. What output do you get from "which gcc".
    Solaris 10 ships with a gcc in /usr/sfw/bin.
    If your using a 3rd party gcc try changing your path to put /usr/sfw/bin before whereever the 3rd party gcc lives. Or just uninstall it.

  • How to properly handle Exception thrown in a .tag file?

    I've got a .jsp file that makes use of some custom tags, each defined in their own .tag file, and located in WEB-INF/tags. I'm having a lot of trouble with the scenario of cleanly dealing with an exception raised by scriptlets in either a .jsp file, and a .tag file. I'm using both Java and Tomcat 6....
    Originally, I wanted to use .tag files in order to componentize common elements that were present in .jsp pages, as well as move ugly scriptlets out of .jsp pages, and isolate them in tag files with their associated page elements.
    Things started getting hairy when I started exploring what happens when an exception is thrown (bought not handled) in a scriptlet in a .tag file. Basically, my app is a servlet that forwards the user to various .jsp pages based on given request parameters. The forwarding to the relevant .jsp page is done by calls to the following method:
    servletContext.getRequestDispatcher("/" + pageName).forward(request, response);
    Where 'pageName' is a String with the name of the .jsp I want to go to...
    Calls to this method are enclosed in a try block, as it throws both a ServletException, and IOException...
    When either my .jsp, or .tag throw an exception in a scriptlet, the exception is wrapped in a JSPException, which is then wrapped in a ServletException.
    I can catch this exception in my servlet... but then what? I want to forward to an error page, however, in the catch block, I can't forward in response to this exception, as that results in an IllegalStateException, as the response has already been committed. So what do I do? How do I get from this point, to my "error.jsp" page?
    It was suggested to me that I use the <% @ page isErrorPage="true" %> directive in my error.jsp,
    and the in my real .jsp, use <%page errorPage="/error.jsp" %>.
    This works great when the exception is thrown in my .jsp.... But when the exception is thrown in the .tag file... not so much...
    My .jsp page was rendered up until the point where the <my:mytag/> (the tag with the offending raised exception) was encountered. Then, instead of forwarding to the error page when the error in the tag is encountered, the error page is rendered as the CONTENT of of my TAG. The rest of the .jsp is then NEVER rendered. I checked the page source, and there is no markup from the original .jsp that lay below the my tag. So this doesn't work at all. I don't want to render the error page WITHIN the half of the .jsp that did render... Why doesn't it take me away from the .jsp with the offending tag altogether and bring me to the error.jsp?
    Then it was suggested to me that I get rid of those page directives, and instead define error handling in the web.xml using the following construct:
    <error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/error</location>
    </error-page>
    <error-page>
    <error-code>404</error-code>
    <location>/error</location>
    </error-page>
    For this, I created a new servlet called ErrorServlet, and mapped it to /error
    Now I could mangle the end of the URL, which causes a 404, and I get redirected to the ErrorServlet. Yay.
    However, exceptions being thrown in either a .jsp or .tag still don't direct me to the ErrorServlet. Apparently this error handling mechanism doesn't work for .jsp pages reached via servletContext.getRequestDispatcher("/" + pageName).forward(request, response) ????
    So I'm just at a total loss now. I know the short answer is "don't throw exceptions in a .jsp or .tag" but frankly, that seems a pretty weak answer that doesn't really address my problem... I mean, it would really be nice to have some kind of exception handler for runtime exceptions thrown in a scriptlet in .tag file, that allows me to forward to a page with detailed stacktrace output, etc, if anything for debugging purposes during development...
    If anyone has a few cents to spare on this, I'd be ever so grateful..
    Thanks!!
    Jeff

    What causes the exception?
    What sort of exception are you raising from the tag files?
    Have you got an example of a tag file that you can share, and a jsp that invokes it so people can duplicate the issue without thinking too much / spending too much time?
    My first instinct would be that the buffer is being flushed, and response committed before your Exception is raised.
    What you describe is pretty much standard functionality for Tomcat in such cases.

  • Tag files cannot be used in tag files?

    Hello,
    Is it possible to invoke tag file from other tag file in the project? Is it allowed by spec?
    1. Create empty project with JDeveloper.
    2. Create tag file tagFile1.tag using wizard.
    3. Create tag file tagFile2.tag using wizard.
    4. Drag TagFile2 tag from toolbar to tagFile1.tag in editor pane.
    tagFile1.tag is:
    <%@ taglib tagdir="/WEB-INF/tags/" prefix="tags"%>
    <%@ tag pageEncoding="UTF-8"%>
    <tags:tagFile2/>
    tagFile2.tag is:
    <%@ tag pageEncoding="UTF-8"%>
    5. Try to rebuild the project - compilation fails
    Error(3): Unable to instantiate tag: tags:tagFile2 (class: oracle.jsp._tag._tagFile2_tag) Make sure that the tag class is available and that the tag library containing the class is not excluded from this application.
    Error(3): Unable to find class for bean: null defined by tag with class: oracle.jsp._tag._tagFile2_tag
    Is it a bug of JDeveloper or OC4J or am I duing something against the spec?

    Was this issue resolved? I have getting the same error message with my custom JSP tags. It worked when I use JDev 9.0.5 but not when I moved it over to JDev 10.1.3.1
    Error(87): Unable to instantiate tag: app:checkPermissions (class: pathname.CheckPermissionsTag) Make sure that the tag class is available and that the tag library containing the class is not excluded from this application.
    Error(87): Unable to find class for bean: null defined by tag with class: pathname.CheckPermissionsTag

  • How to get the name of tag or variable

    Hi everyone,
    I am a newbie, I have problem on getting the name or tag of the variable from OLE for Processing Control(OPC) server, could anyone tell me how I can get the name of tag or variable from writting vb codes or please direct me to any helpful information. Here are
    my codes,
    Dim ItemsDef(NBR_ITEMS) As String
    Dim DeviceAddress As String
    Dim IndItem As Long
    DeviceAddress = "MBT:152.160.178.60"
    'Preparing the Handles for "AddItems"
    For IndItem = 1 To NBR_ITEMS
    ItemsDef(IndItem) = DeviceAddress & "!40000" & Format(IndItem) '40000 is the memory location of variable in the OPC, how can I get the variable name, what is the code or syntax?
    Next
    blah...
    Thank you,
    Calvin

    Hi Calvin,
    If you are looking for general information and examples about OPC, then we have lots of places for you to browse!
    Here is a small list, and you can probably find other links within these documents:
    **If you have Measurement Studio from National Instruments, then you can look at the "Measurement Studio Reference" help file. Search for OPC and in the overview you will find the methods for accessing the items on an OPC server.
    **Elsewhere in the help file, you can find a link to this Application Note on our developer zone
    http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?​openagent&F4921B34CA8F4A9786256874005BE3F7&cat=7CD​A3E51FEFC4AA2862568B80071A1E2
    **One more resource is http://www.ni.com/opc
    **Probably the most useful will be the examples yo
    u can find on our web site. You can go to http://www.ni.com/support and in Option 3 search the Example Code database for "opc".
    In the first example program (Controlling OPC Servers with the OPC Automation API in Visual Basic) that you should get when searching for "opc" in the example programs database, look for the line with this code: "browser.GetItemID(leaf)". There you can see the way the program creates an OPCBrowser from the server instance, and then gets the servers available items for use by the client. This sounds like the specific information you are looking for with the variable name.
    If you aren't able to find out your answer here or in the various help resources, then please feel free to contact us at National Instruments at http://www.ni.com/ask
    Regards,
    John N
    Applications Engineer
    National Instruments

  • Multiple function signatures in JSP custom tag file

    I'm writing a jsp .tag file and I've encountered the following problem. I have those two functions :
    private void iterateThroughChildElements(Element element)
         for (Iterator i = question.getElements().iterator(); i.hasNext(); )
              this.parseAndDisplay( (Element) i.next() );
    private void parseAndDisplay(Question question)
    private void parseAndDisplay(Answer question)
    (......)Both Answer and Question objects are elements but I get an error from the compiler which says that no correct signature was found for the parseAndDisplay function.
    What could be the problem ? Do I have to cast the objects according to a instanceof comparaison ??

    There was an error in my code, it is as follows :
    private void iterateThroughChildElements(Set elements)
         for (Iterator i = elements.iterator(); i.hasNext(); )
              this.parseAndDisplay( (Element) i.next() );
    }

  • Tag files for rendering JSF components

    Hi people!
         It is possible to render component JSF using Tag-Files? (WEB-INF/tags).
    I am having problems with context, seems that the JSF does not recognize pageContext.
    Ex:
    My Tag-File
    <%@ attribute name="nameproperty" required="true" rtexprvalue="true" %>
    <%@ attribute name="size"           required="true" rtexprvalue="true" %>
    <h:inputText id="${nameproperty}"      size="#{size}" />
    My JSP
    <%@ taglib tagdir="/WEB-INF/tags" prefix="mayTags"%>
    <f:subview id="id001" >
         <myTags:myText propriedade="name_test" size="30" />
    </f:subview>
    In this in case that the size always is empty, because it does not recognize the target pageContext, but if I to place the size in the target of request already recognizes.
    EX:
    <%@ attribute name="nameproperty"      required="true" rtexprvalue="true" %>
    <%@ attribute name="size"           required="true" rtexprvalue="true" %>
    <c:set var"size" value="${size}" scope="request" >
    <h:inputText id="${nameproperty}"      size="#{size}" />
    In part it decides my problem, but it causes another error, is that if in my JSP it will have two fields (this is more than common) calling tag-file, there the size placed in request is always of it I finish field.
    Ex:
    <%@ taglib tagdir="/WEB-INF/tags" prefix="mayTags"%>
    <f:subview id="paisMan" >
         <myTags:myText propriedade="name_test" size="30" />
         <myTags:myText propriedade="name_test_2" size="70" />
    </f:subview>
    In this case all the two inputText would have size 70.
    It has some thing that I can make to solve this problem?
    Thanks for any help.
    Pedro Neves - Brazil

    You are right in saying that decoding has nothing to
    do with rendering per se.I will go even further than Erik did, and dispute this statement.
    Consider that you are generating an <input> tag for a text field. Among other things, you have to generate a "name" attribute. Who decides what to put there? The renderer that actually created the markup.
    The "renderer" really does
    two completely different things. But both should
    nevertheless be separate from the component
    implementation itself. You could still have the
    renderer doing the decoding part, which arguably would
    rarely change, and somehow delegate the actual
    rendering to an implementation in a tag file.Whether you implement decoding in a separate class or inside the component, what request parameter name do you look for? It is not reasonable to assume that ALL possible renderers will choose the same parameter name ... hence, decoding and encoding are inextricably linked (the code doing the decoding has to know what kind of markup the code doing the encoding actually created). In JavaServer Faces, the current APIs create that linkage by requiring that the decode and encode be done by the same class (either the component, if you are not delegating, or the renderer if you are).
    Craig

  • .tagx Tag files in Weblogic 9.2

    Hi,
              We are trying to run one of our applications deploying it to a Weblogic Server 9.2. We are running into problems, as we use .tagx tag files and they do not seem to be recognized. Our .jsp page tries to invoke them as:
                        <%@ taglib tagdir="/WEB-INF/tags/taglibname/" prefix="taglibname" %>
              <taglibname:tag ...>...</taglibname:tag>
                                  We have XML tag files named /WEB-INF/tags/taglibname/tag.tagx files, but still we get:
                        javax.servlet.jsp.JspException: ServletException in '/WEB-INF/jsp/chains/index.jsp': Failed to compile JSP /WEB-INF/jsp/chains/index.jsp
              index.jsp:1:5: No tag library could be found with this URI. Possible causes could be that the URI is incorrect, or that there were errors during parsing of the .tld file.
              <%@ taglib tagdir="/WEB-INF/tags/layout/" prefix="layout" %>
                  ^----^
                                  If we define a simple .tld file for the tag, the problem shifts, as the tagfile element for tlds does not allow defining attributes, and we zillions of "This attribute is not recognized." messages when trying to use the tags.
              Any ideas? Should we use .tag files instead of .tagx or...?
              Alex

    Hi,
              Does this happens if you invoke the tag from a .jspx page?
              I was under the heavy impression that .tagx were to be used by .jspx files, but maybe I am wrong.
              Regards,
              LG

Maybe you are looking for

  • Problem with Java threads

    Hi, I developed a class, which reads some data from an XML file and transports it to a database, using JDBC. The class worked perfectly fine.Then, I used a thread to execute the same class (using the run() method and the usual stuff), but now as soon

  • Can't open March 2013 in my calendar

    Every time I try to access March 2013 in Calendar (iPad retina display), it crashes out. It will allow me to add an event in March, but when I try to view it, the app closes. (It will, however, allow me to open March 2014.) Any ideas on how to solve

  • What are the names of the flowers on Apple TV screen saver?

    what are the names of the flowers on Apple TV screen saver? I am looking for the the botanical names... Would anyone know where to find the credits for the photos used on the flowers screen saver? -carol8ne

  • Trouble in Claim Digger

    Hi, i am not able to run claim digger in P6.2. the error message says " unable to access jarfile C:/" can anybody guide me on what to do?

  • SQLite version - AIR 1.0 vs 1.5 vs 2.0

    I've come to understand that AIR uses its own built-in version of SQLite but it's been hard to grasp what version is being used in each AIR version? Has there been any upgrades to the SQLite version from 1.0 to 1.5 to 2.0beta? I did notice that Neste