Dynamic include in a custom tag, called from a jsp

Hello, I would like to be able to dynamically include other jsp's from within a custom tag that I create. is this possible?
in a jsp page i would just write <%@ include file="file.jsp" %> and all would be ok... but if i do an out.println( "<%@ include file=\"file.jsp\" %>" ); inside a custom tag bean then it doesn't work. it just prints out the command to the page as plain text.
I do understand why this is happening, but can anyone offer me a way around this problem?
Thanks in advance,
Randy

That's actually the same result as you get with a normal include - The method I suggested is a dynamic include similar to the <jsp:include> tag, not the <%@ include %> tag.
When you use a dynamic include, the included page is compiled and 'invoked' as serarately, and the result is what gets included, not the actual source. To get the behaviour you want would require an include directive (the <%@ include %> tag) which I don't think has an equivalence you can use inside a custom tag.
What you can do is pass attributes from the tag class like this:
pageContext.setAttribute(<name>, <object>, pageContext.REQUEST_SCOPE);
and then remove them after the include using pageContext.removeAttribute.
I'm not certain, but this implies that if you declare your variables with a <jsp:usebean> tag with request scope, instead of normal Java variable declarations, you should be able to use them in the page included by the custom tag.
*** in the jsp ***
<jsp:useBean id="myVar" scope="request" class="java.lang.String" />
<% myVar = "Something"; %>
// Now call the tag which uses the pageContext.include() mehtod.
*** end ***
*** in the include ***
<jsp:useBean id="myVar" scope="request" class="java.lang.String" />
<%= myVar + " something else" %>
*** end ***
Let me know if it works.

