Including external javascript and css files in servlet
Hello,
I am struggling to generate an HTML page from within a servlet using external javascript and css files. I am not sure how to point the servlet to the external files.
Any code sample to accomplish the above will be much appreciated.
Thanks inadvance,
Antana.
Can't you just include the following in your servlet?
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Getting CSS</title>");
out.println("<link rel='stylesheet' type='text/css' href='yourCSS.css' />");
out.println("<script language='JavaScript' SRC='yourScript.js'></script>");
out.println("</head>");
//...
Similar Messages
-
How to include external javascript and css resources to a jsf?
I need to include external css and javascript files to my jsf page. Using the code below does not work because all the styles on the css page are ignored and the functions within the js files are not executed.
<link rel="stylesheet" type="text/css" href="/resources/styles/style.css" />
<script language="JavaScript" src="/resources/javascript/util.js"></script>When I try to execute any js function within a script tag on a jsf page I get an object expected error.
I googled about my problem and found this piece of code for importing styles for an external css.
<style type="text/css">
@import url("/resources/styles/style.css");
</style>How could I add an external javascript file to my jsf?Used the relative urls in my first post as well as these, and both were not working.
<link rel="stylesheet" type="text/css" href="./resources/styles/style.css" />
<script language="JavaScript" src="./resources/javascript/util.js"></script>The ./ tells that the external file can be found by starting at the current directory and working down the path to the specified file. This is my directory structure. Index.jsf is the file that references the external js and css files.
-Webcontent
|_index.jsf
|_resources
|__styles
| |__style.css
|__javascript
|__util.js
Either way I still can't reference the files that I need. Calling a javascript function results in an object expected error, and the styles are ignored.
If I include the js file directly in the jsf then I can get it to work. I don't want to do this because I have created a handful of seperate js files, and do not want to include all of them in one page. I am using myfaces and tomahawk if that helps. -
4.2 "Include Standard JavaScript and CSS" option removed ?
Hi,
APEX 4.2, Oracle 11g r2.
I was using the option *"Include Standard JavaScript and CSS"* from the page attributes. It was set to *"No"* in all pages as I manage my own JQuery versions.
We upgraded to 4.2 yesterday, and I see the option is still here on 4.2.
I simply tried to set it to "Yes" for a test, but now the option has disappeared !! I can't set it back to "No"...
In each page, if I set it to "Yes" and apply changes, the option is not here when I go back to the page attributes.
Bug ?
Or maybe this option has been removed from 4.2 ?Hi,
yes this has intentionally been removed for applications / pages which do not use the feature. As you mentioned yourself and what we have seen from other customers is that someone doesn't just want to exclude that on a single page and instead want to control it for the application. Which made it a little bit cumbersome, because a developer had to set it for each new page.
That's why we have created a page template placeholder for *#APEX_JAVASCRIPT#* and *#APEX_CSS#* to give you full control where to load the APEX libraries and if you don't want to load them, just remove them from the page template as Vikram already pointed out.
Regards
Patrick
My Blog: http://www.inside-oracle-apex.com
APEX Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf -
Load the External text and css file for more frames
hello..
I created one Movie file. In that I load the External text and css file in first frame and display the first variable value in one text box.
And then in 2nd frame I use another one text field and display the 2nd variable value like that I want to load the more variable in more textboxes with different frames.
I loaded for first variable value in first frame. But I don't know how to do next frames like that..
Help me...You need to load them in the frames they are in. You can store the loaded data in variables in frame 1, but you will need to extend that layer so that whatever is stored is avaliable in other frames. The code to load the data into the other textfields can then be done in the frames where it is needed.
There are other options, such as not using other frames for content or having all of them in frame 1 and making them invisible until you get to the other frames where they get turned visible. -
Include custom javascript and css in uix page
Hello
I got a UIX page based on the pageLayout template and i wanted to include some custom things (css, js) inside the resulting html header like this:
<document>
<metaContainer>
<!-- Set the page title -->
<head title="mypage"/>
<html:link rel="stylesheet" type="text/css" href="http://someotherserver.com/generateStyle?pCSSType=loc"/>
<html:link rel="stylesheet" type="text/css" href="http://someotherserver.com/generateStyle?pCSSType=sys"/>
<script source="customScript.js"><contents><!-- --></contents></script>
</metaContainer>
<contents>
<body>
Unfortunatly only ONE thing from within "metaContainer" gets included in the final html file. Is there a way to include everything from within "metacontainer"?
Thanks for your help,
Philipp StecherI think metacontainer is a named child, and like all named children it can only have one node.
Does this work?
<document>
<metaContainer>
<!-- Set the page title -->
<head title="mypage">
<contents>
<html:link rel="stylesheet" type="text/css" href="http://someotherserver.com/generateStyle?pCSSType=loc"/>
<html:link rel="stylesheet" type="text/css" href="http://someotherserver.com/generateStyle?pCSSType=sys"/>
<script source="customScript.js"><contents><!-- --></contents></script>
</contents>
</head>
</metaContainer> -
Where to put own JavaScript and CSS-Stylesheets in GlassFish ?
Hi out there,
we have some applications which are using external JavaScript libraries, CSS-Stylesheets and Images.
On OHS we had a directory for those files which we aliases in dads.conf.
Where do we have to put this directory when switching to GlassFish and Apex Listener ?
Regards and thanks
MarkusHi Markus,
if you use the "regular" GlassFish, this shouldn't be a big issue. Just create a subdirectory in the GlassFish's docroot-directory for each alias you have now and copy the corresponding content into that directory. See "Copy Oracle Application Express Images" in the Listener documentation - the handling for other static content is similar to the handling for images.
If you plan to test this with the Embedded Web Container (embedded GlassFish), this will not work that way, because you only have the fixed contexts for images, apex and the listener-internal functions.
-Udo -
Embedded Javascript and CSS removed from mail
Hey folks,
I wrote a small app to send a html email to myself.
When I sent it inline all the embedded javascript and css were removed.
When sent as a .html page attachment and opened from within the browser (Gmail, Mozilla 2.0)
all the embedded script and css were gone. However when downloaded to the machine, it was all there.
Looks like this is a browser issue, would anyone know how to get around it?
It's so that I can have collapsable headers in my email message.
Thanks,
Mark.Hi Tony.
Yes, it's possible. Read [Wiki WPC FAQ|https://wiki.sdn.sap.com/wiki/display/KMC/WebPageComposer-FrequentlyAskedQuestions+%28FAQ%29#WebPageComposer-FrequentlyAskedQuestions%28FAQ%29-WhataboutusingstandardHTMLpagesinWPC%3F].
KM supports relative links in HTML documents so it may be necessary include any dependent files in the same folder as the HTML document.
In case of a web page and its dependent files are stored in different folders you need editing the source html code:
1. use Portal Drive and any text editor (I prefer Notepad++. It has the feature "Search and Replace in files") to open the html source file.
2. search for links to dependent files and add the following pattern: /irj/go/km/docs//<path to an dependent file>/ before a filename, for example:
You have a web page with css file. The page is stored in documents repository under the folder with ID old_pages. The css is resides in css folder.
So the existing code
<LINK REL=STYLESHEET TYPE="text/css" HREF="css/style.css">
should be replaced with the
<LINK REL=STYLESHEET TYPE="text/css" HREF="/irj/go/km/docs//documents/old_pages/css/style.css">
Best regards,
Aliaksandr -
How to optimize portal javascript and css - where is scriptset property ?
Hi,
I've downloaded <a href="https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d164c5ee-0901-0010-4fbf-d0856b5c8a84">How to Finetune Performance of Portal Platform</a> document,
which contains portal performance optimization tips.
In this pdf file there is a section about optimizing javascript and css code by using
scriptset property and there is also appropriate reference to the help.sap.com portal page.
The problem is that this page is not there so I'm unable to configure this scriptset property.
Any ideas where can it be found?
Regards,
Ladislavyes - go into System Adminstration --> System Configuration and then Service Configuration (in the detailed Nav).
In there, find application com.sap.portal.epcf.loader - In Services --> epcfloader the property you seek is script.set and you should change from standard to optimize. Then you need to restart the service.
Hope that helps
Haydn -
Java script and css files are not loaded
I am using 9iAS 1.0.2.2.2a on Windows Server Family 2000. My web application is using bc4j and developed in JDeveloper 3.2. I am also using Apache and web cache and caching js and css files.
Problem is some times it does not load js files but load css files.
Some times loads css files but does not load js files.
Some times does not load js and css files.
& some times loads both types of files.
How to control this problem.
Tahir Pervaiz.I'm fairly certain this issue represents a bug in IE 11. The same problem(s) do not occur in IE 9 or IE 10. The same problems occur on unrelated websites accessed from separate machines. Doing a force-refresh (Ctrl+F5) always fixes the issue.
I took your advice about opening the console to look for error messages during page load. When loading normally (i.e. not doing a force-refresh), the console shows the following:
HTML1300: Navigation occurred.
File: TimeEntry
DOM7011: The code on this page disabled back and forward caching. For more information, see: http://go.microsoft.com/fwlink/?LinkID=291337
File: Dashboard
SCRIPT70: Permission denied
File: modernizr-2.5.3.js, Line: 468, Column: 9
SCRIPT70: Permission denied
File: jquery-ui-1.10.0.js, Line: 252, Column: 1
SCRIPT70: Permission denied
File: knockout-2.2.1.js, Line: 48, Column: 5
SCRIPT5007: Unable to get property 'extend' of undefined or null reference
File: knockout.validation.js, Line: 30, Column: 5
When loading the page via a force-refresh, only the 'Navigation occurred.' message is displayed. It does not make sense that IE would apply a more restrictive security policy to scripts loaded from cache vs. scripts loaded directly from their original location,
yet that appears to be what is happening.
Post questions about html, css and scripting for website development to the IE Web Development forum.....WITH A LINK TO YOUR WEBSITE OR A MASHUP THAT SHOWS THE ISSUE...
looks like you have a sandboxed iframe on your page.
the first step in troubleshooting IE issues is to test in noAddons mode.
Rob^_^ -
I have connected a new (set up for mac) seagate external HD and although file sharing is turned on the HD doesn't show up on any of the other computers on our network?????? Please help!!!!!
If the HD is setup for Mac and plugged into the AE.. with file sharing on, it should work.
Try manually mounting the disk.
In finder use go, connect to server, and type in AFP://AEName or AFP://AEIPaddress.. where you replace what I wrote with the actual name or actual IP.
Later versions of Mac OS.. like ML for some strange reason have their preferences set by default to not show network drives.. change finder preference to see everything. -
Vertical menu using javascript and css
Hi all,
I have to build a vertical top-level menu for a customer. for a few days I surfing the internet to find a good sample. The only sample I found is http://javascript.internet.com/navigation/expanding-menu.html. this is what the customer wants. But this sample has just one level of subitems. I need a sample or source with dynamical levels of subitems. I'am not so formiliar with javascript and css to build it by my own very quickly.
Has someone a sample for me or can someone change the sample so that I can use it in my toplevel menu.
RichardRichard,
Are you trying to implement this vertical menu at Portal's Top Level Navigation? If so, please be aware that these menu's might run into issues which SAP will not support.
Also, there might be issues with upgrades on your portal. We have encountered the same for your client implementation and had to finally decided against the idea until SAP released their own version.
Hope this helps.
Regards,
Winston
PS: reward points if you find this useful -
Oracle db 11gR2
Oracle APEX 4.2.1
Linux RHEL 6.3
I am importing a images file programmatically into APEX. And also a CSS file.
I want to add an images file to my APEX instance but I want to choose the option -- workspace images --. How does one do that programmatically via the APEX API e.g.?
I don't want the images tied to an application within APEX.
Does one do the same thing for CSS files that are imported to APEX?
thx.This is interesting and helpful, I use the following code to import my APEX database application and run it via SQL*Plus and it works fine for database applications -- what do I need to change/add/modify in order to load the images and CSS files? NOTE: I want the images to be -- Workspace images -- not tied to any application. Also, I need to handle the situation where the images and CSS data already exist in the APEX environment as well as when they are not there (i.e. initial install). Usually it is a case where it is an upgrade so the data already exists in the APEX app and just needs to be updated.
declare
v_workspace varchar2(35) := 'WORKSPACE';
n_existing_app number := 123;
n_new_app number := 456;
v_app_alias varchar2(35) := 'WKALIAS';
v_parsing_schema varchar2(35) :='WORKSPACE_PARSE';
n_secgrp_id number;
v_err_msg varchar2(200);
n_err_num number;
n_workspace_id number;
begin
-- get workspace id
select workspace_id
into n_workspace_id
from apex_workspaces
where workspace = v_workspace;
-- set workspace id
apex_application_install.set_workspace_id (n_workspace_id);
-- set security group
apex_util.set_security_group_id (p_security_group_id => apex_application_install.get_workspace_id);
-- set pasring schema
apex_application_install.set_schema(p_schema => v_parsing_schema);
-- delete existing app
begin
wwv_flow_api.remove_flow(n_existing_app);
exception
when NO_DATA_FOUND then -- do nothing when the application does not exist
null;
end;
-- set new app id
apex_application_install.set_application_id(p_application_id => n_new_app);
-- generate offset
apex_application_install.generate_offset;
-- set application alias
apex_application_install.set_application_alias(p_application_alias => v_app_alias);
exception
when others then
n_err_num := SQLCODE;
v_err_msg := SUBSTR(SQLERRM, 1, 200);
dbms_output.put_line('Error number = ' || n_err_num);
dbms_output.put_line('Error message = ' || v_err_msg);
end;
@newapp.sql
commit; -
Does EP 7 supports xHtml and css files?
Hello,
Does EP 7 supports xHtml and css files?
Regards
Sunil KulkarniAs I mentioned to Sergio, it was probably when I switched back to flows_010500. When I did
wwv_upgrade.switch_schemas('FLOWS_010500', 'FLOWS_010600');
I was logged in as FLOWS_010600. However when I switched back using
wwv_upgrade.switch_schemas('FLOWS_010600', 'FLOWS_010500');
I was still logged in as FLOWS_010600. I believe that's the mistake; I should have been logged in as FLOWS_010500 to switch back to FLOWS_010500. I remember seeing this somewhere in the doc (that you should be logged in as the user you are migrating/reverting to), but it doesn't appear to be enforced.
In any case, thanks Sergio for the quick and easy fix! I'm now going to re-install the flows_010600 user and hope that things go smoothly this time. -
How to decrease the size of the JS and CSS File
Hi experts,
I m facing a bandwidth problem because i m accessing an application from a PDA and i noticed that it takes a very long time to load a very simple page. After some investigation, i noticed that its because the JS and CSS files downloaded are rather big.
sapUrMapi_ie6.js (Size: 301 KB)
sapWdSsr_ie6.js (Size: 79 KB)
ur_ie6.css (Size: 247KB).
Any idea how to minimize the size of these files or any workaround as to this problem ?
Your help will be much appreciated.
Regards,
DanielHi,
Check this link this may be helpful to you
http://help.sap.com/saphelp_nw04/helpdata/en/b5/7e1141e109ef6fe10000000a1550b0/frameset.htm
Regards,
SURYA -
How to include external javascript file in an html
hello
i've an html file placed in apache/webapps/test folder this html file includes an external javascript file placed at same level
i'm includind the file as
<script src="file1.js"></script>but the file does not gets included
but when the sam folder "test" is paste outside apache the html file including the external file runs properly.
Thank Youflounder wrote:
cotton.m wrote:
What's really pathetic is that this is your third cross post on this same stupid off topic topic.
You are really a dumb fuck you know that?If they knew that they were a dumb fuck then they wouldn't be a dumb fuck!That's a logical and reasonable conclusion. Therefore I very much doubt that the OP is capable of it.
Hmmm this is interesting. It now shows the entity escapes rather than their values when you quote.
Maybe you are looking for
-
Does anyone know how I can add events to my desktop ical when the message I receive says that the calender was created by Mail I do not know how this happened. I managed to synch and change this some months ago but I do not know how!
-
Want to create a InDesign document that is Interactive as a PDF
I want to create an InDesign form that is made into a PDF that can be filled out (populated with their answers) and returned via email to someone. Can I make the document in InDesign or do I have to do it in Acrobat? I am running CS2. If you can poin
-
Check Information not enabled in FB03
Hi, Check information in the environment is not enabled to view the check details in the T.Code FB03. Where in the GL account line item display (FS10N), it is showing the check details. Can anyone guide me on this. Regards Sunanda
-
MRP requirements (material = "no dispo", storage location deleted)
Good morning, I have two different problems and hopefully, you can help me. - I see stock information in MMBE for a storage location I deleted - MD04 shows requirements for this storage location after it was deleted and the material was set to "no di
-
I have a column chart in ssrs and the x axis shows the category in the middle of the column. Is there a way i can move the intervals on the x axis so that they are at the start of the column instead of in the middle