How to include a file in jsp!
I need dynamic inlude a jsp file by use inlude file �B
Use
<%@ include file="file.jsp" %>
which works at translation time so your file can be a jsp file or use
<jsp:include page="relative url" flush="true" />
which works at request time so the file can't contain JSP.
Similar Messages
-
How to include external files in JSP
hi,
How to include external files like image or javascript in to jsp pages.
I am using MVC frame work. So i have to use request dispatcher. While calling the pages trough dispatcher the external files are missing from the output. Also am using tomcat as server,web.xml(deployment descriptor ) is also configured.
regards
sreeWhen you use the request dispatcher, the relative path for all your ressources becomes the relative path of your calling serlvet and not the JSP/servlet that you call. Make sure to use the full relative path such as:
/PATH_TO_YOUR_DIRECTORY/myRessource.ext
NOT
SOME_DIRECTORY/myRessource.ext
Jeff -
How to include HTML file in JSP using HTML elements or Javascript?
Hi,
I have around 15000 static html files one for each item which we display each upon invoking an item.The HTML file should be part of a JSP file.
Please note that the name of the HTML file is determined dynamically
Placing all the HTML files within the web application does not give us good performance so i would like to put all of them in the webserver.
I am not able to include the file in the JSP using the jsp:include attribute if i place the HTML files in the webserver ,
in order to do that i think should use either HTML element or javascript to include the HTML in the JSP.is there any alternative to <Jsp:include>
Does anyone have an idea how to include the HTML file and take advan tage of webserver?
Any ideas are appreciatedWhat you need to do is simply read the HTML file from the disk and dump it out to the outputstream. It really is that simple.
There's no reason you need to include all 15000 files in the actual WAR, you can place those files any place handy that is easy for the application to see (in another directory, or accessible from a file server if you have multiple front ends).
Then, just write a utiility function that takes the output stream (i.e. the 'out' JSP variable), and the file name, read the file, and write it to the stream.
If you start noticing performance issues, then you can try doing some caching, but truth is your OS should be doing that for you.
But, truth be told that's the only practical way to do it.
Another solution would be to use JavaScriipt and XMLHttpRequest (i.e "AJAX") to load the file at the client side, and simply replace a tag with the results.
That's also pretty trivial to write, any web site talking about AJAX should give you hint there.
Of course, that won't work for folks who have JavaScript turned off, or some other incompatible browser, whereas the server side solution obviously works everywhere. -
How to include .js file in jsp file?
hi,
i have a jsp file with struts tag. right now i have all the javascript code as a separate function inside the jsp file itself. i want the javascript code to be present in a .js file and i want to refer that .js file from the jsp file with struts tags.
<html:text property="Phone" value="" size="3" maxlength="3"
onkeyup="return autoTab(this, 3, event);"></html:text>
the above is the html tag which will call the function "autoTab" of the .js file. please help.
thanks,
Jayanth.You include javascript into a jsp in exactly the same way you do with html
<script src="myJavascriptFile.js"/>
It has nothing to do with the jsp per se, but rather the generated HTML page. -
How to include .css file into jsp file in portal application
Hi,
I have included a .css file in a .jsp file using following tag :
<link rel="<%=componentRequest.getWebResourcePath()%>/css/ts.css">.
I have kept .css file under /dist/css folder.
Preview of jsp file is fine but when I upload the jsp file and .css file to server, Look and feel of the screen is changing. When I paste the style code in jsp file, look and feel is fine.
Can some body suggest me that why the look and feel is changing when I put the style code in css file and include it in jsp.
Thanks in advance.
ManishHello
We're using <link rel="stylesheet" type="text/css" href="http://ourserver/eclib/css/ecstandard.css">
between <head> and </head>
It works.
Hope it helps.
Regards
Benoit -
How to include CSS file in JSP
Hi Experts,
CSS file availabe in server. I need user that CSS in one of PDK application.
Example: "/usr/sap/ED1/JC03/j2ee/cluster/server0/apps/sap.com/irj/servlet_jsp/irj/root/portalapps/style1.css"
I need to include this in one of JSP file.
Regards,
Satya.You would have to place the file in the project folder of your PDK application and give a relative or absolute path to it.
<link rel="stylesheet" type="text/css" href="path_to_your_css_file" />
Thanks,
GLM -
How to include .js file into validater-rules.xml
iam doing project using struts.
i have .js file for client side validation.how to include .js file into struts validate-rules.xml so that i can use those validation in my project.
without writing any class.
is there any waycopy + paste from my book...............
Enabling Client-Side Validations
In addition to providing a framework for simplifying server-side form data validations, Validator provides an easy-to-use mechanism for performing client-side validations. Each validation routine defined in the validator-rules.xml file optionally specifies JavaScript code that can be run in the browser (client side) to perform the same validations that take place on the server side. When run on the client side, the validations will not allow the form to be submitted until they have all passed.
To enable client-side validation, you have to place the HTML Tag Library's javascript tag in each JSP for which you want validation performed, as shown here:
<html:javascript formName="logonForm"/>
The javascript tag requires that you use the formName attribute to specify the name of a <form> definition from the validation.xml file, as shown here, for which you want validations performed:
<form name="logonForm">
<field property="username" depends="required">
<arg0 key="prompt.username"/>
</field>
<field property="password" depends="required">
<arg0 key="prompt.password"/>
</field>
</form>
All the validations that you have specified for the <form> definition to run on the server side will be run on the client side. -
How to include .jar files in coldfusion code
To Integrate our cfm code with paypal jar files we do the
following steps with our local coldfusion server ,and to run and
integrate the paypal Java SDK jar files, I think we need to do the
same process on the server, can you suggest any thing to do the
following setting for my domain on the server, without setting the
class path in coldfusion administrator.
The ColdFusion application server must be configured to know
the location of the PayPal JAR
files, and your ColdFusion Markup (CFM) pages must be
configured with the absolute path to
the PayPal API certificate for the PayPal API user on whose
behalf the calls are made.
1. Install the PayPal Java SDK “Installing the
SDK”.
2. Copy a subset of the Java SDK JAR files to a location
accessible by the ColdFusion
application server. The JAR files are in SDK_root\lib and
their exact names are as
follows:
– bcmail-jdk14-128.jar
– bcprov-jdk14-128.jar
– paypal_base.jar
– paypal_stubs.jar
sax2.jar
– xerces.jar
– xpp3-1.1.3.4d_b4_min.jar
– xstream.jar-1.1.3.jar
3. With the ColdFusion Application Server Administrator, add
the absolute path of the
location you determined in Step 2 to the Java and JVM
CLASSPATH environment variable.
4. Restart the ColdFusion Application Server.
Suggest me how to include .jar files without setting
classpath.> Suggest me how to include .jar files without setting
classpath.
Copy them to {CF_HOME}\lib, where {CF_HOME} is, for example,
C:\CFusionMX7. Restart Coldfusion. -
How to include the file name as an XML field
Hi,
I'm using a file adapter for process a flat file and convert it into an XML. Does anybody knows how to include the file name into an XML field.
Ex.
I process the file named <b>XXIMN21022007.txt</b> and I need an XML like:
<MT_FILE>
<field1></field1>
<field2></field2>
<field3></field3>
<filename><b>XXIMN21022007.txt</b></filename>
</MT_FILE>
Regards
GonzaloJust go for dynamic configuration.
Check the sender file adapter to write the filename in the header (as explained in Michal's blog) and then read that header in some mapping.
U can use that even in simple message mappings.
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm
Your code for the filename tag would be something like:
<i>DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(
http://sap.com/xi/XI/System/File,
FileName);
return conf.get(key);</i>
Regards,
Henrique. -
How to include a file as variable in %@ include file tag.
Hi,
I have a interesting problem here, how can I include a file in <%@ include file tag. where the include file path is a variable. I am trying to implement the following statement.
<@ include file="<%=headerLogic_template %>">
where headeLogic_template is a variable which contains the actual path of the include file.
Thanx,
Ramana.
email:[email protected]Please note that you can not write anything else between the quotes nor for page specification or parameters.
BAD EXAMPLE!!
<% for (int i = 0; i < 20; i++) { %>
<jsp:include page="included.jsp" flush="false">
<jsp:param name="apa" value="prestring_<%=i%>"/>
</jsp:include>
<% }BAD EXAMPLE!! -
Several weeks back I was advised in a post ..: "For non .mac slideshow you need to include the photo page's .js file in the page that you want to jump from."
I asked for clarifications, but got no response.
Now, recovering from file corruptions and an os reInstall, I'm back up to speed again - at least sufficient to get back into that issue.
The subject was "remote link to 'slideshow' " at this page:
"http://discussions.apple.com/thread.jspa?messageID=4247476�
I was asking how to activate a s.s. from a link on a different page, given that I was not publishing to dot-mac.
The response of moving the .js file was a real left curve for me; I've no idea of what do do with the suggestion.
Can someone explain in more detail what that was trying to suggest?
-Like, include the whole '.js' file..?
-Like where in the initiating page would I include the .js?
-Like would that .js need some of it's own modifications before moving it or after?
-Like are the modifications needed in page with the initiating link.
-and, am I suppose to move the whole .js file, or just refer to it someway?
Or is there some other way to do it?
I sure would appreciate some guidance with this remote link thing...
Thanks in advance..!
Mac OS X (10.4.7)You include javascript into a jsp in exactly the same way you do with html
<script src="myJavascriptFile.js"/>
It has nothing to do with the jsp per se, but rather the generated HTML page. -
Include .PDF file in JSP
Am I able to include .pdf file in a .jsp page? If it is yes, how to do it?
Not directly, no.
You use HTML to include it as a seperate html frame/iframe, but nothing specific to JSP will help here.
cheers,
evnafets -
How to Upload a file in JSP ( doc, txt ) as an attachment
I want to upload a file using JSP. I tried Jason's Multipart program, but it is creating some problem. Pls suggest me the alternate. How to write a code. Is there any bean available for free download. Pls. help me.
- Ashok Mudalagi
[email protected]I have successfully used Multipart classes from Oreilly. I believe that's the same one you are referring to. I have implemented my Upload using a servlet though. If you can post what exactly is your trouble using that code, I will be glad to help you with it.
-
How to include .php file in .shtml using SSI
Hi,
I've just finished with my "Contact Us form" for my website and have some issues with running it. I have a .shtml file http://mydomain.com/contact-us.shtml in wich I'd like to include a contact us form file http://mydomain.com/includes/ContactUs.php. Now, having my web page "contact-us" as a *.shtml file with ContactUs.php file included, I can run the form but I can't send any emails. If I would change contact-us.shtml in contact-us.php the form runs perfect but, I can't use other includes on that file as logo, header, footer etc. How could I include an .php file in a .shtml file and runing both the included .php script and includes themself?
Thank You!Keep it simple.
Your html file uses syntax like "<!--#include file=".header" -->" to include an SSI file. Your server requires either (1) that the html file have the .shtml extension or (2) you twiddle with an .htaccess file to cause the server to parse ALL html files for SSIs. The latter is generally not a good idea.
PHP files are already processed on the server. You include SSI files the same way, but the syntax is a little different: "<?php include (".header"); ?> ". -
How to include header files from different directories?
Hi,
Sorry for the newb question, but I can't figure this out. I'm trying to compile a simple piece of code (C++) that uses header files in a directory different from the Project directory; header files are in /opt/csw/postgresql/include/pqxx. I've tried a few different things, adding that directory to the include directives under Resource Files, add existing files from a folder, etc etc. Whenever I try to build, dmake bails with status -1. I can't seem to get this working, can someone explain how to use header files from different directories?
Thanks,
SlowToadyHeader files are usually specified relative to a base directory. If the base directory is not a system directory -- /usr/include or the compiler installation directory -- add a command-line directive
-I path/to/base/dirfor each such directory.
The path can be absolute, such as
-i /opt/csw/postgresql/includeor relative, such as
-I ../../my/includeIn your source code, specify the header file relative to the base directory, and be sure to use quotes, not angle brackets. Example:
#include "header.h" // right
#include <header.h> // wrongThe angle brackets are used for system headers, like <iostream> or <stdlib.h>.
The rules above are common to all compilers on Unix and Linux, and generally to all C and C++ compilers.
For more details, read about the -I option in the C++ Users Guide. You can find the guide by pointing your browser to the "docs" directory in the compiler installation, or go here:
http://docs.sun.com/app/docs/doc/819-5267
All command-line options are described in Appendix A.
Maybe you are looking for
-
Is there a way in Pages to show and print all the added "comments?" (those you add by highlighting text) I am a teacher, and I would like students to be able to view my comments on printed versions of their papers. I know word displays the comments
-
Live Demo of sending SMS from Oracle Forms.
I've just a posted a live demo of how to develop code to call a web service to send and SMS from Oracle Forms. Regards Grant http://otn.oracle.com/formsdesignerj2ee http://groundside.com/blog/GrantRonald?title=live_demo_of_sending_an_sms_from_forms&m
-
Sum in words for created document
Hi Experts, I facing the critical issue which creating purchase order and getting total amount in words format its executing correctly in system default template but its not executing correcly in created Layout such as GBP : 129 One hundred twenty ni
-
Don't upgrade to X.4.9 if using WAVES plugins.
This may be of interest to many. If anyone has taken the leap, maybe you could share your experiences. From what I have read around the place, it is more of a problem if running on Intel. http://www.wavesupport.net/Content.aspx?id=2287
-
I searched but did not find anything (pardon if this has already been explained). I am using CS5 and noticed that all my layers expand everytime I open a file. Not sure if there is a setting to maintain the layer layout when saving or opening a file