WebLogic Server 7.0: Including another JSP from within a custom tag

Hi all,
          has anyone made experience with including (ie. processing) a dynamic
          resource (JSP) from within a custom JSP tag?
          Using the following code inside doEndTag():
          pageContext.include("/templates/blub.jsp");
          throws a ServletException (Note: the JSP is a part of the web app
          which is deployed as war). Does it make a difference if the web
          application is warred up into and therefore include cannot resolve the
          specified relative URL?
          [Tomcat 4.1.10 doesn't have problems for that matter]
          The full stack trace is:
          javax.servlet.ServletException: java.lang.NullPointerException
          at com.foo.taglibs.template.InsertTag.doEndTag(InsertTag.java:55)
          at jsp_servlet._models.__index._jspService(__index.java:774)
          at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
          at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:945)
          at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:332)
          at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:376)
          at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
          at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5360)
          at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
          at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3043)
          at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2468)
          at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
          at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
          TIA,
          niko.
          

Try the same code from an exploded web app.
          Niko Schmuck wrote:
          > Hi all,
          >
          > has anyone made experience with including (ie. processing) a dynamic
          > resource (JSP) from within a custom JSP tag?
          >
          > Using the following code inside doEndTag():
          >
          > pageContext.include("/templates/blub.jsp");
          >
          > throws a ServletException (Note: the JSP is a part of the web app
          > which is deployed as war). Does it make a difference if the web
          > application is warred up into and therefore include cannot resolve the
          > specified relative URL?
          > [Tomcat 4.1.10 doesn't have problems for that matter]
          >
          > The full stack trace is:
          >
          > javax.servlet.ServletException: java.lang.NullPointerException
          > at com.foo.taglibs.template.InsertTag.doEndTag(InsertTag.java:55)
          > at jsp_servlet._models.__index._jspService(__index.java:774)
          > at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
          > at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:945)
          > at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:332)
          > at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:376)
          > at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
          > at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5360)
          > at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
          > at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3043)
          > at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2468)
          > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
          > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
          >
          > TIA,
          > niko.
          Rajesh Mirchandani
          Developer Relations Engineer
          BEA Support
          

