Including a file in a JSP from a different application

I have two different applications deployed in a Java Application Server 7 (their context root are "\Start" and "\Portal"). The second one uses a JSP of the first one doing like this:
File: \Portal\index.jsp
<%@include file="/Start/control.jsp"%>
But I get a "File not found error" of file "\Start\control.jsp" when I call "/Portal/index.jsp" in the browser.
On the other hand, when I call direclty that page from the browser using the URL "http://server/Start/control.jsp", this page works properly.
I have read in JSP documentation that if you put the forward slash "/" before the name of file, the include directive uses an absolute path instead of relative path.
According to this theory, the include directive in "/Portal/index.jsp" should find the file and copy the content into index.jsp before compilation, but it does not work.
I have try this sample in other environments such as JRun and Tomcat and I works properly.
Is this a specific thing of Java Application Server 7?
Can I do something to solve this problem?
Thanks in advance

This would be very useful to integrate static content HTML into the JSP page from an absolute path related to the site not only to the application (the WAR file).
But what about to include into a JSP page the content of another JSP page before the compilation into a servlet.
I mean ...
I have a JSP file in this path of the Web site "/Start/control.jsp" that it is deploy using the WAR file Start.war.
I have another JSP file in this path of the Web site "/Portal/index.jsp" that it is deploy using the WAR file Portal.war.
As we have seen, they are different applications so if I put into file "/Portal/index.jsp" the line
<%@include file="/Start/control.jsp"%>
, it does not work
if I put into file "/Portal/index.jsp" the line
<io:request url="/Start/control.jsp"/>
, it does not work because there are some objects define in the control.jsp file (for instance, a variable called "name") that are used in the index.jsp file and in time of compilation, a line in generated with this code:
out.write("<io:request url=\"/Start/control.jsp\"/>\r\n");
but there is no a copy of content of control.jsp in index.jsp before trying conversion to servlet. So when compilation goes on, it produces an error because it says that the variable "name" has not been declared (and the declaration is inside control.jsp).
That's way I need a sentence to include the code of a JSP into another JSP before compilation. A kind of concatenation of files or something similar previous to conversion and compilation to servlet.

