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

Similar Messages

  • Retrieving file name from jsp

    I have an input field on my jsp. The input type is "File".
    I am trying to get the contents of that field and the filename and/or file path that is included in that field.
    Does anyone know how to do this?
    I tried a request.getParameter in the servlet but this field is not a text field.
    Thanks.

    Check out the Apache FileUpload package:
    http://jakarta.apache.org/commons/fileupload/
    It has the methods you'll need to get the file name and file contents.

  • File Name from JSP not shown although attached

    Hi all,
    I have written a JSP to attach files. The file is attached and I can see the file size , but for some reason the file name does not show up. Any reason why?
    My code in the JSP to attach files is:-
    <td><input id="attachment" type="file" <f:fieldName att="fileHolder.fileHolders.file"/> value="" ></td>
    I have a JSP to attach a file and then a BPM presentation to show that file.
    Is that a problem?
    Do we need JSPs only?
    The file size is also not a problem because the max. file size in studio is 5MB and I am running this code in studio and attaching files less than 5MB.
    I have just copy pasted the JSP found at this location
    http://www.4shared.com/get/wuHzQ0fj/FileChooserDemo.html
    into my process?
    It works in Dan's process but not in my process?
    Why is that so?
    How can I get the name of the file attached in my process?
    Edited by: user8766631 on Jun 20, 2011 4:49 PM
    Edited by: user8766631 on Jun 20, 2011 5:23 PM

    Finally resolved the error..
    It seems that file_filename is a KEYWORD and cannot be changed..
    so the two attributes in the object should be of exact name to make sure your file is attached with the right file name.
    1) file
    2) file_filename
    If we write fileName instead of file_filename, it will not work.
    Where is the documentation on this?
    Oracle BPM documentation really is bad.. They need to improve their documentation.

  • Repeating parameter names in jsp:include

    Hi,
    I have this jsp code fragment:
    <div>
    <jsp:include page="fragment_1.jsp">
    <jsp:param name="param" value="hello world!"/>
    </jsp:include>
    <jsp:include page="fragment_2.jsp">
    <jsp:param name="param" value="good morning!"/>
    </jsp:include>
    </div>
    When this code executes, the value for param, as the fragment_2 is included, is "hello world!" and not "good morning!".
    How can I use the same name for a param in fragment_2 ?
    Pietro

    The problem is that nothing in the servlet specifications prohibits a requests from having more that one parameter with the same name. It looks that when you set a parameter with the jsp:param tag that it is appending another parameter with that name.

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

  • Including JSP fragment file in a JSP

    Hi, there,
    I'm trying to include a fragment JSP file (with an extension .jspf as suggested by JSP1.2 spec) in a JSP file as follows:
    <jsp:include page="/header.jspf"/>
    But it looks like OC4J thinks it is a static file and thus all JSP tags are ignored. I have to change the file extension from "jspf" to "jsp" to make it work.
    Same thing happens with the RequestDispatcher.include method.
    Is there a way to handle this in OC4J such as adding a servlet mapping?
    Thanks.
    Li

    You might consider using an include directive instead of an include action. The "jsp:include" element is the include action. This executes at "run time" as an internal forward from the servlet container. However, an include directive executes at servlet generation time (compile time).
    So, instead of doing "jsp:include", you would do the following:
    <%@ include file="/stuff.jspf" %>
    This should allow your JSP fragment to be compiled into the servlet it is being included from.

  • Jsp:include does not work in 8.1 SP3?

    Hi all,
              I need to include a local file (external to the app) in jsp code. The external file includes an image map which changes very so often. So in order to avoid doing a build everytime, I thought about keeping the image map in a file which can be "included" in the jsp file, making it very dynamic to a change.
              So I have a servlet which will read this file and output the contents to response.getWriter(), which will be included in calling jsp code.
              But the jsp file does not seem to call the servlet at all.
              Here is the code in the jsp file:
              <%
              String sFileUrl = "/Prj/RenderReport?file=OrgChart.html";
              %>
              <jsp:include page="<%=sFileUrl%>" />
              What am I doing wrong? Is this not possible at all?
              Thank you all in advance.

    hi pjoshi,
              <jsp:include page="hello.jsp" /> tag is working fine in weblogic 8.1 sp3.
              I think it might be syntax error in your jsp page.
              This is the syntax to including dynamic files in jsp using <jsp:include page="" />tag as given below.
              <jsp:include page="{relativeURL | <%= expression %>}" flush="true" />
              go through the below link and you will find exact information how to include dynamic files in jsp using <jsp:include page=""/>
              http://java.sun.com/products/jsp/syntax/1.1/syntaxref1112.html
              --Anilkumar kari                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • File name in file adapter

    Hello Guys,
    I need to get a message from RFC, map it in a way that I wouldn't need to do any file conversions in file adapter and send it to FTP. How could I set the file name in this case?
    PS: the file name cannot be included in payload, while I don't want to do any conversations of that payload...
    Many thanks for your answers,
    Milan

    Hi Milan,
    Is your query related to  sending the file name from the source xml document to the reciever file adapter. If so this can be achieved.
    Pls. do the following.
    1.  in the mapping program that you are using populate the filename coming from the source into the target in any of the fileds.
    2.Sender adapters can write adapter-specific attributes to the message header; these can then be evaluated at configuration time
    3. To change the adapter-specific attributes of the message header by using message mappings, you access the required classes of the mapping API by using a mapping runtime constant.
    To access the classes DynamicConfiguration and DynamicConfigurationKey by using the mapping runtime constant DYNAMIC_CONFIGURATION, use the method getTransformationParameters() of the container object.
    Create an simple user defined function in the mapping and use the following code.
    Imports: com.sap.aii.mapping.api.*;
    Parameter: String filename
    Paramter: String filename;
    filename = fileName + ".DAT";
    DynamicConfiguration conf = (DynamicConfiguration) container
           .getTransformationParameters()
           .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "FileName");
    conf.put(key, filename);
    return filename;
    You donot need to hard code the value of the filename in the file adapter for your interface.
    In SXMB_MONI, when you see the pipeline services you would see that the value of the filename is populated in the message payload.
    Thanks
    Indranil

  • RFFOUS_T ACH DME - file name with NN=sequential # : ACHPMMDDYYNN

    We are using RFFOUS_T to generate the data medium for ACH.
    The program defaults the filename to ACH as follows (include RFFORIU4).
    (because of TemSe), a new name is generated here: ACH.Date.Time.nn
      if hlp_temse na par_dtyp and         "No TemSe-file            AND
         par_unix eq space.                "name not specified yet
        par_unix    = hlp_dtfor.
        par_unix+3  = '.'.
        write sy-datlo to par_unix+4(6) ddmmyy.
        par_unix+10 = '.'.
        par_unix+11 = sy-timlo.
        par_unix+17 = '.'.
      endif.                               "IF HLP_TEMSE NA ...
      cnt_filenr = 0.
    However, we like the filename to be ACHPMMDDYYnn.
    Does anyone know of any BTE or user exit to overwrite the default naming convention as above?
    Thanks
    Cheryl

    Hello-
    We had the same situation. Below are the steps we followed:
    1. We copied the program RFFOUS_T into our own zversion.
    2. In the variant for the program, we used for the field "Output medium for DME" = "1" save to network.
    3. Given the path under file name which also included our preceding name (example ACH) for the file and then used the concept of using year, month, date and time everytime a file is generated and will be created on the network. For example a file created on 02/11/2011 @10.02.30 will be ACH20110211100230.TXT and this way this fill will also have a unique name. This coding will be done in the copy program.
    4. We also had a requirement to send payment advices via email and print , we have used BTE (transaction FIBF) 002040 modified the function module attached to the BTE by copying it into a zversion.
    It worked perfect.
    Hope this helps.
    Shail

  • How do I customizing the download pop up window file name?

    I have a site that streams a PDF. The file name is not included in the URL. When I set my options to Save As for Adobe I am presented with the Download pop up box, but there is no extension in the box so when I double click the item it asks what file to open it with. So my question is, is it possible to be able to customize the name of the file being saved rather then letting the browser determine the name based on the URL?

    A good solution, but I went one better -  I got rid of the HP Printer and bough an Epson.
    The problem no longer exists.

  • How do I remove the file name extension form a 'file name' cross reference?

    I have a cross reference which is refeencing another InDesign file using the cross reference format 'file name', however it includes the file extension. Is there a way to have this extension not display? Maybe a delimiter or perhaps a differnt format.

    finding the position of the '/'instr() could do, -1 to start counting from the end of the string, then substr() to start with the next character after the instr() value ...
    select substr( 'F1903848613/my_test_file.txt', instr( 'F1903848613/my_test_file.txt','/',-1)+1) from dual;

  • Calling custom tags in jsp  with jsp:include

    Hi,
    I have a large jsp file , which uses jstl fmt tags for labels.
    Since the size of jsp was too big iand i was unable to compile it because of 64 kb class size limit,
    I removed the tag lib defination from the jsp file and put it in another jsp file. and used jsp:include to include this file inside the first jsp.
    It is compiling successfully but labels r not showing up.
    but when i use <%@include to include second jsp in the first one i get the labels properly.
    I cannot use <%@include as this starts giving me compilation error related with jsp class file size beyond 64 kb.
    Pls suggest why jsp:include is not working.
    thanks,
    Pramod

    Hi Anil,
    Ur suggestion was good but could not solve my problem.
    I have put a small sample code to illustrate the problem.
    labeldemo.jsp:
    <%-- <%@ include file="WDCComInitLabelsjunk.jsp" %> --%>
    <jsp:include page="WDCComInitLabelsjunk.jsp" flush="true" />
    <table width="100%" cellpadding="3" cellspacing="0" border="0" class="tablebg">
                                  <tr class="headtd">
                                       <td colspan="4"><span class="headtext"><fmt:message key="Cash_Management"/> </td>
                                  </tr>
                                  <tr> hi </tr>
                             </table>
                             </fmt:bundle>
    WDCComInitLabelsjunk.jsp:
    <%@ page language="java" %>
    <%@ page contentType="text/html"%>
    <%@ page import="com.tcs.wdc.core.*" %>
    <%@ page import="com.tcs.wdc.core.login.*" %>
    <%@ page import="com.tcs.wdc.core.service.navigation.*" %>
    <%-- Include tag library --%>
    <%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
    <%-- Get language from IDCUserSession & set it in session --%>
    <%
    /*SessionManager sm = new SessionManager(session);
    IDCUserSession ius = sm.getIDCUserSession();*/
    session.setAttribute("language","nl_NL");
    %>
    <%-- Set the locale for the language obtained --%>
    <fmt:setLocale value="${language}" />
    <fmt:bundle basename="labels" />
    If i uncomment the <%@ include file="WDCComInitLabelsjunk.jsp" %> tag in the code above it is working fine ,
    but it is not working with <jsp:include page="WDCComInitLabelsjunk.jsp" flush="true" />
    pls suggest.
    Thanks,
    Pramod

  • Catch Exception for dynamic Include jsp:include

    I have a page (says pageA.jsp) that should include other file dynamically. (<jsp:include page="<%=includedFile%>" flush="true"/>)
    However, if there is error in the included file, can pageA.jsp redirect to the error page stated in the page attribute instead of including the error message in pageA.jsp?
    Thanks

    So here is a solution, not an optimal one I think but it should be ok if URL are all absolute. Note a "/" is add to be sure when including.
    <%
    if ( new java.io.File(application.getRealPath(aae.getUrlCont())).exists() ) {
    %>
    <jsp:include page='<%="/"+aae.getUrlCont()%>'/>
    <%
    } else {
    %>
    <jsp:forward page="/error.jsp"/>
    <%
    now, it is a valid code for html, jsp or others file type.

  • Jsp:Include VS @ include

    Hi,
    Is there a big diffrence between using <%@ include file="url" %> and <jsp:include page="relative URL" flush="true"/>?
    I know that the first is put in the servlet at the translation and the second is included when the page is requested. I use this for my web pages header which is the same for every page. Which one would be the best?
    thanks,
    Stephane

    Hi,
    Is there a big diffrence between using <%@ include
    file="url" %> and <jsp:include page="relative URL"
    flush="true"/>?This question has been answered many times :-)
    http://www.google.com/search?q=difference+between+include+directive+and+jsp+include
    >
    I know that the first is put in the servlet at the
    translation Here's the full official description on include directive:
    http://java.sun.com/products/jsp/syntax/2.0/syntaxref209.html#1003408
    and the second is included when the page
    is requested. Here's the description on jsp:include
    http://java.sun.com/products/jsp/syntax/2.0/syntaxref2020.html#8828
    I use this for my web pages header
    which is the same for every page. Which one would be
    the best?Think about the future changes, in the future will you ever add dynamic content to the header? Then go with jsp:include or if you are into JSTL use c:import
    If you are very sure that you don't need to add dynamic code to the header then go with the include directive. But be sure of this, otherwise you;ll have to change all JSP headers -- probably with search and replace --- but still it will be a PITA.
    Another option is you could set coda and prelude in web.xml , that will auto include static content in all JSP pages --- with coda and prelude specified in web.xml you don't have to include files in the JSP pages themselves. But the disadvantage is that the header and footer will appear before the opening html and after the closing html tag.
    >
    thanks,
    Stephane

  • Parametricizing the file name in the jsp directive %@ include file=

    Is there any way to parametricize the file name in the above directive. Am not too keen on using
    <jsp:include ..
    because of performance issues and also i am only including a static HTML issues.
    Any responses would be appreciated?

    Nope.
    The <%@ include %> occurs at the time of translating/compiling the jsp into a servlet. It thus cannot accept any runtime parameters.
    Are the performance issues of using <jsp:include> that large?

