Cannot include a staic file in a JSP

hi everybody,
i have a requeirement as follows.
i need to include a static html file in a JSP which IS NOT IN application server's jsp folder.
i tried specifying actual file path and server's absolute path.
not n use. can some body help me.
application server : iplanet.6 supporting jsp1.0

I hope you are using the file include.
i.e <%include file="C:\myfile" %>
<%@ include file="c:\myfile" %> ... Probably what you meant, but just clearing up any confusion.

Similar Messages

  • How to include a .class file in a jsp page

    hi everyone,
    i know the syntax as:
    <%@ include file = "filename.class" %>
    then at run time the server could not find the class file
    if i use,
    <%@ page import = "FileName.class" %>
    then also the same problem persists
    & if i use
    <jsp:include page = "Relative address"/>
    the problem still remains as it is...
    please help me out...i am working on developing an EJB application in which client interacts with server's Stateful session bean through a jsp page...it is necessary for me to include the home interface class file in my jsp page.
    P.S. do not suggest me to include the class file in a package & then use
    <%@ page import = "packageName.ClassFileName" %>
    i
    Edited by: Ankit_JIITU on 6 Jul, 2008 1:55 AM

    Ankit_JIITU wrote:
    i have already included the remote interface class file by <%@ page import = "University.RemoteInterfaceName" %>in my jsp page ...
    if i try to make a new package called test & then include my home interface in that package...i need to import University.*to generate the class file of my home interface ; but the class file generation is not taking place as i am getting the error..
    "package University does not exist".How can i overcome this problem. The package University, which you are trying to import, must be in the classpath. If you removed it then you will have to add it back.
    i have tried my best..but tell me if there's any possible way of including a class file in the jsp page without involving a package.No, there isn't.
    If not,then pls help me to generate the class file of my home interface within a package called test.Read the New To Java Tutorial and understand how packages work.
    >
    i am assuming that u have a deep knowledge of developing EJB applications.

  • How to include a js file in the JSP page

    Hi
    i have included a script tag like the following in the JSP file
    <SCRIPT language="JavaScript">vDateFormat='mm/dd/yyyy';</SCRIPT>
    while deploying i am getting an error 'vDateFormat' unidentified
    Can any one help me

    under view put a new tag
    <f:view>
    <ui:script url="page.js"/>
    and thats it

  • How I can include js (javascript) file in a jsp page?

    Hi,
    I�ve tried to include a js (javascript) file in jsp file but it doesn�t work.
    When I try to use a js function in the browser I always receive an error. Oh, of course, I�m including the correct tag <script src= ...
    What can I do? Does the problem in the WebServer?

    I cheated and put the scripts in another '.jsp' file and had no problem...then put an include b4 the closing 'head' tag, like this:
    <jsp:include page="scrpt.jsp" flush="true" />
    I had to do it this way for debugging using JDeveloper (it doesnt seem to like '.js' files). But when the jsp is on the server I used the following line instead:
    <script language='JavaScript' src='scrpt.js'></script>
    hope this helps.

  • Including static html file (WebServer)  with JSP (App server)?

    Hi,
    I want to know how can a static html file that runs on a Web Server (iPlanet) in a JSP that runs on an App Server (WebLogic 6.1).
    What would be the tag used and how the html file is referenced? Is there any other extra settings involved while integrating iPlanet with WebLogic 6.1?
    Responses are highly appreciated.
    Thanks and Regards,
    Madanlal.

    Web servers usually work with the MIME Types. In the mime type settings will determine how a request for a particular mime type is served. Usually HTML, JPG,GIF... are served by the web server itself. A JSP request will be forwarded to the APP Server for peocessing.
    The HTML and the image files need to be in a directory visible to the web server from the document root.
    See the files
    config\mime.types
    config\obj.conf
    under the web server installation directory.
    Refer to the web server's admin guide for more info.

  • I got this problem when i include one more file in my jsp within if conditi

    i got the following error
    The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP:
    Stacktrace:
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:142)
         org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:247)
         org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1123)
         org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:860)
         org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:774)
         org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:460)
         org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:425)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.23 logs.
    Please reply if any one can me help
    Thanks in advance

    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.23 logs.Did you read this note and lookup the root cause accordingly?

  • Valiable file name in JSP include

    Hi,
    I am trying to include a html file in a JSP page. The filename comes from the properties file and hence is a variable. The JSP file that has this include does not cache the JSP page plus it "refreshes" (reloads) ever 30 seconds.
    When I include the HTML file using jsp:include I am not getting the HTML file on alternate browser refreshes. Wierd?
    I then hard coded the filename and included the html file using <% @ include... and it works just fine.
    But I cannot have a variable name in <%@ include.
    Please comment on this wierd behaviour of jsp:include and gimme a solution.
    Thank you all in advance,
    Ravi Mittal

    Sorry this isn't a solution, because I have the very same problem and was just getting ready to post a question when I saw your post. I have also tried using:
    <jsp:include page="<%= myFilename %>" flush="true" />
    as well as
    <%@ include file="<%= myFilename %>" %>
    Neither of these work. This kind of approach seems to work just fine using <jsp:forward....>, but there's something funny about trying to include a file dynamically.
    I would also appreciate a solution. Good luck.
    - Joe

  • How to include a .js file into .jsp file.[.js file resides in a package]

    Hi,
    How do i include an external .js(JavaScript) file into a JSP file?My .js file is located in some package(lets say abc.jar). Below is my application structure:-
      jsp
       |
       ->MyJsp.jsp
      lib
       |
       |
    abc.jar
        |
        |
        ->com.abc.test
                     |
                     |
                     ->Test.java
                     ->abc.jsHow do i include "abc.js" file in "MyJsp.jsp" file?
    Please help.
    Thanks,
    Kiran
    Edited by: Adimulam on Jun 2, 2008 1:22 PM

    Even this is also not possible because, the code in that package is developed by DWR and i am just adding it to my lib folder and importing the respective classes. In the same manner i need to include the *.js* file in the JSP.It took me about 3 minutes reading through the [DWR Getting Started|http://getahead.org/dwr/getstarted] page to learn that you don't have to do any of that. Perhaps you should read that page?

  • Including different static files

    Hi,
    I want to include different static files in my jsp page. I mean for example, I have a parameter called "page" and I want to include it to my page.I tried the <%@ include file="" %> but I could not find a way to pass a variable to it. Also I tried to pageContext.include() but this time as the static page I include have JSP tags, it tries to compile it and beacuse it have some variables defined in the file that includes it, it fails.
    Any comments?
    thanks.

    Now I got your point.
    You cannot access scriptlet variables from pages included with <jsp:include. You can, however, pass some values with the <jsp:param action, as neville indicated.
    The only kind of variable you can re-use in an <jsp:include'd page are beans, if they are at least in request scope.
    For example, if in the parent page you have
    <jsp:useBean id="x" class="some.Class" scope="request"/> then, in the child page, you can obtain a reference to the same bean instance (which was created in the parent) by just using the same action:
    <jsp:useBean id="x" class="some.Class" scope="request"/> It is crucial that id and scope are exactly the same as in the parent's useBean action. You can make sure that a bean is re-used by adding code in the body of the useBean tag in the child page:
    <jsp:useBean ...as above... >
    <% // this code is executed only if a new bean has been created by this action
    out.println( "something wrong: has created new bean" );
    %>
    </jsp:useBean> So, summarizing, you cannot re-use scriptlet variables in included pages, but you can re-use beans.

  • Portlets Issues:-  Included resource or file  not found

    I am facing some problems in the loading of portlets with Weblogic 9.2.When I access the portal url all the portlets are displayed blank by giving the following error message on the server :
    <Error> <HTTP> <BEA-101214> <Included resource or file "/mysamples/exampleView.jsp" not found from requested resource "/portal/ep/home.do".>
    My application is using pluto portlet container,
    When I change the jsp file and reload portlet displays but after restarting the server it is again gone ,
    Can someone please provide some pointers on this , I will really appreciate the help .
    Thanks a lot
    -- Vandana

    has anyone got the solution I am getting the same error.
              mine is weblogic 6.1 in clustered env and when I am opening the browser and clicking on the link first time it is showing me no content in the pop up browser and I am getting the same error on the server as you people have got. help will be appreciated a lot as I am facing this in production env

  • How to include external .js file into .ear file using NetBean 5.5.1?

    is it possible to include external .js file into .ear file using NetBean 5.5.1? if not, then where should I placed the external .js file and how to write the src="xxx" element? (that is , how to write the path of "xxx"?)
    I am using JBOSS 4.2.2 GA as server
    thx!!

    Even this is also not possible because, the code in that package is developed by DWR and i am just adding it to my lib folder and importing the respective classes. In the same manner i need to include the *.js* file in the JSP.It took me about 3 minutes reading through the [DWR Getting Started|http://getahead.org/dwr/getstarted] page to learn that you don't have to do any of that. Perhaps you should read that page?

  • How to include a java-class in a JSP.

    I have the following code in a jsp:
    <jsp:include page = "http://test1.testing.com:81/TestClass" />
    I throws the following error:
    Servlet failed with Exception
    java.io.IOException: Nested 404 error
    If I copy paste the url (http://test1.testing.com:81/TestClass) directly on the browser address, it successfully runs the class.

    Copy the servlet class file in the servletclasses folder in the weblogic server then give the code like this
    <jsp:include page="servlet/servletclassfiles" flush="true" />
    this will include the class file to your jsp page
    what ever server better put the servlet class file in the servlet class invoking area

  • Include a CSS file problem

    I having a problem in including a css file in my jsp pages.
    the tag is written as follows
    <link rel="StyleSheet" type="text/css" href="ressources/stylesheet.css" media="screen"> I did change the directory ressource, the path and tried to play each and every time with this tag but it doesn't work. by the time I deploy my application, it tells me to download this css file or sometimes it tells me that the ressource is not available.
    I am using netbeans with Glassfish.

    Sorry for taking so long to answer but, it sounds that you didn't understand me.
    I have included the exact lin to the css file but it still have a problem. below is the code in the JSP page
    <%
    String CssUrl= (String)application.getAttribute("CssUrl");
    %>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <link rel="StyleSheet" type="text/css" href="<%=CssUrl%>/stylesheet.css" media="screen">
            <title>Login Utilisateur</title>
        </head>
    ...the CssUrl variable is defined in the web.xml file as the follwoing
    <init-param>
                <param-name>CssUrl</param-name>
                <param-value>/GestionBudget/resources/css</param-value>
            </init-param>Please can you explain to me why when I execute the page, I got no Css application and sometimes, I got the error page of the server that the css file as a resource doesn't exist.

  • Including an External File

    I have an external file that contains a declaration of an ActiveX object that I need to include in several JSP's. The external file resides on a separate web server from where our applications reside.
    I can't use the Include directive or the <jsp:include> tag because they only permit relative URL's. I also have read that I can use the <c:import> action tag provided in the JSTL, but we do not use JSTL currently and it would require additional time to add that code to our applications and test it.
    Is there any other way to include this external file in my JSP pages?
    Thanks
    Tony

    Thanks for the help. It hasn't been decided where the external file will reside, but it will probably be on our mainframe running WebSphere so I don't think the second option will work.
    We were hoping that we could just add 1 line of code to our pages to pull in the external file to simply the development process, but that doesn't look like it will work. We might have to create a second file that can be referenced with a relative URL, and have this file use one of the URL Connection classes to get the first file and write out its contents.
    Anyway, thanks for the tips!
    Tony

  • 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

Maybe you are looking for