How to change the filename in @include file?

I want to do a checking before deciding to include which file,
for example,
<%
if(isValid){
%>
<%@ include file="abc.jsp" %>
<%
else{ %>
<%@ include file="def.jsp" %>
<% } %>but the code above doesnt work in my JSPs
any idea how to solve this?
thanks
Desmond

Am i clear?? pls correct me if i am wrong..You are wrong.
The include directive is being used here, which is a compile time include, not a runtime include. Both includes will be performed before the resulting servlet is compiled.
If they have a conflict between them (either by not nesting them in their own { scope } or using <%! declarations %>) then the generated servlet will fail to compile.
So if you had the following:
abc.jsp:
Hello from ABC!
<% String myVar = "ABC"; %>def.jsp:
Hello from DEF!
<%  String myVar = "DEF";  %>And the page as mentioned in the original post, you would end up with a Servlet something like this:
if (isValid){
   out.println("Hello from ABC!");
    String myVar = "ABC";
else{
   out.println("Hello from DEF!");
  String myVar = "DEF";
}This example would compile because of the presence of the braces.
However removing the braces or using a <%! declaration %> would probably screw things up with a compile error.
The %Include directive is like a copy/paste into a JSP before you compile it.
The <jsp:include> is evaluated at runtime and copies in the result of executing the page.
The difference is quite subtle, but very important.
Cheers,
evnafets

Similar Messages

  • How to get the filename from J2SE File adapter

    In our project scenario , we are using J2EE and J2SE engine both .J2EE for mapping  and J2SE for Deliveying the message .
    In one senario, routing will be based on the filename .
    J2SE Sender File adapter --- XI Adapter --- XI pipe line
    So the File reaching to XI pipelane via J2SE File adapter--> XI adapter.
    When we are using the dynamic configurator in the XI to get the filename
    we are not able to get the file name  becasue it is coming to XI via
    XI adapter.
    How to get the filename ????Hope I am clear about the problem.

    hi,
    try this
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    //obtengo la Key del FileName
    DynamicConfigurationKey keyF = DynamicConfigurationKey.getName();
    http://help.sap.com/javadocs/NW04/current/pi/com/sap/aii/mapping/api/DynamicConfigurationKey.html
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70c89607-e4d9-2910-7280-f6746e964516
    /people/mohammed.zabiulla/blog/2008/03/26/have-you-ever-tried-to-determine-mail-cc-dynamically
    Hope it helps
    Thanks
    Rodrigo
    Edited by: Rodrigo Pertierra on Apr 11, 2008 9:31 AM

  • How to change the path of sysprep files that were copied to reference computer when i capture the image from reference.

    Dears ,,
    how to change the path that sysprep were copied to reference computer when i capture the image from reference.
    Should i modify some codes in LTIAPPLY.wsf? how to modify it?
    Thanks.

    Sysprep and capture has *Three* steps.
    1. Run sysprep on the local machine (easy).
    2. Copy WinPE down to the local machine so we can reboot into winpe for capture.
    3. Capture the drive in an *offline* state from within WinPE.
    What is most likely happening is that you are having problems with step #2. 100MB is *WAY* too small to copy down WinPE. By default MDT will make this System partition much bigger, 499MB. IF you install Windows 7 from the default media. IT will only create
    a 100MB partition.
    By default MDT 2012 Update 1 and greater *should* recover to a fallback drive with the OS on it, however if you are running older versions that might not happen correctly.
    If you are still having problems, copy your BDD.log file to a public share like OneDrive and copy the link here.
    Keith Garner - keithga.wordpress.com

  • How to change the path for a file download? Sometimes, I want to save a file in a specific folder in my hard disc and I don't know how to do it. Thanks.

    There is a default folder for the download of files from the internet ("Descargas" or "Downloads"). But, what can I do if I wish to save the file in another location of the hard disk?
    Thank you.

    Use about:config and filter on browser.download, you'll see them
    '''More information on configuration variables''' available in
    [http://kb.mozillazine.org/About:config_entries about:config (entries)] and for users not familiar with the process there is [http://kb.mozillazine.org/About:config about:config (How to change)]

  • How to change the size of redo file

    Deal all,
    I finish installed the db,and the size of redo file is 50m by default. I found many "checkpoint not complete" events in alert.log file.
    Now i want to change it to 100M and try to avoid the event appear again ,how can i do?

    As Sb has already correct reply that size of redo logs can not be changed. We have to create new bigger/smaller size of redo logs and then 'alter system switch logfile' to inactivate older logs. Now you can drop older logs. Redo logs are something a glass of water. We can not change the size of glass, if we wish to dring more/less water, we will take that sized glass and we will get that sized water.
    Remember to consider the multiplexing/grouping when doing any maintenance like this. And there may be archive log & backup space considerations.
    Hans @ http://dbaspot.com/oracle-server/33231-changing-redo-log-file-size.html
    Regards
    Girish Sharma

  • How to change the location of rendered files ?

    Hi guys,
    After finishing I was playing around & exploring the SHARE option.
    I did SHARE > MEDIA BROWSER then select Mac & PC. Then I click PUBLISH.
    What happened next was, FCPX starts rendering ! How come it did not prompt & ask me where I want the rendered files to be located at ?
    Upon seacrhing, I manage to locate it at EXTERNAL HARDDISK > FINAL CUT PROJECTS folder.
    How do I change the destination ?
    Thanks

    Tom Wolsky wrote:
    You can't. The Media Browser is a function of working with other applications. It must be in that location for the other applications to recognize it. You can always move or copy the files out of there when you're done. You might prefer Apple devices which has the same sharing options I believe.
    Thanks Tom,
    You are correct.
    For my pupose, I should have chosen Apple Devices instead.
    But I still don't understand what the option Media Bowser is for ? I mean why must other application recognize this file to work ? Can give example ?
    Thanks

  • How to change the resolution of a file?

    Hi, can someone please help me. I am working with illustrator CS and I am exporting a file as a jpeg. I need to print that file so when i export it i am changing the resolution to 150dpi. When i open the file in windows picture manager edit it and save the changes the file turns black and it prints a black page. This only happens when i change the resolution to 150dpi or higher if i leave it at 72dpi and make changes i don't have problems it will save fine. I have tried many different things but no luck. Hope someone here can help me. thank you.

    Sounds like an issue with your image editor. BTW if you plan on editing the image you should use a lossless format from Illustrator to the editor then save as a jpg. Each time you save the jpg more and more data gets thrown out until it unusable.

  • How to change the text in EPS file

    I purchased an image on iStockPhoto and the text is supposed to be changed but I dont know how. Everything is vectorized...Is somebody knows how I can change the text and keep the same font?
    Thanks

    You can't if it's been outlined / vectorised.

  • How to change the date of a file on mac

    I have a bunch of videos taken from a Sony digital camera around 2006 2007 that I took from my windows pc and copied to my Mac but they all read 2010 now, creation date and modified date ?
    How can I change these dates and which one do I change,? Thanks

    Peruse the hits from a google search for *change modification date mac*.

  • How to change the mode of a file dynamically?

    i want to delete a .class file which has been created dynamically...
    when i tried to delete it .. its prompt access denied message..

    guys i want to clear my question once again..
    i have created one java file dynamically..and after that i m compiling that new create java file..
    suppose i have created temp.java file and after compilation temp.class has been created ..
    after doing some operation i want to delete that temp.class file .. it has some access denied prob.
    again i m modifing temp.java file and once again i want to compile it.. but at second time no temp.class has created..
    ie. its not compiled.. as like earlier..
    here is my problem either i have to delete temp.class after some operation .. or once i will modified temp.java file it should compile..
    but second time its compiling..
    i have used Runtime.getruntime.exec("javac temp.java");

  • HT2493 How to change preview image of a file and NOT the icon ?

    Hello dear Mac users
    How to change preview image of a file and NOT the icon ?
    I know how to change the icon of a file, but I wish to know how to change the preview of any file.
    For example: my file is "mysong.aif", I changed the icon to be "mylogo.png" using cmd+i, cmd+v on the icon. But the preview of the file still remain the same.
    I know it can be changed using iTunes, but I don't want to import all my files in iTune, and iTune cannot import all type of files.
    I hope someone will understand my needs...
    Thanks!

    Thanks BeerbarX
    You can't change the preview image for anything
    hoo
    QuickLook plugin
    what are the plugin ?
    In the case of a music file, it will be that generic black box with a note on it
    That is exactly what I'm asking about !
    MP3 which has a special tagging standard that can include artwork
    How can I "tag" my MP3 without going thru iTunes ? Is it possible to do it dirrectly in the Finder ? Is there other type of files that can include such tags ?
    Thank you for answering my question , wich I have to admit may seem useless, but I wish I could put something like a signature logo on each of the different file I produce (as AIF for music and MP4 for video clip) instead of that generic black box with a note on it, and by the meantime keeping a different icon for all of them in order to illustrate theire content.

  • Changing the src of include tag using selectonemenu with ajax

    tell me how to change the source of include tag so that it will show a new page as my select one menu changes..
    and also i don,t want to reload the whole page so i want to use Ajax in that so if anyone have some
    idea how to do it please post......

    Help me!

  • How to change the output executable file name(a.prj:(output)--- b.exe)

    LabWindows / CVI: how to change the output executable file name
                For example, I have an A project a.prj, I do not want to compile the output file is a.exe, but b.exe.
    I will try to save as a.prj b.prj, a.cws save as b.cws
    eg:a.prj  ---->(output)--->b.exe
    Solved!
    Go to Solution.

    You can go to Build >> Target Settings menu item, select Release (or Release 64) in the Configuration filed and set the name of the executable to create in Application FIle field, withouyt need to change the prj or cws filename.
    See the complete description of available options here.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How to change the default "Safe" files in Safari?

    I would really appreciate if anybody could teach me how to change the default "Safe" files using AppleScripts, Folder Actions or .plist files. I really would like to have some files to open automatically after download, specially .pps files, and safari doesn't recognize such files as "safe". I tried to find out reading the help files but got lost.
    I posted a reply in an old topic for somebody who seemed to know, but it was not related to that topic, so I decided to open a new one.
    I'll be gratefull for any help. Thanks.

    Hi MDRC,
    Have a read of [this topic|http://discussions.apple.com/thread.jspa?threadID=1237961] to see if that helps.

  • How to change the default password file's name and path when the database created?

    how to change the default password file's name and path when the database created?
    null

    Usage: orapwd file=<fname> password=<password> entries=<users>
    where
    file - name of password file (mand),
    password - password for SYS and INTERNAL (mand),
    entries - maximum number of distinct DBA and OPERs (opt),
    There are no spaces around the equal-to (=) character.

Maybe you are looking for