Maybe you are looking for

  • How Create a dynamic filter on Segment

    Hi guys. I have already the complete integration between Oracle BIEE and Siebel MARKETING. So i want to create, in the oracle BI side, a single segment filtered with a System Parameter-->"Campaign origin code". Because i want define only 1 segment,wi

  • Canon imagerunner C3200 problem - won't print

    Hi to all, I have searched this forum and not found this error/solution. We just switched from PC to Mac and of course all is heaven! Except one tiny issue - going crazy. We have installed the printer driver from Canon for all of our imagerunner prin

  • Essbase 9.3 BSO member formula problem

    Hi All, I'm working on Essbase 9.3.1. We have an issue where a member formula, should use double quotations (") for a few members. In the dimension tables these quotes are not present in the formula, but they come up in the outline of the cube. All d

  • Switching out HD and have some questions

    I Have two different issues here. I am installing a 500Gb Seagate in my G5 which currently has a 160 Gb and a 200Gb in the two bays. The system is running on the 160Gb HD with a clone on the 200Gb. I have an external LaCie D2 500 Gb HD which I intend

  • Retouch brush is very buggy

    hallo, are you aware that the new retouch brush in lr5 is very buggy, freezing, slow ? do you intend to improve it ? as an example of nice brushes, please look at capture NX2 or more recent ononesoftware retouch and clone brushes : http://www.ononeso