Similar Messages

  • Problem using jsp:include from inside a custom tag

    Hi, All !
              I have a problem using <jsp:include> from inside a custom tag. Exception is:
              "java.lang.ClassCastException: weblogic.servlet.jsp.BodyContentImpl"
              Apparently, weblogic tries to cast BodyContentImpl to JspWriterImpl and
              could not do this. Is it a bug, since in the 1.1 spec is said: "The
              BodyContent is a subclass of JspWriter that can be used to process body
              evaluations so they can retrieved later on."
              My code is:
              <wfmklist:items>
              <jsp:include page="item.jsp" flush="true"/>
              </wfmklist:items>
              

    This is an area of contention with WL. It is not so tolerant with regards to
              the spec. I spent several days recently trying to convince it to accept the
              specification in regards to bodies and includes and it appears to have
              successfully rebuffed my efforts.
              Frankly, this is very disappointing. It appears that some shortcuts were
              taken on the way to JSP 1.1 support, and the result is a very hard-coded,
              inflexible implementation. As I have not seen the implementation myself, I
              hate to assume this, however one could posit that the term "interface" was a
              foreign concept during the implementation, other than as some annoying
              intermediary reference requiring an immediate cast to a specific Weblogic
              class, which in turn is apparently required to be final or have many final
              methods, as if being optimized for a JDK 1.02 JIT.
              I am sorry that I don't have any positive suggestions other than to use a
              URL object to come back in an execute the necessary "include" directly. You
              lose all context (other than session) and that can cause its own problems.
              However, you can generally get the URL approach to work, and you will
              hopefully avoid further frustration.
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com
              Tangosol: How Weblogic applications are customized
              "Denis" <[email protected]> wrote in message
              news:[email protected]...
              > Hi, All !
              > I have a problem using <jsp:include> from inside a custom tag. Exception
              is:
              > "java.lang.ClassCastException: weblogic.servlet.jsp.BodyContentImpl"
              >
              > Apparently, weblogic tries to cast BodyContentImpl to JspWriterImpl and
              > could not do this. Is it a bug, since in the 1.1 spec is said: "The
              > BodyContent is a subclass of JspWriter that can be used to process body
              > evaluations so they can retrieved later on."
              >
              > My code is:
              > ...
              > <wfmklist:items>
              > <jsp:include page="item.jsp" flush="true"/>
              > </wfmklist:items>
              > ...
              

  • Is it possible to call methods from another class from within an abstract c

    Is it possible to call methods from another class from within an abstract class ?

    I found an example in teh JDK 131 JFC that may help you. I t is using swing interface and JTable
    If you can not use Swing, then you may want to do digging or try out with the idea presented here in example 3
    Notice that one should refine the abstract table model and you may want to create a method for something like
    public Object getValuesAtRow(int row) { return data[row;}
    to give the desired row and leave the method for
    getValuesAt alone for getting valued of particaular row and column.
    So Once you got the seelcted row index, idxSelctd, from your table
    you can get the row or set the row in your table model
    public TableExample3() {
    JFrame frame = new JFrame("Table");
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {System.exit(0);}});
    // Take the dummy data from SwingSet.
    final String[] names = {"First Name", "Last Name", "Favorite Color",
    "Favorite Number", "Vegetarian"};
    final Object[][] data = {
         {"Mark", "Andrews", "Red", new Integer(2), new Boolean(true)},
         {"Tom", "Ball", "Blue", new Integer(99), new Boolean(false)},
         {"Alan", "Chung", "Green", new Integer(838), new Boolean(false)},
         {"Jeff", "Dinkins", "Turquois", new Integer(8), new Boolean(true)},
         {"Amy", "Fowler", "Yellow", new Integer(3), new Boolean(false)},
         {"Brian", "Gerhold", "Green", new Integer(0), new Boolean(false)},
         {"James", "Gosling", "Pink", new Integer(21), new Boolean(false)},
         {"David", "Karlton", "Red", new Integer(1), new Boolean(false)},
         {"Dave", "Kloba", "Yellow", new Integer(14), new Boolean(false)},
         {"Peter", "Korn", "Purple", new Integer(12), new Boolean(false)},
         {"Phil", "Milne", "Purple", new Integer(3), new Boolean(false)},
         {"Dave", "Moore", "Green", new Integer(88), new Boolean(false)},
         {"Hans", "Muller", "Maroon", new Integer(5), new Boolean(false)},
         {"Rick", "Levenson", "Blue", new Integer(2), new Boolean(false)},
         {"Tim", "Prinzing", "Blue", new Integer(22), new Boolean(false)},
         {"Chester", "Rose", "Black", new Integer(0), new Boolean(false)},
         {"Ray", "Ryan", "Gray", new Integer(77), new Boolean(false)},
         {"Georges", "Saab", "Red", new Integer(4), new Boolean(false)},
         {"Willie", "Walker", "Phthalo Blue", new Integer(4), new Boolean(false)},
         {"Kathy", "Walrath", "Blue", new Integer(8), new Boolean(false)},
         {"Arnaud", "Weber", "Green", new Integer(44), new Boolean(false)}
    // Create a model of the data.
    TableModel dataModel = new AbstractTableModel() {
    // These methods always need to be implemented.
    public int getColumnCount() { return names.length; }
    public int getRowCount() { return data.length;}
    public Object getValueAt(int row, int col) {return data[row][col];}
    // The default implementations of these methods in
    // AbstractTableModel would work, but we can refine them.
    public String getColumnName(int column) {return names[column];}
    public Class getColumnClass(int col) {return getValueAt(0,col).getClass();}
    public boolean isCellEditable(int row, int col) {return (col==4);}
    public void setValueAt(Object aValue, int row, int column) {
    data[row][column] = aValue;
    };

  • Changing state of application from within a custom component

    Hello, I have several custom components all of which are included in the parent application.
    When I try to change state from a custom component, I get an error  saying "undefined state: state name". How do I change the state of the  application from within a custom component ? All the states are defined in the parent application.

    @linrsvp,
    If you are using Flex3 try Application.application.currentState = "somestate";
    If you are using Flex4 try FlexGlobas.topLevelApplication.currentState = "somestate";
    Don't forget to import the corresponding namespaces for the above.
    Thanks,
    Bhasker

  • Retrieve data from AD from within a custom sharepoint 2010 webpart

    Hi,
    I have a requirement to retrieve user data from AD and display from within a custom built webpart.
    I am using the PrincipalContext class etc to get the info from AD, i have sucesfully done this in a console program without having to specifiy a username/password.
    In the webpart i have successfully retrieved the data by hard coding my domain username/password.
    Any ideas what i could do to get the webpart to retrieve information from AD without having to specify username/password?
    thanks cjm

    Hi C.J, 
    I wrote an example of this using credentials stored in the Secure Store in the TechNet Wiki. The article is here: http://social.technet.microsoft.com/wiki/contents/articles/20110.sharepoint-retrieving-credentials-from-the-secure-store-application-using-c.aspx
    There's an example in the above article about building a webpart that connects to AD using the credentials.
    Regards, Matthew
    MCPD | MCITP
    My Blog
    View
    Matthew Yarlett's profile
    See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
    Upload and Crop User Profile Photos

  • Add task to notification from within the customer enhancement

    Is there a function module that will add a task to a notification from within a customer exit?  I've tried to use a BAPI within QQMA0014 (Save Exit) , but this interferes with the processing of the notification.  The imported internal task table for the exit can be manipulated, but I am not sure how, or what, needs to be present and would prefer using a function module.
    Thanks,
    Brian Basch

    Brian,
       I would activate the change document for the custom fields which will act as a trigger for a custom event(Even better than creating a generic event based on create / change notification) that would be tied to a simple single step standard task pointing to a create Task FM. I would use the exit on SAVE to update the custom fields for the task(You will have to enhance your BAPI to update the custom fields if you don't want to use this exit).
    Regards
    Narasimhan

  • In a jsp page how can i include another page from differenct web context

    Hi,
    i want to include a page from another web content to my page. How is it possible. For example in a jsp page i want to include "http://www.google.com". How is it possible. can i use <jsp:include tage for this purpose? any idea?
    Edited by: JavaHeroPrince on Apr 2, 2009 12:05 AM

    I'm afraid you cannot do that using <jsp:include/> tag.
    However, you can achive this using <c:import/> tag which comes with JSTL core tags.
    Please find the below example of how to go about.
    <%@ taglib uri = "http://java.sun.com/jstl/core" prefix = "c"%>
    <c:import url = "http://www.google.com/search">
      <c:param name="q" value="c%3Aimport+jstl"/>
      <c:param name="rls" value="com.microsoft:en-us"/>
      <c:param name="ie" value="UTF-8"/>
      <c:param name="oe" value="UTF-8"/>
      <c:param name="startIndex" value=""/>
      <c:param name="startPage" value="1"/>
    </c:import>
    -------------------------------------------------------------------------for more info
    [http://java.sun.com/developer/technicalArticles/javaserverpages/faster/]
    Hope that helps :)
    REGARDS,
    RaHuL

  • How can I link to a jsp page from another jsp page within websphere portal?

    Afternoon all,
    I have a websphere portlet which displays a jsp page. I want to put a hyperlink on the jsp page which when clicked will open another jsp page.
    Does anyone know how to do this?
    Thanks,
    Alex

    The anchor tag is the correct one for generating clickable links.
    <jsp:forward> is for transferring control at the server end. Its when you decide to change which page you want to show the user. ie check user is logged in. If not then forward them to login page, else display current page.
    I tried that. It does open the jsp page
    but the place and page links in the portal theme get screwed up.Whats mucked up about them? Do they point where they shouldn't?
    You might try using a <base> tag to set where relative links are resolved from.
    Cheers,
    evnafets

  • How to have an app include a JSP from a module outside of that app?

    How can you have your application include a JSP that is in a different
    module outside of that application?
    For example, /NASApp/app1/jsp/Main.jsp looks like the following...
    <jsp:include page="/mod1/jsp/header.jsp"/>
    <jsp:include page="/mod1/jsp/footer.jsp"/>
    For me, header.jsp and footer.jsp are not found because iAS is
    prepending "/app1" and trying to find
    <IAS>/APPS/app1/mod1/jsp/header.jsp on the file system instead of
    <IAS>/APPS/modules/mod1/jsp/header.jsp. Same for footer.jsp. Even if
    Main.jsp were part of a module and not an application, I see the same
    type of results.
    Earlier postings suggest this can be done as long as it is an
    application to module or module to module paradigm. But an application
    to application paradigm would violate J2EE. If this is true, how do you
    make this work?
    Thanks,
    George Cutrell
    Nextel Communications, Inc.

    Hi George,
    You cannot access any file in a j2ee application from other j2ee application, since it violates the j2ee specs. To do this, I think, the only way is to simply copy that file into your application.
    Thanks,
    Rakesh.

  • In portlet context include a jsp from the desktop context

    Hi,
    I developed a portlet, and in my jsp file I want to include a jsp file which is in my portal desktop (the file is in /etc/opt/SUNWps/desktop/..).
    So I want to do something like:
    <c:import url="file:///etc/opt/SUNWps/desktop/mydesktop/ PortletHeader.jsp" /> Of course this doesn't work because the jsp expressions are not executed, instead the jsp tags are just displayed in the browser.
    but for including a jsp with <@include file> or <c:import> or <jsp:include>, the jsp must run in its context. So actually we should do something like <c:import url="some_path" context="some_context" >.
    Now, I don't know what some_context is. To what context the portal desktop runs so the jsp file can be 'executed'?
    Hope someone can give me some more information about this.
    Greets,
    Tim

    <quote>some_context <quote>
    ..will be the pageContext
    which is the implicit object for a JSP.
    or
    use config object to get this context and then use
    <jsp:include> or <@include file>
    rgds
    http://lokeshpant.blogspot.com

  • JSP Tag -- Including a JSP fragment in a Java Tag file

    Hi all,
    I have a query regarding JSP Tag file authoring by extending the TagSupport class. I would like to know if it is possible to include a JSP file fragment inside a Java file somehow.
    Specifically, I have created a simple template tag, which adds a header and footer template to the resulting HTML page.
    <bc:template>
    Hello World!
    </bc:template>produces for example
    <html><body>
    Hello World!
    </body></html>Now I have two JSP fragment files (head.jspf and foot.jspf), and I want to do do something like
    public class HtmlTemplateTag extends TagSupport implements TryCatchFinally {
      public int doStartTag() {
        // somehow include head.jspf
        return EVAL_BODY_INCLUDE;
      public void doFinally() {
        // somehow include foot.jspf
    }Which means, I want to execute had.jspf and foot.jspf from the Java class file. I am not sure if it is even possible. If anyone can help me with this, it would be greatly appreciated.
    thanks
    nilesh

    Your intention is to put a header/footer on pages in your web application?
    There is another way to do it - specify prelude/coda jsp fragments in web.xml
    Something like the following:
    <jsp-config>
      <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <include-prelude>/WEB-INF/jspf/head.jspf</include-prelude>
        <include-coda>/WEB-INF/jspf/foot.jspf</include-coda>
      </jsp-property-group>
    <jsp-config>

  • Urgent: Unable to run JSP pages(using JRun Custom Tags) in Weblogic 5.1

    Hi,
    I am using JRun Custom tags to bulid JSP pages.
    Could not run the jsp page on Weblogic 5.1.
    I could run the same on JRun Server but not on Weblogic?.
    Had placed JRuntags.jar in the web_inf directory.
    What/where i need to update in properties file?.
    Please reply..
    Best Wishes.
    Satish k.Yalamaddi.

    javax.servlet.ServletException: com/sun/tools/javac/Main (Unsupported major.minor version 49.0)
    This is your problem either your tomcat or eclipse is pointing to a wrong jre
    here the problem is you are trying to run a code that was compiled using j2sdk1.5 in j2sdk1.4

  • Installing another distro from within archlinux

    I want to install another linux distro an a second hd. Is it possible to do this from within archlinux? I can't use my dvd writer because it broke down.

    learn how to use a chroot, this is easy to do then. archwiki has a great couple of articles on chroot.
    what you essentially need to do is partition the second drive in whatever fashion you like. then use mkfs to create filesystems on the partitions. then edit fstab to include the mountpoints. then comes the toughest part. depending on the distro you want to install, you need to grab the base packages for the system and install them with ./configure, make, make install. be sure to use the proper root/install dir(i.e. not the hdd arch is on). after the base packages + package manager are installed, try to use chroot to essentially change from arch into the newly installed system, and give the package manager a try from in there. should work fine. you won't have any of the stuff preconfigured yet, but as soon as you configure the conf file for the package manager to include the proper repos, you will run the update/upgrade and install various things which will come in that distro's preconfigured flavours. then edit your menu.lst/grub.cfg (grub-legacy/grub2) to include the new distro and reboot!
    maybe i missed a step or two here and there, but afaik that's really all you need to do.
    if you want to just use an iso, that's another story.

  • Calling another cache from within AbstractProcessor.process fails, why?

    I want to enrich a certain data object in a distributed cache via the EntryProcessor framework. The new data is looked up from another nearby cache.
    However, when calling otherCache.get(id) Coherence throws an exception saying that it does not allow blocking calls from within a processor:
    *[java] Caused by: com.tangosol.util.AssertionException: poll() is a blocking call and cannot be called on the Service thread...*
    Is this fixable? What am I missing? Does anyone recommend alternative ways to read data from other caches inside AbstractProcessor?
    Thanks in advance,
    -Stefan
    This is the calling code that executes in the node where the primary object is:
    public class ExternalPropertiesUpdateProcessor extends AbstractProcessor implements PortableObject {
    @Override
    public Object process(InvocableMap.Entry entry) {
    Session session = null;
    if (entry.isPresent()) {
    session = (Session) entry.getValue();
    NamedCache cidCache = CacheFactory.getCache("cidCache");
    Long oldCid = new Long(97);
    CidConversion cidCon = (CidConversion) cidCache.get(oldCid); // * it fails here with above exception!
    session.setCid(cidCon.getNewCid());
    session.setState(Session.SESSION_CLOSED);
    entry.setValue(session); // make session changes durable in cache
    return session;
    Edited by: [email protected] on Dec 10, 2009 9:35 AM

    Ben Stopford wrote:
    Hi Rob
    You mention:
    If you call back to the same cache service via an invocation service, you still risk a deadlock or a livelock due to thread-pool depletion. It looks like it is working, then you may run into the problem. It is not 100% safe.which sparked my interest. Would you mind elaborating a little further. I'd always assumed that the threadpools for separate services were independent and thus there was no chance of deadlock from cross-service calls such as this.
    Thanks in advance
    BenHi Ben,
    as I mentioned, it can cause a problem if you indirectly call back to a service which was on the call stack.
    Let's see an example:
    You send an entry processor to a cache in service A, which synchronously (with the query() method) calls to Invocation service I in which the invocable agent sends an entry-processor to service A (again) targeted to an entry on the same node.
    Let's for the sake of the simplicity of the example suppose service A has a thread pool of size 2.
    You send two such entry-processors on entries residing in the same node.
    We now have a possible deadlock. If both entry-processors entered the first process() method (doesn't matter what entry as long as they are on the same node), they can both proceed into the invocation service call, but from that none of them can proceed further to the inner invoke() call, because there are no more free threads in service A!!! Poof, deadlock, both threads will wait until a thread becomes available... and none will become available because none of the service calls can proceed.
    Of course, starting with 3.5 the Guardian will kill one of the threads (at least), and in earlier version it will also time out, but the point is that they will not be able to complete in this scenario.
    Best regards,
    Robert

  • In Captivate 7, how can I call another action from within an action?

    I have a conditional action called FakeSuccessRewind. Now I need to call another function called ShowGrayBalloons02 from within its Else statement, but I couldn't find something like "Execute Advanced Action." Can anybody share some tips here? Thanks!
    Below are screenshots of my two actions:
    1) FakeSuccessRewind (if/else). Here I need to call the 2nd action from the Else statement, underneath the statement Go to the next slide.
    2) ShowGrayBalloons02. Note this function has five seperate runs when the variable is decrementing from 5-1.
    Thanks a lot!
    Melissa

    You can't, you need to add the other action into the first one.

Maybe you are looking for