Similar Messages

  • How can I include a jsp file in other jsp from different applications?

              Hi,
              I'd like know if it´s possible to include jsp or servlet from different applications.
              

              Thanks Deepak but I think you don´t understand me.
              I would like the include works like a normal include. I have a jsp in my application
              and , when the client requests this jsp, in the jsp should be added the result
              of the other jsp ejecution that belong to other application in the same domain.
              Is this possible?
              Thank you very much.
              Deepak Vohra <[email protected]> wrote:
              > A Jsp from a different application is included with a relative url to
              >th=
              >e Jsp.
              ><%@ include file=3D"relative url" %>
              >
              >A Jsp could be included with request parameter.
              > <jsp:include page=3D'<%=3D request.getParameter("incFile") %>' />
              >
              >javilla wrote:
              >
              >> Hi,
              >>
              >> I'd like know if it=B4s possible to include jsp or servlet from differe=
              >nt applications.
              >
              

  • How can i include a file in my JSP

    hello i have one jst who need to use an instance of a class called Part I need to include that file in my JSP but How do i do that
    How do i import my Part.java class in my JSP ???

    At the top of your JSP:
    <%@ import="package.*, package.Class" %>or you could do this:
    <%jsp:useBean class="package.Class" id="CLASS" scope="page" />or you can use a servlet as an include and have it write HTML back to the JSP:
    <jsp:include page="MyServlet">
         <jsp:param name="PARAM1" value="data1"/>
         <jsp:param name="PARAM2" value="data2"/>
    </jsp:include>

  • Safari keeps crashing every time I try to open a link from a different application, i.e. Mail. The trouble report says that some problem occurs with libcooliris.dylib plug-in. Can any one help?

    Safari keeps crashing every time I try to open a link from a different application, i.e. Mail. The trouble report says that some problem occurs with libcooliris.dylib plug-in. Can any one help?
    Thanks!

    Dear Linc,
    Thank you for the advice, John Blanchard1  and Linc Davis
    As suggested in your reference thread I removed "/Library/Printers/hp/PDEs/hpPostScriptPDE.plugin" and the problem has been resolved.
    I am guessing the the plug-in for the hp printers got corrupted and effected every thing, or became unsuitable when I installed an Apple update. I would be most grateful if you can confirm how the problem was coursed so I can understand and learn from this experiance.
    Ash

  • Run Script Logic/Package from a different Application

    Hi Experts,
    I have a scenario here that I need to run a package from a different application. For example, I'm in Finance application and I need to run a package which is in the LegalApp application, is it possible to call that package or perhaps run the logic it was calling without having switch back to LegalApp.
    Thanks,
    Marvin

    To run a package that runs logic on another application, you could copy a package such as "Default Formulas" and put the name of the target application in the new package's name.  Then go to Modify Package --> Advanced.  Edit the package to set the application as below.  The LegalApp (for example) is set on the third Task command.  Default logic is called on fifth.
    PROMPT(RADIOBUTTON,%CHECKLCK%,"Select whether to check work status settings when running logic.",1,{"Yes, check for work status settings before running logic","No, do not check work status settings"},{"1","0"})
    PROMPT(SELECTINPUT,,,,%CATEGORY_DIM%%ENTITY_DIM%%TIME_DIM%)
    TASK(Execute formulas,USER,%USER%)
    TASK(Execute formulas,APPSET,%APPSET%)
    TASK(Execute formulas,APP,LegalApp)
    TASK(Execute formulas,SELECTION,%SELECTIONFILE%)
    TASK(Execute formulas,LOGICFILE,)
    TASK(Execute formulas,CHECKLCK,%CHECKLCK%)

  • Include jsf file in a jsp page

    Hi Everyone,
    I have a plain jsp page with no JSF Components, but it has a jsp:include tag which is another jsp file which contains jsf components.
    When i try to run the plain jsp file ... i get the following error...
    java.lang.IllegalStateException: Cannot forward after response has been committed
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:324)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
         at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
         at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
         at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:589)
         at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
         at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
         at org.apache.jsp.DynamicWebpart_jsp._jspService(DynamicWebpart_jsp.java:278)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
         at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:589)
         at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
         at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
         at org.apache.jsp.Webpart_jsp._jspService(Webpart_jsp.java:302)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
         at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:589)
         at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
         at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
         .......... so.....on........
    I saw the source code for the plain jsp file and the error is because of including the jsp file with jsf components.
    The contents of both the jsp file is given below
    Plain jsp file
    DWStaticJSP.jsp
    <%@ page import="java.util.*" %>
    <%@ page import="com.mirus.bi.jsp.*" %>
    <%@ page import="com.mirus.bi.util.Log" %>
    <% Log.logDbg("*******before calling the faces file from DWStatic :"+rSetting.getStaticJSPFileName()); %>
    // name of the file name : /faces/report_palm.jsp
    <jsp:include page="<%=rSetting.getStaticJSPFileName()%>" flush="false" >     
                   <jsp:param name="DMode" value="DBoard" />
    </jsp:include>
    Jsp file with JSF component
    it is stored in faces folder
    /faces/report_palm.jsp
    <%@ page contentType="text/html" %>
    <%@ page import="com.mirus.bi.util.Log" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://mirus.com/jsftaglib" prefix="my" %>
    <f:view>
              <h:outputText value="Store Name:" />
              <h:outputText value="#{palmReportUIHandler.currentStoreDisplay}" />
              <h:outputText value="Year:" />
              <h:outputText value="#{palmReportUIHandler.currentYear}" />
              <h:outputText value="Month:" />
              <h:outputText value="#{palmReportUIHandler.currentMonth}" />
    </f:view>
    The Configuration in the web.xml for faces Servlet is given below
    <servlet>
    <servlet-name>FacesServlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <!-- Faces Servlet Mapping -->
    <servlet-mapping>
    <servlet-name>FacesServlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    Does anybody know the solution to this problem
    Any kind of help will be highly appreciated.
    Pinkesh

    Hi Adam Winer,
    I want to try your solution.
    just wanted some more clarification .....
    So, let's say you have:
    DWStaticJSP.jsp: plain JSP
    report_palm.jsp: JSF JSP included by DWStaticJSP.jsp
    What you should do is use an URL of:
    /faces/DWStatic.jsp
    to access the outer plain JSP (yes, even though it's not really a faces page), and then have
    /faces/DWStatic.jsp include just plain /report_palm.jsp.
    In essence, the critical thing is that the FacesServlet wraps the entire request - FacesServlet cannot run
    for just a piece of the request.My question is where should i store the DWStatic.jsp file ... As u said i should acces it using /faces/DWStatic.jsp do i need to save it in the faces folder or just in the web app root.
    I cant save the DWStatic.jsp in the faces folder as this file is used for lot of different purpose in my company application.
    So can u give me a solution where in i can keep the DWStatic.jsp in the web-root folder and still try your solution
    Also is this the right setting for facesServlet in the web.xml.
    <servlet>
    <servlet-name>FacesServlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <!-- Faces Servlet Mapping -->
    <servlet-mapping>
    <servlet-name>FacesServlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    Whatever follows below this line is the describtion of the web appp structure which i have in my company.
    We have an application where in all the jsp files are stored in the web-app root folder.....
    I will be using alphabets like a.jsp ... b.jsp .... to keep the explanation small...
    I have an a.jsp file which includes a b.jsp file which in turn includes a c.jsp......
    Now we have started using JSF.....
    Now as a developer .... i want the c.jsp to include a d.jsp file which contains JSF components...
    The thing is i cant change the location of a.jsp, b.jsp and c.jsp......
    Can u tell me how i should call " a.jsp" ... imean the url so that the "d.jsp" file gets processed properly.
    Also where should i save all the jsp files and what config is requiered in the web.xml for your solution
    I thank you for your help
    Pinkesh

  • How to Compile Jsp File in Class File , Protect my JSP from outworld

    Hello Friends
    My name is chandra prakash, I'm new for u. I've develop a web based software completely in JSP, some files are also written in Java Script. This software have aprox. 40 files --> 30 in JSP + 2 in Java Script + 8 image files .
    Each JSP calls another. and run this on 58 clints machine simultaneusly. we used Oracle 9iAS as back end and Oracle9iAS web Server . Where we found less clients like 20-30 we use Tomcat 5.0 web server .Sir problem is this we don't wan't to leave our jsp source code on server.
    Is any method or third party tool by which we can convert our JSP source file in CLASS file as like real class files provide by javac.
    For this perpose we make a folder and put all files in it. Create a context on Tomcat for this folder.Create a data source for this in tomcat. Bcase this program uses Data source and connect many times to database & fetches many type of data from database. We use servlet files of tomcat for this context in WORK folder of Tomcat. and after that rename our Source file Folder. and again run our program through batch file i'm strange program runs 2-3 steps, after few times it start producing errors.
    Sir do u hava work on this field can u help me to protect this JSP source code.
    I've Use Jikes.com compiler but not get any succes, It may be i'm not using correctly .
    Pls sir give me any suggesition.
    Chandra prakash

    1. Highlight your web project or the individual file
    2. Right click
    3. Select Rebuild to build all jsp files or Make to rebuilt only changed files

  • Can I include the FILE NAME when printing from Bridge?

    I'm a commercial photographer. I shoot with my camera tethered to a Mac laptop to view images immediately as I shoot. I use Bridge to view these images.
    As I shoot, we save the file by product name, and then print proofs immediately. I need to include the File Name on these prints. Is
    there a way for me to do this directly from Bridge? If not, can you think of a way using Photoshop? Or anything else? Lightroom?

    Guessing you are using Bridge CS4 you could use the Adobe Output module for
    this. It is reachable through a seperate workspace in the top menu right
    side or the left side top menu the icon most right.
    You can create different lay outs as a PDF with this but for you it should
    be one per page and select the filename (with or without extension). Just
    explore the posibilities. For CS4 you could use the updated Output Module.
    If on CS3 you could use the contact sheet script for Photoshop that in
    Bridge can be reached by the menu Tools / Photoshop / contactsheet. This
    contactsheet script is also usable for CS4, it is on the Goodies install
    disk for PSCS4
    As I shoot, we save the file by product name, and then print proofs
    immediately. I need to include the File Name on these prints. Is
    there a way for me to do this directly from Bridge? If not, can you think of a
    way using Photoshop? Or anything else? Lightroom?

  • Can I include raw files into the installer folder with LV application builder?

    Hello,
    I have created a batch file that will run at the end of the installer, which will copy over some raw configuration files into the source destination so that the configuration files can be customized for each end user without rebuilding the installer with application builder. I also have an autorun.inf so the installer will automatically run when the user installs the CD.  
    However I would like to have some default configuration files and an autorun.inf file that will be automatically added to the installer "volume" folder using the application builder. 
    However I don't see a way to include raw files in the "volume" folder. It appears all source files in the application builder are embedded into the binary files.
    Please let me know if this is possible with the current application builder.
    Regards,
    Russell
    Engineering Team Leader
    G Systems, www.gsystems.com
    Certified LabVIEW Architect
    Certified Professional Instructor

    Russel,
    i think this link might give you some good hints....
    hope this helps,
    Norbert 
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Storing files on the nano from a different computer.

    My nano is set to be used as 'disk use'. So does that mean I can store files onto my nano from other computers and open it up on another computer. And by files I dont necessarily mean music, but even documents. If so, is it limited to certain computers like windows xp.

    D.S.
    Yes, you can use it like an external hard drive. I
    believe that it will show up on all computers, but
    the files may not work. The reason being, your iPod
    is formatted as FAT-32 where as a Macintosh iPod is
    HFS+ (Mac Extended). My girlfriend can't purchase
    music on her computer, so I buy it on my computer and
    put it in her iPod. I am not a fan of her music so
    its fine with me, she can add those files to her
    library. You might want to look at Knowledge Base Document #61131. Since it is
    a Nano you don't really need to worry; for future
    reference, one can't transfer more then 4Gb because
    of the FAT-32 format.
    Jon
    I think that answers my question but you confused me with:
    The reason being, your iPod is formatted as FAT-32 where as a Macintosh iPod is HFS+ (Mac Extended).
    Are you saying my computer as in a windows pc or a mac b/c Im on windows. I just wanted to know if i could store extra files on my ipod. And if so, would they affect my existing music files or not.

  • Can I view another page from a different application in the same workspace?

    I'm a newbie and I've searched through the threads and can not find exactly what I'm looking for.
    I do not wish to copy a page from a different APP. What I want to do is create an application where on tab is actually a tab from a different App.
    Like this, I have SCHEDULED_TASKS application that has a calander that is updated weekly. I have another appliction that is used for our Database Testers to track testing on the database.
    I have a Tab in CAS_TESTING named TESTING_SCHEDULE. It is this tab that I want to have referance the SCHEDULED_TASKS Calender so testers can view the schedule for service packs.
    Is there a way that I can do this?
    Thanks,
    Mike Long
    Message was edited by:
    mikedlong

    Mike,
    In terms of the UI and tabs, you can use parent tabs (use a two-level tab page template). Or you could just put links in on app's pages that go to the other app using Lists, for example. In any of these links from one app to the other, you must include the session ID (&APP_SESSION.).
    If the application's are both public (no authentication required), you're done.
    If the apps require authentication, edit each app's authentication scheme and put some name in for cookie name (anything you like), using the same name in both apps. Depending on the authentication method, you then have to figure out who owns the login page, etc.
    That should do it.
    Scott

  • Including js files in a jsp?

    I'm sure this is a pretty stupid question, but it's one I've been having trouble with anyway.
    The big picture problem is trying to include jquery into my website. I've downloaded it and added it to a folder (/scripts/jquery-1.3.2.js)
    What I've tried to do to add it to my page is put, between </title> and </head>, <script src="/scripts/jquery-1.3.2.js" type="text/javascript"></script>.
    However, when I do this it seems to take everything else on the page (the </head> all the way to the </html>) and add it into the script tag somehow, leaving my page blank.
    Thanks for your time.

    It should work. The problem lies somewhere else.
    Maybe either the script is corrupt or your HTML is simply syntactically invalid.
    Investigate script source and the generated HTML output.

  • How to open a pdf file in Acrobat Reader from a webdynpro application

    Hi,
    I need to open a pdf file stored in the server from a web dynpro application. The pdf needs to be opened in the stand alone reader at the client and not in a reader embedded in the browser.
    Cheers,
    Krish

    Hello,
    I'm fairly new to webdynpro and am trying to  render a pdf via webdynpro.
    The webdynpro application runs but I see only a blank screen with the title.Is there any specific setting I need to do in order to view this pdf?I have used the FileDownload-UIElement.
    Thanks in advance
    Biraj

  • How can i add new files to my ipod from a different computer  without losing the added files on my ipod?

    how can i add new files to my ipod touch from a diferent computer without losing the added files already on my ipod?

    Email them? Use DropBox?  What type of files?

  • Execute Batch Files, DOS Commands etc. from my Java Application

    Can someone show me how it works?
    I dont need any return values, just execute a Batch File or a Command
    Thx, Guardian

    Hi Luke,
    Just wanna add 2 things to what you've written. (your sample code)
    Point 1pro.waitFor(); should be called before attempting the read anything from the process' InputStream if you don't want to lose anything your process might print out. When Runtime.getRuntime.exec("your_command") is executed, the resulting process is just another runaway thread unless you tell you calling thread to wait for this process to end before proceeding further. This is where waitFor() comes in.
    Point 2Runtime.getRuntime().exec("C:\\command.com /C mybat.bat"); works but it is pretty platform dependent. If you need to write platform independent stuff, you could just drop the command.com stuff and go right to the batch file or the command you need to execute. I've managed to just survive with Runtime.getRuntime().exec("mybat.bat");Regards,
    Noel

Maybe you are looking for

  • Read ONLY Permissions in Windows 2008 R2

    Is it possible for users to read only but cannot save a copy to another location?   Would like users to see  historic photos so they can request copies but they cannot "save as" a copy to any other location on the server or on their own computer.

  • Interacting with my development environment

    The basics of Java programming I understand. I've created the first phase of a large intranet app using JSPs, EJBs, etc. But now I need to create an automated daemon to spit out large batches of Excel files, the data for which is (or will be) stored

  • IPod not updating! HELP!

    I need help desparately! Whenever I plug in my iPod to update new songs that I have downloaded, iTunes shows that it is updating, but once iTunes shows that it has been updated and I disconnect my iPod, the new songs are not on the iPod! The songs ar

  • GRAB selection

    Is it possible to "grab" a section of a viewed page that is not on the screen? In other words when I bring up the grab cursor (shift/command/4) I am only able to grab data that is viewed. I cannot hold down the left click button and grab (scroll down

  • WAAS 4.1 - NME + VB

    I think an NME + 1 Windows 2008 Core Server VB is a good idea. Does anybody else think so? Would it be reasonable to expect Cisco to release such a product in not-too-distant-future?