How to include a static file which is outside Applicaton Context in JSF?

I need to inlcude lot of static contents which are residing in outside Application Context root in JSF.? is there any better way to do include static files which are outside the Context root?

The total no of static content files will be around 20000 to 30000 and i will only know the file name at run time from the user input.

Similar Messages

  • How to include a static file.... Please help..

    Hi guys..
    i am going crazy here, so please help.... is it possible to use <jsp:include page="headlines.html" flush="true"/> to serve a static file( headlines.html) which is in say tomcat_home\bin.. also, i wonder why the following code creates a headline file in the bin folder in the first place.. i thought, it should create headlines.html in the same folder as this class...i am a newbie as you can see...thanks in advance
    package beanpackage;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    import java.io.FileOutputStream;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.Transformer;
    import java.io.File;
    public class RSSProcessor {
    public RSSProcessor(){ }
    String _RSSFile;
    public String getRSSFile(){
    return _RSSFile;
    public void setRSSFile(String fileName){
    try {
    StreamSource source = new StreamSource(fileName);
    StreamSource finalStyle = new StreamSource("final.xsl");
    String outputURL = "headlines.html";
    StreamResult result = new StreamResult(new
    FileOutputStream(outputURL));
    TransformerFactory transFactory = TransformerFactory.newInstance();
    Transformer transformer = transFactory.newTransformer(finalStyle);
    transformer.transform(source, result);
    } catch (Exception e) {
    e.printStackTrace();
    }

    I am just about there thanks to you stibrian..
    as you know that i am using a bean and a jsp to transform the rss feed.. following your direction i used String filePath = getServletContext().getRealPath etc. in my JSP and i am getting my headlines.html in the ROOT folder every time i reload the JSP.. thats great ! but my <jsp:include page="headlines.html" flush="true"/> is still not working(i tried every possible combination).. is there any thing wrong? I will post my new code below and i hope that i would not bother you again (on this:-).. thanks a lot.. also, i will add some dukes to this question, as a thank you..
    package beanpackage;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    import java.io.FileOutputStream;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.Transformer;
    import java.io.File;
    import java.io.*;
    public class RSSProcessor {
    public RSSProcessor(){ }
    String _RSSFile;
    public String getRSSFile(){
    return _RSSFile;
    public void setRSSFile(String fileName, String outputURL){
    try {
    StreamSource source = new StreamSource(fileName);
    StreamSource finalStyle = new StreamSource("final.xsl");
    //String outputURL = getServletContext().getRealPath("WEB-INF" + File.separator + "headlines.html");
         //String outputURL = "headlines.html";
    StreamResult result = new StreamResult(new
    FileOutputStream(outputURL));
    TransformerFactory transFactory = TransformerFactory.newInstance();
    Transformer transformer = transFactory.newTransformer(finalStyle);
    transformer.transform(source, result);
    } catch (Exception e) {
    e.printStackTrace();
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <jsp:useBean id="rssBean" scope="request" class="beanpackage.RSSProcessor">
    <%@ page import="java.io.File"%>
    <%String outputURL = getServletContext().getRealPath(File.separator + "headlines.html");%>
    <%
    rssBean.setRSSFile("http://www.rediff.com/rss/inrss.xml", outputURL);
    %>
    </jsp:useBean>
    <html>
    <head>
    <title>Syndicated Feeds</title>
    </head>
    <body>
    <jsp:include page="headlines.html" flush="true"/>
    </body>
    </html>

  • How to create the SWF file which was included surrogate pairs.

    I would like to make sure how to create the SWF file which are included surrogate pairs.
    The error of outside the scope of unicode occurred when I compiled(mxmlc) the as file which was set surrogate pairs to 'Unicoderange'.
    Ex, I set the '  '(UTF-16 is '20B9F') to 'Unicoderange'.
    However, I cannot add the surrogate pairs.
    The error of outside the scope of Unicode occurred when I compiled the AS file.
    The reason of error was that the Unicode(UTF-16) of surrogate pairs is invalid.
    Then, I read the following pages.
    These pages are written that unicode-range supported surrogate pairs.
    http://livedocs.adobe.com/flex/3/html/help.html?content=fonts_07.html
    http://www.w3.org/TR/1998/REC-CSS2-19980512/fonts.html#descdef-unicode -range
    So please let me know how to create the SWF file which are included surrogate pairs.
    Environment
    - Flex3.5a
    - TTC: meiryo(ver6.02), msgothic(ver2.50), mspgothic(ver2.50)
    Thanks,
    Takeshi Ishihara.

    I've been able to create project jar files in Eclipse by selecting Export from the File menu, then choose Java - Jar file - and provide the required information, name, destination folder etc. But when I do this, I do not export other jars on the build path this way nor do I expect to do this. I am only concerned with creating a jar file of my own work. A jar file does not "contain" other jar files. If the jar file contains the main method, and requires other jars for it's execution, then you may wish to include a reference to required jars on the class path entry of the Manifest file of the jar file you create. I'm not sure how to create a Manifest file in eclipse though..

  • How to include assigned .as files in MXMLC ant task ?

    When i use mxmlc ant task, i found that
    the tag <include-sources/> doesn't support !
    ( described by http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7a63.html )
    neither SDK version 3.x nor 4.x
    Are they lying?!
    How to include assigned .as files ?
    Thank you !

    My understanding is that mxmlc will use all available resources in the source path, as needed. Instead of giving it individual resources to include, you simply need to give it the source-path that contains those resources. This is different from a library project, which may need to include individual classes that are never used in that library.

  • ANT how to include NetBeans Jar  files in my script of ANT ??

    ANT how to include NetBeans Jar files in my script of ANT ??

    I mean the library say swing layout ...
    which is SwingLayOuts1.0.jar ...
    in side this there is folder org.jDesktop....
    I want this folder in my jar file ...
    also ....
    My question ... i know the path of the jar file of NetBeans .... i can copy that ...dirctly ... but if m using Netbeans editor ... can i give NetBeans class to my jar command for ANT...........

  • 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.

  • How to compile a java file which is in memory?

    how to compile a java file which is in memory?
    such as:
    String s="class MyClass {....}";
    how to compile the string?
    thx

    come on ...That was a perfectly valid solution.
    Do you know how to call the sun.* compiler? If not then search the forums for it. If that interface still exists (which it might not in newer versions) you then will create a string stream from your class and pass it to that.

  • How to include a dynamic file

    Hi,
    The following syntax does not work:
    <%@ include file="htmls/mydocs/<%=dynamicFileName%>.htm" %>
    could you tell me how to include a dynamic file?
    thanks,
    peterzhu

    The include directive <%@ include ... does not work with dynamic file names, because it is evaluated at compile time.
    You have to use the include standard action <jsp:include page=... This is executed during runtime, and hence a dynamic file name can be used.

  • How can I send scanned files, which are documents changed from doc to PDF, as documents that can be edited if the recipient doesn't have Adobe capabilities?

    How can I send scanned files, which are documents changed from doc to PDF, as documents that can be edited if the recipient doesn't have Adobe capabilities?

    Hi flaviusjack,
    If you still have the .doc files, it might be best to send those to your recipients so they can be edited. Otherwise, you can use ExportPDF to convert the PDF files back to .doc format. But, again, that step would be unnecessary if you have the .doc files.
    Best,
    Sara

  • How to uninstall a war file which is deployed as library in console

    Hi All,
    How to uninstall a war file which is deployed as library in console.
    Thanks in advance

    You cant uninstall it........first stop it , then delete it and then activate the session.
    Hope this helps.
    Regards,
    Karan
    Oracle Fusion Middleware Blog

  • How do i remove a file which has attached to the outside of a window

    how do i remove a file which has attached itself to the out side of a windownext to the control tabs?

    Ah, do you mean it's showing in the header bar?
    If so, hold cmd (⌘) while you drag it off to the desktop. It'll disappear in a puff of virtual smoke.
    Don't worry, you won't lose the file; the icon in the header  (and those in the sidebar) is just an alias.

  • How can i make cotrol file which have conveyor and ?

    how can i make cotrol file which have conveyor " to move the bottle and slider " to fill the same bottle ?
    i attach my control file.............
    " Science is came....not come "
    I study Mechatronics Engineer
    skype : t_alhowaiti
    Attachments:
    convyer.ctl ‏16 KB

    Jeff·Þ·Bohrer wrote:
    billko wrote:
    ThaerAL-Hwaiti wrote:
    i want to make a production line which move a bottle on a conveyor and fill it .
    That's all good and fine, but what have you tried codewise?  Let's see what you have so far and we can go from there.
    The easy answer is "an assignment" and a desire to pass the course without actually needing to read and comprehend information.
    I as trying to be diplomatic about it. 
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • 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 jsp file in servlets and javabeans

    Hi to all..I have a jsp file which contains some database connections and I would like to include in that file in my servlets and javabeans.What coding can i use?Can show me sample coding.

    Hi to all..I have created a javabean storing the
    database connections. How do i include and call that
    bean in my servlet and javabeans?Can pls show me some
    sample coding?I am new to servlets and beans.The same way you do with normal Java Classes. If you are new to Java, I suggest you go to http://java.sun.com/docs/books/tutorial/index.html and look through the first couple of tutorials.
    As a note, it is best to put all your objects into packages, especially if you use JDK 1.4 or higher.

  • How to create a excel file which will open in every version of MS Office?

    For excel file handling we are using Measurement Studio 8.0 for VS .NET 2003. Now we are save the excel file into.xls file using this format "CNiExcelWorkbook::FileFormatExcel9795" . it will save the file. Now the problem is If that PC has MS Office 2003 or lesser version, then its working fine. But if the PC has MS Office 2007, it will giving problem. So my question is how to save  excel file which will support any version of MS Office?
    Tapasen 
    reply me @:  [email protected] or [email protected]

    In your code, write this:
    DATA my_path type string.
    GET PARAMETER ID 'ZPATH' FIELD my_path. "or any other name you choose
    double click on ZPATH, choose create. You will have created a new parameter. You can use any names starting with Z or Y.
    Go to SU01, and set this parameter there (ZPATH)..I hope this doesn't need further clarification.
    In parameter value, put the path to the file..
    After executing the GET statement, the value will be available in the variable my_path. Pass this to GUI_UPLOAD/DOWNLOAD functions, and it should work fine.
    Regards,
    SD

Maybe you are looking for

  • Hide in a design view

    hello!!!! I'm doing a web portal. In a layout i chose: "hide in design view". how can i show it again? ty

  • How can I send an SMS message to a group?

    I cannot seem to figure out how to add a second recipient to the SMS message. I routinely beep out messages to the 5 people I work with, I'd hate to send it out to each separately.

  • Why no HD TV content?

    I have just sampled the TNA HD wrestling on BT Vision.  Not my cup of tea but the picture quality is excellent and i was able to start watching within about a minute. So, my question is, why isn't any of the TV content HD?  I can see no reason if BT

  • Where to buy a Radeon X800 XT Fast????

    Does anyone know where I can order a X800 XT for my PowerMac G5? I need one ASAP! Any places ship over night? I have a project due in a week and my current 9600 XT isn't cutting it. Thank so much!

  • How do I enable php in OSX 10.9.3

    I downloaded webserver and have a apache and mysql and the site is working when i connect but only the html pages, the php pages dont work and i noticed the webserver says PHP is disbaled how do I enable the PHP?