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.

Similar Messages

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

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

  • Including different datasets from a file?

    I have (for the sake of argument) 2 illustrator files. One contains some vector drawings with multiple layers. I'd like to use two "versions" of that file so I'm using variables and datasets to toggle some layers and change some textfields. Now, in the other file, I'd like to link (place) to these two versions. When placing external files you can choose between several options, for example which artboard you'd like to include from a certain file, but I can't find an option for choosing which dataset (from the to be included file) I'd like to use?!? It seems to be using the one which was "active" while saving the file.
    So, is it possible to include an illustrator file with a particular dataset and then the same file once more with a different dataset? And if so, how? It seems a bit redundant to duplicate the original file (with the 2 datasets) so it can be included in another one... for every change in a layer for example I would have to save the file twice? (Or more if I had more datasets)
    Thanks,
    Jersebas

    It seems to be using the one which was "active" while saving the file.
    Yupp. Data sets are only evaluated inside the document referencing them. Short of updating the file to be embedded with a script or building the variables in the main doc, I see no realistic way to handle this easily. This sounds more like a case for InDesign in the first place...
    Mylenium

  • Sun Studio cc includes unused static inline functions in object file

    While trying to compile some code originally compiled with GCC I run into a linking problem. My problem seems to be caused by that GCC does not include unused static inline functions in the object files while cc does. The following simple example can be used for illustrating this:
    void foo();
    static inline void bar()
      foo();
    int main()
    }This program compiles and links without any problems using GCC and Sun Studio 12 CC (the C++ compiler) but fails to link using Sun Studio 12 cc:
    khepri%> cc staticinline.c
    Undefined first referenced
    symbol in file
    foo staticinline.o
    ld: fatal: Symbol referencing errors. No output written to a.out
    It is probably fine of cc to include foo() in the object file (although not necessary?). My questions are:
    1. Are there any reasons for why cc includes unused static inline functions in the object file while CC does not?
    2. Are there any ways or options to tell cc to not include unused static inline functions in the object file?
    In the example above this is easy to fix by just removing or #ifdef away the code but the original code where I have this problem is not maintained by me and the static inline functions are in header files that get included in multiple C files and in some of these the functions are used.
    Thanks,
    Olav

    olavsa wrote:
    1. Are there any reasons for why cc includes unused static inline functions in the object file while CC does not?
    2. Are there any ways or options to tell cc to not include unused static inline functions in the object file?Removing dead code is an optimization, so you need at least -xO1 for that.

  • Apex 4 static files names include file path

    Hello,
    I am using Apex 4 with the latest patch.
    When I go into Shared Components and upload Static Files or CSS it is including the full file path as the name of the file when it is uploaded. Apex 3 did not do this, it simply used the file name.
    For example, if I want to upload a file called "mystyles.css" and it is located in "C:\css\app1\work" the file when uploaded will be called: C:\css\app1\work\mystyles.css
    When I want to reference this file in Apex code I need to call it C:\css\app1\work\mystyles.css instead of just mystyles.css.
    Is there a way to make it use only the file name and not the file path?

    Which browser and version are you using?
    If it's IE, check the config for “Include local directory path when uploading files” security settings.
    {message:id=4169405}
    http://blogs.msdn.com/ie/archive/2009/03/20/rtm-platform-changes.aspx

  • How can I specify a different css file for mobile browsers?

    I'm experimenting with updating our website to be "mobile friendly". I could use some help.
    We use a lot of static HTML landing pages for things like links from email ads, etc. What I'm trying to do is have 1 landing page so the content/html page is always the same, but the page will detect what browser/device you are using and then load a different css file depending on what it is. But, we don't want to have to load the style info from the PC version if you're not on a PC.
    What I'm doing now is specifying the media type in the css link, like this..
    <link rel="stylesheet" href="style.css" type="text/css">
    <link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="mobile.css" type="text/css">
    What's happening is it's loading the main stylesheet first, and then the 2nd one changes some styles if you're on a device with a max width of 480 pixels (like an iPhone). But since it's loading the PC styles first, it's making some things look screwy.
    So, is there a way to say "If you're on a PC, load this stylesheet. If you're on an iPhone, load this one instead." .. without javascript? I don't trust javascript too much on mobile devices. I feel like this some simple little thing that I'm missing that will make it all automagically work.
    We don't want to have different content depending on the browser, just different stylesheets. Can anyone help?

    Hi
    Would it be better to do 2 different stylesheets, or just one big one and add a section at the bottom like:
    @media only screen and (max-device-width: 480px) {   .styles {whatever: styles;} }
    2 separate style sheets are recommended. The reason for this is that the Safari mobile browser, (as used in iPhone etc) will download any/all images specified in a style sheet even if they are not used or specified in a media-query rule, this is a know bug with that browser.
    I'm also having a new issue where the style "clear: both;" doesn't seem
    to be working right. I set up my top horizontal menu using float: left,
    and there's a lot of links so on the smaller screen it wraps, which is
    fine but now the wrapped links are floating over the page content...
    This is one of the reasons that floats should not be used in style sheets for mobile devices, the only exception I know of is for small typographical feature such as 'pull-quotes', (and never use float: right;). It is also recommended to include a menu at the bottom of the page, (or at least a link back to the top).
    It works, if I have the iPhone as portrait it looks great, but if I turn
    it to landscape, everything is zoomed in. But if I switch back to
    portrait, everything is the right size. Is there any kind of way to get
    the landscape to have the normal zoom level? I know I can do
    "initial-scale=1.0", but that is just for when the page loads, not if
    you change it afterwards...
    I have heard of only one recommendation to fix this and that is a page refresh on resize, but due to bandwidth limits now being implemented by many providers it is probably not a good idea, you could try setting -
    maximum-scale = 1.0
    as well.
    PZ

  • How can I use the same object in the different jsp files?

    I am doing a project. I have finished my jave source files and compiled them successfully. And I also wrote a main method to test my classes, they also worked well. Now I am trying to use my jave code in the jsp files. But I meet a problem, in my method of java source file, I can generate a object of a class, and use it in the whole main method. But in the different jsp files, how can I do same thing?
    For example, in the .java file,
    Vector vl = new Vector();
    While ...{
    vl.add(...)
    In each of my .jsp file I want to do one loop of the above, meanwhile I want to do that in the same object.
    I hope you can understand what I mean. Really need your help!

    put your object into a session and you can the use it in all the jsps as long as the session is valid. Or you could create a static variable in the class that only creates one instance off an object and then create a static method to return this object.

  • I have a Windows 7 laptop using I tunes 64 and all my music files are on an external disc. I rarely use I tunes and at one point moved all my files (including the music files) from one external disc to another without considering what affect this wou

    I have a Windows 7 laptop using I tunes 64 and all my music files are
    on an external disc. I rarely use I tunes and at one point moved all my files
    (including the music files) from one external disc to another without
    considering what affect this would have on the I tunes library. When I eventually
    attempted to use I tunes, every selected a song from the library resulted in a
    message stating that the file couldn't be located. After following some of the procedures
    explained in this community I was able to reconnect the library back to where
    the associated music files are presently stored. However, there are still 2
    problems that need to be corrected. 1) Every song file now has a duplicate. One
    file works and the other file will result in the same message stating that the
    file couldn't be located. Before there were 4,000 songs in the library, now
    there are 8,000 songs. I need to eliminate the 4,000 dead song files. 2) All
    the playlists are still associated with the dead song files which makes the
    playlists unusable. Can the playlists be reconnected to the usable files
    without manually having to recreate them? Thanks in advance for the help.
    sdkr

    So am I understanding correctly?
    You used your iPod as a hard drive (drag and drop) instead of having iTunes install the music?
    If you used drag and drop your choices are different than if you used iTunes to transfer.
    Good luck!

  • LV2012 Web Services w/ NI Auth login not working w/ static files in Firefox 19

    Hi!
    I followed this procedure to password protect my web service and the static files. 
    http://digital.ni.com/public.nsf/allkb/DF41D5DA8EEB4840862577D90058C208
    When testing it out with my web service it seems to work fine on any web browser.  http://localhost:8080/add/add/1/2 first will present a login.  Once the user is logged in the page refreshes and the results of the operation are shown.  http://localhost:8080/logout works as well.
    I followed the procedure in the FAQ to include an index.html file.
    http://www.ni.com/white-paper/7747/en#toc15
    When I try to access the page (via http:localhost:8080/add/web/index.html) I'm greeted with the National Instruments login screen.  I enter my credentials and in Chrome and Internet Explorer the screen refreshes and I see my html file.  In Firefox it hangs for awhile on the authentication screen and then reloads back to the authenticaiton screen (as if the username and password did not take).
    Attached are my files.  If you want to try and recreate this please follow this procedure:
    * Unzip the attached project to a folder
    * Open the project in LabVIEW 2012
    * Check the properties of the web service to ensure that the build paths are correct
    * Follow the procedure above for setting up NI Auth on your web service and adding the "testpermission2" permission.  Be sure to remove "Everyone" from that "testpermission2" or you will never see a login prompt.
    * Build/Deploy the web service
    * open http://localhost:8080/logout to ensure that you are not currently authenticated
    * open http://localhost:8080/add/add/1/2 and login, observe behavior
    * open http://localhost:8080/add/web/index.html you should still be logged in so you will see the "Hello World!" just fine
    * open http://localhost:8080/logout to log back out
    * open http://localhost:8080/add/web/index.html and see if you are able to login.
    I've tried disabelling my plugins in Firefox and still have this problem.  I'm really scratching my head on how to overcome this other than throwing away NI Auth and use something else.  My web service is going to run off of a static front end driven by javascript and html.  So the access point will be the html file.  I need to have some username and password scheme worked out.  I also need to be able to see what user is currently logged in with my Web Service VIs (does anyone know if that is possible with NI Auth)? 
    The other BIG issue I have with NI Auth is that it requires Silverlight.  So much for mobile support, eh?  Anyone know of a good plug-and-play alternative so I don't have to reinvent the wheel?  I guess I could impliment some kind of token system on my web service side.
    In the meantime, getting NI Auth to properly work with Firefox would help.
    Thanks for your input,
    -Nic
    Attachments:
    Example Web Service.zip ‏15 KB

    Disclaimer: I in no way mean to bash NI and I have used NI Auth myself in the past
    If you are going to go to the trouble of abstracting NI Auth, I would recommend instead investing your time in your own authentication scheme (or implementing a standard scheme in LV).
    NI Auth is great and works for low security applications where you just don't want people fooling around with your application who shouldn't be.
    However, NI Auth is really not that secure.  If I remember correctly, the username is transmitted in plain text and I don't think the encryption algorithm is that sophisticated.  It is nice that it's already integrated into LV, but there really are very few features at this time.
    If you want something to be really secure, you need to take measures beyond what NI Auth provides and before you go to the work of building abstraction on top of a basic and somewhat shaky protocol, I'd seriously consider implementing a more stable base.
    <insert 2 cents complete>
    Chris
    Certified LabVIEW Architect
    Certified TestStand Architect

  • APEX 3.1.2 Static File Upload Issues

    We are still running on APEX 3.1.2 though we hope to go to 4 very soon.
    We had a production problem this past week that is perplexing. I have seen other posts referencing similar issues but no solutions.
    We have an application that has several Static File Javascripts (.js). We already ran into the IE Upload bug so we only upload in Mozilla now.
    We had changes to one of the .js files (identity.js). I deleted the old file using the Shared Components screen and uploaded the new one. The action was "Successful" but the file was still the old version. We deleted a file of 73 lines of code and uploaded a new version of 28 lines. After successful upload, we still would get the 73 line version . The app was still getting that version too.
    I deleted it many times and tried again. I ran scripts to do both the delete and upload. I even deleted the file manually from the FLOWS_FILES table that held it. Still got the old version.
    We bounced the server (thinking it was cached somewhere) - still got the old version. Finally, in desperation, I started cloning the app to another app number in another Workspace. Since we use aliases, I thought I could use a clean Workspace and uplad the new file there. This worked but - suddenly the old Workspace started using the correct file.
    Is ther some secret cache somewhere that needs to be cleared out? I did not want to start randomly clearing out caches and there is no documentation on this issue.
    Is it something about our config - we have Oracle HTTP Server, OC4J, and modplsql for this environment with a 10g database.
    Any insight would be appreciated - my manager does not like "it fixed itself magically".

    We ruled out the browser caching by trying the app on several other people's PCs.
    I am thinking it is being cached somewhere in the APEX server environment but cannot find any documentation on where or what that might be.
    I think I might have triggered a refresh when I was trying to implement a cloned version (in a different Workspace). It seems that the scope of a JS file is within its Workspace so we figured that a new Workspace would treat the changed file as a new file - and it did. During this process, we had duplicate ALIAS for a minute and I think that confused the APEX App Engine and triggered the refresh.
    But that is a SWAG opinion.
    I also thought of "versioning" the JS files but our developers are not too keen. If we don't find another solution, that may be what we have to do.

  • Access a component in an mxml file from a different mxml file

    Hi,
    I want to access a component in an mxml file 1 such as this one  <mx:Image id="img" width="101" height="200" source="{product.image}"/> using the
    id
    from the actionscript function from a different mxml file 2
    public function init():void
           HERE.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );    
    so i can make it dragable, Please help me  in this if u can urgently!!!!

    okay,
    I have the image component in ProductCatalogThumbnail.mxml, which has an id of "img"
    so, i created a public variable in the file and a public function that returns the value of the object.
    public var imagecopy:Object;
            [Bindable]
             public function imagecopyfunction():Object{
             imagecopy  = img;
             return imagecopy;
    now, I want to access this image in the mxml file ProductList.mxml in a function
      public function init():void
          ProductCatalogThumbnail.imagecopy.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
         // accepting a drag/drop operation...
           this.area.addEventListener( DragEvent.DRAG_ENTER, acceptDrop );
           // handling the drop...
          //this.area.addEventListener( DragEvent.DRAG_DROP, handleDrop );
    I tried to use the variable, and then i tried to use the function:
    I got this error when I tried the variable : 1119: Access of possibly undefined property imagecopy through a reference with static type Class.
    ProductCatalogThumbnail.imagecopy.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
    and this error when i tried the function:  1061: Call to a possibly undefined method imagecopyfunction through a reference with static type Class.
    ProductCatalogThumbnail.imagecopyfunction().addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
    i made sure i imported ProductCatalogThumbnail file in the beginning of my application.
    I am not sure what went wrong.

  • How to Clear Cache for an Old Static File in Shared Components

    Hello,
    I am using Apex 4.1.1.00.23, HTTP Server with mod_plsql, and Oracle Database 10.2.0.5.0.
    My situation is as follow:
    I have a CSS static file in the shared components that is used in different applications. I recently modified the CSS file, but the changes are not reflected in my applications.
    I tried clearing the cache of my browsers, deleting the file from shared components and creating a new one with the same name, and nothing is working.
    Using Firebug, I can see that the file used in my pages is the old version of it. Anyone can tell me if the server is caching the file and how can I clear it?
    Thank you for your help,
    Erick

    What kind of document is it (e.g. is this a parsed
    HTML file, or a static file)? have you adjusted your
    cache settings with the nsfc.conf file? have you
    enabled the nsfc report? Are the files stored on NFS
    volumes?
    Regardless, you can force the cache to be flushed by
    enabling the nsfc report, and then accessing the URI
    like so:
    /nsfc?restart
    See the Performance and Tuning Guide:
    http://docs.sun.com/source/817-1836-10/perftune.html#w
    p17232I tried to to do this. Did n't worked. /nsfc?restart is not working for me. I have IPlanet 6.1 Webserver version. Without having any backend server running, I am getting JSPs displayed from cache!! Please help me out.

  • How to include different Character Sets in Flex AIR project

    Hi All,
    Flex, AIR(Desktop) Project.
    PROBLEM Scenario:
    My Application needs a path from Windows registry, So I am launching a .cmd file using Native Process API.
    As a result I get a text file with the path.
    So, everything works fine(reading/writing), but if the path contains different languages like Korean, Chinese then the READING OPERATION IS FAILED only when I install the application. It works fine while debugging.
    (By failing I mean its not getting the characters, its printing some junk values.)
    I am using readMultibyte & writeMultibyte APIs, and I am assiging the character set dynamically as per the OS language. (Which is Enslish in current scenario)
    FINDING:
    I installed Windows with Korean Language on a system, so now if I build the .exe on this machine then it works fine. So, i guess its not able to get the Korean Character set from the English OS, thats why it failed in earlier case.
    Is there any way to include different character sets in a Flex project?
    Regards,
    Mayank

    Some loaded SWFs may not be compatible with Flex.  Try making a simpler SWF (like one that just draws a circle where you click) and see if it can be loaded and interacted with.
    -Alex

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

Maybe you are looking for

  • Passing values as parameters to an applet

    I would like to pass some parameters from a HTML page to an applet. I want to know which would be better in passing the values to the applet. Will java script, php, or applet be better. The HTML page has some list boxes, text field and i want to pass

  • Empty Library

    I just installed iTunes on my friends computer. (windows xp) The iTunes is completely blank, freshly installed. However, her iPod was being used on a different computer. She now wants to use this computer for her itunes. Is there a way to transfer th

  • Scrolling with mouse wheel in column browser starts from the start of the list

    Hi, I'm wondering if anyone else has been encountering this problem with iTunes. Ever since updating to 10.5, whenever I use the mouse wheel to scroll in the column browser, it starts from the start of the list, regardless of which artist or album is

  • Hide the columns header

    Hi all, i just want to hide the the row that is a columns header, that is just above the numbers in the result area. The point is it's autoformated, it's just a normal row and that's all, but i need to make like twice bigger and of other color. How c

  • Class-map || High Router utilization

    Hi Team ,  Good day!!! I have one very basic question regarding the class- map. We have implemented QOS by defining some set of classes with the percentage of bandwidth in each class. now a days i could see lot of routers in the organization i work f