Similar Messages

  • How to use custome tag lib in the JSP page?

    How to use custome tag lib in the JSP page?...with JDeveloper

    http://www.oracle.com/webapps/online-help/jdeveloper/10.1.2/state/content/navId.4/navSetId._/vtTopicFile.working_with_jsp_pages%7Cjsp_ptagsregistering~html/

  • Jsp:include problem in custom tag

    I call <jsp:include page="emailbody.jsp" /> within a custom tag(in a file
              caller.jsp), which does emailing.
              When I invoke caller.jsp from browser, I do get the output(body of the
              email) on the browser screen, but not the output is not send as the body of
              the email.
              When I use static include namely, <@include file="emailbody.jsp" />, the
              output is directed to the body of the email.
              The above means, for a static jsp include file, it is parsed and included in
              the body-evaluation of the custom tag.
              For a dynamic include file, it is NOT parsed and NOT included in the
              body-evaluation of the custome tag.
              The reason could be, How Weblogic loads classes for custom-tag for dynamic
              include files.
              Can anybody at BEA throw loght on this and the solution.
              Thanks in advance.
              Chandra
              

    Well I found out jsp:include is not supported inside custom tags for JSP
              spec 1.1.
              This was stated in section 5.4.5 of spec 1.1.
              May be in future spec 1.2.
              Thanks
              Chandra
              "Cameron Purdy" <[email protected]> wrote in message
              news:[email protected]...
              > Have you sent this to [email protected]?
              >
              > It sounds serious.
              >
              > Peace,
              >
              > --
              > Cameron Purdy
              > Tangosol, Inc.
              > http://www.tangosol.com
              > +1.617.623.5782
              > WebLogic Consulting Available
              >
              >
              > "matthew mcclain" <[email protected]> wrote in message
              > news:[email protected]...
              > > I have run into the same problem.
              > > I'm certain it's because CustomTags have their own buffer and
              > > jsp:include or pageContext.include() or requestDispatcher.include()
              > > all bypass the buffer and write to the underlying stream.
              > >
              > > I attempted to define jspx:include by wrapping the response object
              > > which is sent to requestDispatcher.include and then wrapping the
              > > OutputStream returned from the response with a stream which
              > > writes to the "out" of the pageContext for my tag.
              > >
              > > Unfortunately, I get a class cast exception because weblogic expects
              > > it's own class to be there as a ServletOutputStream:
              > >
              > > java.lang.ClassCastException:
              com.allmystuff.wif.IncludeServletResponse$1
              > > at
              > >
              >
              weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImp
              > > l.java:202)
              > > at
              > >
              >
              weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImp
              > > l.java:172)
              > > at com.allmystuff.wif.Include.doStartTag(Include.java:37)
              > >
              > > So any chance, jsp:include will get fixed?
              > >
              > > Thanks,
              > > Matthew McClain
              > > [email protected]
              > >
              > >
              > > "chandra" <[email protected]> wrote in message
              > > news:[email protected]...
              > > > I call <jsp:include page="emailbody.jsp" /> within a custom tag(in a
              > file
              > > > caller.jsp), which does emailing.
              > > > When I invoke caller.jsp from browser, I do get the output(body of the
              > > > email) on the browser screen, but not the output is not send as the
              body
              > > of
              > > > the email.
              > > > When I use static include namely, <@include file="emailbody.jsp" />,
              the
              > > > output is directed to the body of the email.
              > > >
              > > > The above means, for a static jsp include file, it is parsed and
              > included
              > > in
              > > > the body-evaluation of the custom tag.
              > > > For a dynamic include file, it is NOT parsed and NOT included in the
              > > > body-evaluation of the custome tag.
              > > > The reason could be, How Weblogic loads classes for custom-tag for
              > dynamic
              > > > include files.
              > > > Can anybody at BEA throw loght on this and the solution.
              > > > Thanks in advance.
              > > > Chandra
              > > >
              > > >
              > >
              > >
              >
              >
              

  • Finding the custom tag name from inside the tag handler

    Hello,
    I searched the forum, but couldnt find the answer (or in the API). In my custom tag handler, I want to know what the name of the custom tag was. Is this possible?
    Thanks in advance.
    Chris
    ps. Without parsing the .tld file... :)

    Hmm, that's unfortunate. Thanks a lot for your work. I had a feeling since it wasn't in the API that it wasn't possible. Here's why, and maybe they will add this feature later...
    We are making our own tags for buttons on our app (the button will be an HTML table, with a clickable background, that looks like an image, but isnt).
    The HTML designers want tags they can drag and drop to the screen in DreamWeaver, including visual feedback on what they dragged and dropped. So the tag <fast:blueButton>Continue</fast:blueButton> will show a blue button image in dreamWeaver with "Continue" as the text. There are a lot of parameters to set for each button, like height, width, border, etc. that will be configured in an XML config file for each button.
    It would be nice if all the buttons we invent in the tld point to the same generic button class, and when the generic button class runs, sees which button called it, and gets its config from an XML file.
    This way the designer could add more buttons with the tld and XML config, and no more java classes are needed. However, if a generic button is sent with a type param: <fast:button type="blue">Continue</fast:button> then there is no visual feedback in the tool (in the first case we could have set the fast:blueButton to be the image of a blue button) and it cant be picked from a list in the tool (the designer needs to remember which types exist). It seems not important to programmers, but for designers it is important.
    Oh well, I will see if there is another way to NOT have tons of Java classes to support.
    Thanks,
    Chris

  • 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

  • Is it possible to set a custom tag attribute from a TagExtraInfo?

    Hi Everyone,
    I'm developing my own tags and I need to set some optional attributes of my custom tag if the user doesn't do it.
    Is is possible to do that on the IsValid method of a TagExtraInfo class?
    The code is running without exceptions but is not setting the attribute.
    My Tag (The optionValue attribute is optional):
    <qe:select name="cars" optionBody="carName" optionValue="carID" />My TagExtraInfo class:
    public class SelectTei extends TagExtraInfo {
        private static final Logger logger = Logger.getLogger(SelectTei.class);
        @Override
        public boolean isValid(TagData tagData) {
            String optionBody = tagData.getAttributeString("optionBody");
            String optionValue = tagData.getAttributeString("optionValue");
            if (optionBody != null && optionValue==null){
                    tagData.setAttribute("optionValue",optionBody);
            //Other validations.... 
            return true;
    }

    CFGadget wrote:
    It's not obvious as to how to set a background color which is by default, black.
    Assuming you mean set the background color of a new image, just set the desired canvas color using hex or a named color ie "red", "white", ...
                    ImageNew([source, width, height, imageType, canvasColor])

  • Custom tag in JSPTableContainerProvider/tabletopbottom.jsp

    Tried creating a new tag based upon 'getHasFrame' tag in 'desktopTable.tld'. The jsp referenced above throws the following exception:
    ERROR: JspRequestDispatcher:
    javax.servlet.ServletException: Problem processing JSP: /../JSPTableContainerProvider/tabletopbottom.jsp
    at com.sun.portal.providers.jsp.JspRequestDispatcher.getJspResource(JspRequestDispatcher.java:164)
    at com.sun.portal.providers.jsp.JspRequestDispatcher.include(JspRequestDispatcher.java:97)
    at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:408)
    at jsps.etc._opt._SUNWps._desktop._pinpoint_en_US._Home._html._table_jsp._jspService(_table_jsp.java:526)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.sun.portal.providers.jsp.JspServletWrapper.service(JspServletWrapper.java:182)
    at com.sun.portal.providers.jsp.JSPProvider.processJspFile(JSPProvider.java:692)
    at com.sun.portal.providers.jsp.JSPProvider.processJspFile(JSPProvider.java:672)
    at com.sun.portal.providers.jsp.JSPProvider.getContent(JSPProvider.java:471)
    at com.sun.portal.desktop.context.PSContainerProviderContext.getContent(PSContainerProviderContext.java:367)
    at com.sun.portal.desktop.taglib.containerProviderContext.GetContentTag.doStartTag(GetContentTag.java:33)
    at jsps.etc._opt._SUNWps._desktop._pinpoint_en_US._PinPointTabContainer._html._tab_jsp._jspService(_tab_jsp.java:596)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.sun.portal.providers.jsp.JspServletWrapper.service(JspServletWrapper.java:182)
    at com.sun.portal.providers.jsp.JSPProvider.processJspFile(JSPProvider.java:692)
    at com.sun.portal.providers.jsp.JSPProvider.processJspFile(JSPProvider.java:672)
    at com.sun.portal.providers.jsp.JSPProvider.getContent(JSPProvider.java:471)
    at com.sun.portal.providers.containers.jsp.tab.JSPTabContainerProvider.getContent(JSPTabContainerProvider.java:535)
    at com.sun.portal.desktop.context.PSContainerProviderContext.getContent(PSContainerProviderContext.java:367)
    at com.sun.portal.desktop.context.PSDesktopContext.getContent(PSDesktopContext.java:957)
    at com.sun.portal.desktop.DesktopServlet.doGetPost(DesktopServlet.java:493)
    at com.sun.portal.desktop.DesktopServlet.service(DesktopServlet.java:303)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:897)
    at com.iplanet.server.http.servlet.WebApplication.service(WebApplication.java:1059)
    at com.iplanet.server.http.servlet.NSServletRunner.ServiceWebApp(NSServletRunner.java:959)
    The tagclass referenced by the tag was compiled on the server.
    No logging associated with the doStartTag() method or the tag's constructor ever comes through.
    Seems like it can't find the class at all ?
    The jsp complains about this line:
    <dttable:getHasHeader id="hasHeader" scope="request"/>
    where --
    <%@ taglib uri="/tld/desktopTable.tld" prefix="dttable" %>
    and the tld file contains the following tag:
    <tag>
    <name>getHasHeader</name>
    <tagclass>com.xyz.portal.desktop.tags.GetHasHeaderTag</tagclass>
    <bodycontent>empty</bodycontent>
    <attribute>
    <name>id</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>scope</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    Any clues ?

    Has anyone been able to get their own tags to work? Here's the very odd situation to clarify a little of what my colleague originally posted:
    Custom tag class written based on the 'getHasFrame' tag
    Added a declaration to the desktopTable.tld file for the tag
    Put the classes in
    ....../desktop/classes
    ...../SUNWam/lib
    as both jar files and plain-old class files
    Made sure the jars and directories are in the classpath property in jvm12.conf and in the jspCompilerWARClassPath property of desktopconfig.properties (trying anything at this point)
    Even if the tag is screwed up, here's the kicker....I just did a Class.forName() on the tag class and that throws a Throwable. eh? We've written a bunch of other custom classes that we just use in our JSPs with no problem. I don't get why this is such a special case.
    Anybody got a clue for me?
    In which directories did you place the tld and
    *.class files for the taglib?
    The class files should probably be in
    /etc/opt/SUNWps/desktop/classes (or someplace else in
    the web server's classpath)
    The tld should probably be in
    /etc/opt/SUNWps/desktop/default/tld (default may be
    named differently if you changed the "desktop type"
    in the admin console under the desktop definition).

  • Can EJB's be called from within JSP pages?

    Hi,
    (This is a general question, not necessarily related to OAS in any way...)
    I have read/heard conflicting reports pertaining to calling EJBs from within JSP pages.
    Can anyone tell me if it's possible to reference an EJB session bean from a JSP page? Can anyone point me to some documentation on the topic?
    Any help would be appreciated. Thanks!
    David Christopher
    [email protected]

    Hi,
    Check the following code: http://www.jguru.com/jguru/faq/view.jsp?EID=5314 for ejb example.
    -Ruchi
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Davidc:
    Hi,
    (This is a general question, not necessarily related to OAS in any way...)
    I have read/heard conflicting reports pertaining to calling EJBs from within JSP pages.
    Can anyone tell me if it's possible to reference an EJB session bean from a JSP page? Can anyone point me to some documentation on the topic?
    Any help would be appreciated. Thanks!
    David Christopher
    [email protected]<HR></BLOCKQUOTE>
    null

  • "Can't find bundle for base name" in a JavaBean called from a JSP

    I have quite a large EAR file which contains an EJB.jar file, a WAR file and various other jars used by the EJB.jar file. I the WAR file has a number of JSPs and now some JavaBeans. The JavaBeans live in their own jar which is deployed in the WEB-INF\lib directory. I am trying to use ResourceBundles for the error messages which are generated in the JavaBeans.
    Here is the problem. I have put the resource bundle properties files in the WEB-INF\classes directory and I can access them just fine from the JSPs. Not so from the JavaBeans, I get the following error:
    "Can't find bundle for base name webui-resources, locale en_US Can't find bundle for base name webui-resources, locale en_US ".
    I have tried just 'jarring' up the properties files into the JavaBeans jar but no dice.
    It 'smell's like a Classloader issue. Any help greatly appreciated.
    Ian.
    p.s. I am using JBoss 2.4.4 with Tomcat 3.2.3 and JDK 1.3.1_09 on XP.

    Here is my suggestion.
    Do you have the property file named "webui-resources_en_US.properties"?
    Here is the example
    language="en"
    country="US"
    locale = new Locale(language, country);
    bundle = ResourceBundle.getBundle("com.<companyname>.webui-resources");
    copy the webui-resources_en_US.properties file to the directory
    com.<companyname> in your workspace/IDE/localdirectory. or ftp that file to classes/com/companyname directory
    This should work. I am using it that way.
    which appserver r u using?

  • Need to dynamically include an image file when calling a popup window

    I am working on a web dynpro Java app which uses a button to call a popup window/view. Within the popup, I want to dynamically choose an image to show (from mime types) based on a criteria...there will be multiple buttons on the initial view that all call the same popup, but the popup will have content specific to which button called it (specifically the image embedded in the view).
    My question is, what is the proper/best way to do this?
    Here are some possible ways I can think of...
    1. Pass a parameter from each button during the call of the event, but how does that get sent to the implementation of the second view for use in determining which image? And, how do I modify the source property of the image element based on that parameter?
    2. Create multiple pages and views for each button to call...but this seems decidedly un-DRY.
    3. Saw one posting on how to dynamically create a cached image...I could use different event handlers in the initial view, then load individual images from the mime library at that point...cache it into a hard-coded image name...then just call the identical view every time. Not sure this is even possible...input?
    I don't know specifically how to implement any of these options, or know if there are other/better ways. Any help would be appreciated.

    Just create a context attribute "imageFileName" in the component controller or a custom controller, map this attribute from both views (the one that contains the buttons and the one in the popup window that displays the image).
    Now you can have an separate action for each button or one common action. In the first case just set the "imageFileName" inside the action handler for the specific button. In the second case use an action parameter "buttonId" and a parameter mapping
    button.mappingOfOnAction().setParameter("buttonId", button.getId());
    to determine which button triggered the action. After having checked which button was pressed, set the "imageFileName" accordingly.
    Armin

  • Include external html trough code in a custom tag

    Hi,
    I have a custom tag. The component class (say MyComponentUI) for my custom component extends UIComponentBase.
    I want to include an external html page, which url is formed using the content of an attribute of my tag (for example, the "value" attribute), through the MyComponentUI code.
    Can anyone give me some help ?
    Pietro

    That's actually the same result as you get with a normal include - The method I suggested is a dynamic include similar to the <jsp:include> tag, not the <%@ include %> tag.
    When you use a dynamic include, the included page is compiled and 'invoked' as serarately, and the result is what gets included, not the actual source. To get the behaviour you want would require an include directive (the <%@ include %> tag) which I don't think has an equivalence you can use inside a custom tag.
    What you can do is pass attributes from the tag class like this:
    pageContext.setAttribute(<name>, <object>, pageContext.REQUEST_SCOPE);
    and then remove them after the include using pageContext.removeAttribute.
    I'm not certain, but this implies that if you declare your variables with a <jsp:usebean> tag with request scope, instead of normal Java variable declarations, you should be able to use them in the page included by the custom tag.
    *** in the jsp ***
    <jsp:useBean id="myVar" scope="request" class="java.lang.String" />
    <% myVar = "Something"; %>
    // Now call the tag which uses the pageContext.include() mehtod.
    *** end ***
    *** in the include ***
    <jsp:useBean id="myVar" scope="request" class="java.lang.String" />
    <%= myVar + " something else" %>
    *** end ***
    Let me know if it works.

  • How to get and set custom tag attributes

    How do i get and set custom tag attributes from a jsp page?

    Not sure if this is what your looking for, but....
    example...
    < taglibprefix:testtag attribute1="x" attribute2="y">
    ...of course, the attributes have to be defined in your taglib (.tld) file

  • Problem Calling Query in Custom Tag

    I am using this code to call a custom tag called
    broadcast.cfm
    <cf_broadcast query="fe" orgID = "4">
    The query fe is an included file on my site and is available
    to the page I'm calling the custom tag from.
    In the custom tag I am referencing the query like:
    <cfloop query="#attributes.query#">
    but I keep getting this error:
    "The value of the attribute query, which is currently "fe",
    is invalid. "
    I must be missing something really simple here but can't
    figure out what.

    quote:
    Originally posted by:
    -==cfSearching==-
    rdk8487 wrote:
    > In the custom tag I am referencing the query like:
    > <cfloop query="#attributes.query#">
    > but I keep getting this error:
    > "The value of the attribute query, which is currently
    "fe", is invalid. "
    It is a scoping problem. The query is defined in the calling
    page. To access it by name, within the custom tag, use the "caller"
    scope.
    <cfloop query="caller.#attributes.nameOfTheQuery#">
    If the query object is passed to the custom tag via an
    attribute you shouldn't need the caller scope. See attached sample.

  • Calling custom OAF page from JSP page in Oracle apps

    Hi,
    I am working on a requirement to call a Custom OAF page from a JSP page in Oracle apps 11.5.10.
    I have registered the OAF page and defined a function for it. When we call this OAF page from JSP (without parameter), the page opens up
    URL: http://APPSURL:8020/OA_HTML/RF.jsp?function_id=27221&resp_id=50312&resp_appl_id=515&security_group_id=0&lang_code=US
    but as soon as I am trying to pass a parameter sr_id in the URL:
    http://APPSURL:8020/OA_HTML/RF.jsp?function_id=27221&resp_id=50312&resp_appl_id=515&security_group_id=0&lang_code=US&sr_id=106
    we are getting following error:
    You are trying to access a page that is no longer active.
    - The referring page may have come from a previous session. Please select Home to proceed.
    Please let me know if someone has faced the same problem...
    Thanks!!!

    Hi,
    Before calling a OAF page..from external JSP page...u need to set certain mandatory parameter like transaction Id and context.
    Regards,
    Gyan

  • Connection Pooling and JSP Custom Tag Library - is code (inside) the best way/correc?

    Hi, can anyone advise as to whether my tag library code (based
    on Apache Jakarta Project) will actually achieve connection
    pooling functionality across my entire JSP based application? I
    am slightly concerned that my OracleConnectionCacheImpl object
    may exist multiple times, hence rendering my conection pooling
    attempt useless.
    package com.solved.tag.dbtags.connection;
    import java.io.IOException;
    import java.sql.Connection;
    import java.sql.SQLException;
    import javax.servlet.jsp.tagext.TagSupport;
    import javax.servlet.jsp.JspTagException;
    import javax.sql.DataSource;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import oracle.jdbc.pool.OracleConnectionCacheImpl;
    * <p>JSP tag connection, used to get a
    * java.sql.Connection object.</p>
    * <p>JSP Tag Lib Descriptor
    * <pre>
    * &lt;name>connection&lt;/name>
    &lt;tagclass>com.solved.tag.dbtags.connection.ConnectionTag&lt;/t
    agclass>
    * &lt;bodycontent>JSP&lt;/bodycontent>
    &lt;teiclass>com.solved.tag.dbtags.connection.ConnectionTEI&lt;/t
    eiclass>
    * &lt;info>Opens a connection based on a jndiName.&lt;/info>
    * &lt;attribute>
    * &lt;name>id&lt;/name>
    * &lt;required>true&lt;/required>
    * &lt;rtexprvalue>false&lt;/rtexprvalue>
    * &lt;/attribute>
    * </pre>
    * @author Matt Shannon
    public class ConnectionTag extends TagSupport {
    static private OracleConnectionCacheImpl cache = null;
    public int doStartTag() throws JspTagException {
    try {
    Connection conn = null;
    if (cache == null) {
    try {
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup
    ("jdbc/pool/OracleCache");
    cache = (OracleConnectionCacheImpl)ds;
    catch (NamingException ne) {
    throw new JspTagException(ne.toString());
    conn = cache.getConnection();
    pageContext.setAttribute(getId(),conn);
    catch (SQLException e) {
    throw new JspTagException(e.toString());
    return EVAL_BODY_INCLUDE;
    package com.solved.tag.dbtags.connection;
    import java.sql.Connection;
    import java.sql.SQLException;
    import javax.servlet.jsp.tagext.TagSupport;
    * <p>JSP tag closeconnection, used to close the
    * specified java.sql.Connection.<p>
    * <p>JSP Tag Lib Descriptor
    * <pre>
    * &lt;name>closeConnection&lt;/name>
    &lt;tagclass>com.solved.tag.dbtags.connection.CloseConnectionTag&
    lt;/tagclass>
    * &lt;bodycontent>empty&lt;/bodycontent>
    * &lt;info>Close the specified connection. The "conn"
    attribute is the name of a
    * connection object in the page context.&lt;/info>
    * &lt;attribute>
    * &lt;name>conn&lt;/name>
    * &lt;required>true&lt;/required>
    * &lt;rtexprvalue>false&lt;/rtexprvalue>
    * &lt;/attribute>
    * </pre>
    * @author Matt Shannon
    * @see ConnectionTag
    public class CloseConnectionTag extends TagSupport {
    private String _connId = null;
    * The "conn" attribute is the name of a
    * page context object containing a
    * java.sql.Connection.
    * @param connectionId
    * attribute name of the java.sql.Connection to
    close.
    * @see ConnectionTag
    public void setConn(String connectionId) {
    _connId = connectionId;
    public int doStartTag() {
    try {
    Connection conn = (Connection)pageContext.getAttribute
    (_connId);
    conn.close();
    } catch (SQLException e) {
    // failing to close a connection is not fatal
    e.printStackTrace();
    return EVAL_BODY_INCLUDE;
    public void release() {
    _connId = null;
    package com.solved.tag.dbtags.connection;
    import javax.servlet.jsp.tagext.TagData;
    import javax.servlet.jsp.tagext.TagExtraInfo;
    import javax.servlet.jsp.tagext.VariableInfo;
    * TagExtraInfo for the connection tag. This
    * TagExtraInfo specifies that the ConnectionTag
    * assigns a java.sql.Connection object to the
    * "id" attribute at the end tag.
    * @author Matt Shannon
    * @see ConnectionTag
    public class ConnectionTEI extends TagExtraInfo {
    public final VariableInfo[] getVariableInfo(TagData data)
    return new VariableInfo[]
    new VariableInfo(
    data.getAttributeString("id"),
    "java.sql.Connection",
    true,
    VariableInfo.AT_END
    data-sources.xml:
    <?xml version="1.0"?>
    <!DOCTYPE data-sources PUBLIC "Orion data-
    sources" "http://xmlns.oracle.com/ias/dtds/data-sources.dtd">
    <data-sources>
    <data-source
    class="oracle.jdbc.pool.OracleConnectionCacheImpl"
    name="jdbc/pool/OracleCache"
    location="jdbc/pool/OracleCache"
    url="jdbc:oracle:thin:@oracle1:1521:pdev"
    >
    <property name="maxLimit" value="15" />
    <property name="cacheScheme" value="2" />
    <property name="user" value="console" />
    <property name="password" value="console" />
    <description>
    This DataSource is using an Oracle-native DataSource Class so as
    to allow Oracle Specific extensions.
    A getConnection() call on this DataSource will return
    oracle.jdbc.driver.OracleConnection.
    The connection returned is a logical connection.
    The caching scheme in place is Fixed Wait. Refer below to
    possible values.
    Dynamic 1
    Fixed Wait 2
    Fixed Return Null 3
    </description>
    </data-source>
    </data-sources>
    many thanks,
    Matt.

    Hi. Show me your pool definition.
    Joe
    Ramamurthy wrote:
    I am using the jsp custom tag library from BEA called sqltags.tld which came with Weblogic 5.1. Currently I am using Weblogic6.1 sp2 on Solaris.
    I have created a Connection Pool for Sybase database using the driver com.sybase.jdbc.SybDriver.
    When I created jsp page to connect to the connection pool using sqltags custom tag library, I am getting the error
    "javax.servlet.jsp.JspException: Failed to write body content
    at weblogic.taglib.sql.ConnectionTag.doAfterBody(ConnectionTag.java:43)
    at jsp_servlet.__hubwcdata._jspService(__sampletest.java:1014)"
    After this message, whenever I try to access the same jsp page I am getting the message
    "javax.servlet.jsp.JspException: Failed to load JDBC driver: weblogic.jdbc.pool.D
    river
    at weblogic.taglib.sql.ConnectionTag.doStartTag(ConnectionTag.java:34)
    at jsp_servlet.__hubwcdata._jspService(__sampletest.java:205)".
    Can you please help me the reason why this problem is happening and how to fix this ?
    This problem doexn't happen consistently. This occurs once in a while.
    I tried to increase Login delay Seconds parameter in the Connection Pool to 15 sec. It didn't help me much.
    Thanks for your help !!!
    Ram

Maybe you are looking for

  • I can not see the maps on the iphone 6 with iOS 8.1.2

    Tengo un iPhone 6 16Gb Mod. MG3C2CL/A, el cual lo actualicé a iOS 8.1.2. Al abrir la app de "MAPAS" (de Apple) no se visualizan los mapas en modo "Estándar" ni en los otros dos modos (Híbrido y Satélite). El GPS sí funciona y sí coloca el punto azul

  • BI : Trigger Job

    Hi Experts, I need to create a job which wil trigger at Last monday of fiscal month. I found FM which will do that work. I want to know is there any table in BI from where i can derive the date of last monday and trigger the job. Kindly advise. thank

  • Upgrade fee not refunded

    On 5th July I chose to upgrade 3 days early and pay a £53 fee. After doing so the store was unable to give me my phone. They contacted EE who spoke to me and said they had refunded the fee there and then. I upgraded 3 days later when it was free but

  • 4 year old MacBook Pro suddenly running VERY slow.  What's going on?

    Computer acting like something major is going on in the background, but nothing is.  Have run disk utility and it says disc is fine.  Removed many gbs of stuff in case that was causing problem.  Help!  I'm about to go out of town with it, and I need

  • Help!! Can not increase max_heap_size to 2048m

    Hi, I need to increase the max-heap-size parameter of my jnlp file to 2048m. The users absolutely need this as they get out of memory error with the current setup (1024m). But very strange thing happens. When I change the heap size, and try to launch