Using .css in servlet

Is it possible to use (include) .css (stylesheet) file in servlets? I think it is not but if it is possible then how ? Please provide sample code !!

Sure it is. Can you write an HTML file where it works? Then extract the bit of HTML that refers to the css file and have your servlet output that in the appropriate place. And don't forget to put your css file in the right place, which is in the directory above the WEB-INF directory for your application.

Similar Messages

  • How to use css in servlet

    out.println("<link rel='stylesheet' type='text/css'");
    out.println(" href='style_shop.css' />");
    i typed above statement in a servlet
    but still doesn't show the style how i can fix it?
    Message was edited by:
    takamai

    is style_shop.css in the correct path on the server?
    If you are using a war file it should be in the root folder of the war.
    or try to give
    out.print("<link rel='stylesheet' type='text/css href='");
    out.print(request.getContextPath() + "/style_shop.css' />'")

  • Using CSS for Web dynpro application in EP

    Hi,
    I have some CSS (Style sheets) which I need to apply to the portal, so that all the web dynpro applications can have the same look and feel.
    I read something about Theme Editor in EP. Can I somehow use that to import the CSS contents into the EP theme?
    Any pointer to using CSS for Web Dynpro applications will be appreciated.
    Thanks.
    Puneet

    Hi,
    Go thorugh the follwing Web Dynpro Java
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/business_packages/a1-8-4/nw04stack09themes.zip
    To know how to use it and for the steps to be followed please follow the tutorial here
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/how to edit web dynpro themes.pdf
    the last url gives you a step by step procedure with wizards..
    Regards,
    RK

  • Internationalize Numbers using css--

    i want to format the numbers using css for each country
    ie if country is france the format=0.0.0
    if country is UK=00.00
    i use the below code
    *<LINK REL=stylesheet HREF="<%= new XMLReaderAdapter().setLocale((Locale)request.getAttribute("locale")) %>"*
    TYPE="text/css">
    but i get a exception
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 19 in the jsp file: /displayBandwidthUsage.jsp
    Generated servlet error:
    The method print(boolean) in the type JspWriter is not applicable for the arguments (void)_
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    root cause
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 19 in the jsp file: /displayBandwidthUsage.jsp
    Generated servlet error:
    The method print(boolean) in the type JspWriter is not applicable for the arguments (void)_
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
    Edited by: SathyaK on Dec 10, 2007 12:34 PM

    new XMLReaderAdapter().setLocale((Locale)request.getAttribute("locale"))The above one return type is void. so u should not.

  • CSS and Servlets?

    is there somebody, who can help me? i'm trying to use my .css file in a servlet, without any success.
    here is my directory structure:
    -webshop
    ---+WEB-INF
    ------+classes
    ----------[servlet]
    ------web.xml
    ---[jsp]
    ---myStyle.css
    and here is my code:
    out.println("" +
    "<html>" +
    "<head>" +
    "<title>menu shop</title>" +
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"myStyles.css\">" +
    "</head>"
    i hope somebody can help me.
    thanx
    backe

    Please help a Java newbie here. I am having the same problem as the thread starter here. In addition, my graphics are also not showing up. I assume when you say the "/" mapping will hide everything in the webapp, that's whats happening to me. What other choice can be used so the servlet is run when the visitor types www.myurl.com ? Or, how do you put the stylesheet into a "different context" Please remember, my understanding of what I'm doing here is very tenuous and nebulous. Would appreciate any help...

  • How to upload more than 100mb in using com.oreilly.servlet package

    hi all,
    I use com.oreilly.servlet package to upload and i use the following code to upload
    MultipartRequest mr = new MultipartRequest(request,"/tmp/saved",0x10000000);My problem is i can't upload more than 25mb, uploads upto 25mb and shows page cannot displayed err in IE,
    Pls help

    In the webserver there is most likely a configuration option for the maximum size that a request may have. So search through the manual of your particular webserver on how to change that.

  • How do I scale a lot of images using CSS in HTML5 and CSS3

    I have a CSS image gallery that displays a larger photo with descriptive text below it, when a thumbnail image is hovered on.
    Each photo has code like that following:
    <a class="thumbnail" >
    <img src="thumbs1/paradethumbs/DSC_0073.jpg" alt="thumbnail picture" />
    <span><img src="pics1/paradepics/DSC_0073.jpg" alt=" " /><br /> 19 - a black faced sheep.</span>
    </a>
    The first source is a thumbnail,  image stored at a size of 72 by 48.
    The second source is an image stored at 600 x 400.
    When the thunbnail is hovered on, the larger photo is displayed at its full size using css.
    There are 20 or so thumbnails in this gallery, and different numbers in other galleries that use the same code.
    The example above is number 19 from 20.
    This works fine on tablets and larger displays.
    When I wish to show it on an Iphone or similar, with a display that is 480 or less wide, I need to scale the larger photo down to 300 wide.
    As the Iphone will have a lower quality of image than a larger display, it will not matter too much if the 600x400 photo is scaled down, and having tried it by giving it an ID with CSS like
    #imagescale{ width:300px; } it looks acceptable. However, as IDs are supposed to be unique, then thats a no go area for the remaining photos.
    My problem is how do I select the second image source shown in bold above, and scale it and the span text by 50%.
    The text is not too important as it can be changed to fit - the image is the main problem.
    I need someting like "if the display is less than 600 and the image is in the pics directory, display it at 300 wide".
    The browser will hopefully  take care of the height.
    Any suggestiosn would be appreciated.
    Howard Walker

    Thanks Nancy. The general idea and the link to the article helped a lot.
    However, the css using using a percentage had unpredictable results when selecting repeated images.
    The first one scales to 50% and then the next scales to 50% of the last one (25%)  and so on ad infinitum, unless you click on another object that is not an image.
    Using a pixel size like 280px rather than a percentage did the trick, but it also involved changing lots of other items before I could get everything to fit.
    Now I have a better knowledge of media queries and how to set them up.
    Best of all, all my image galleries work fine just using css and html. Never thought that would happen.
    Take five stars!
    And the same to David Powers for his great article.
    Howard Walker

  • Use css file in oracle 10g report builder

    hi every one
    i am using oracle 10g report buidler. i want control paramform by usign css file.
    any body have idea how can i use css file in oracle report builder 10g and how can i modify it's path and i how can i manage any css class on a perticular field.

    Thanks Billy.
    Yes you are right.
    Here why I discarded that option is,
    I may get the source files with changing layouts.
    My Actual scenario is as follows.
    Initially we developped all the things using PL/SQL packages. Its working fine.
    But as per the inputs we received from requirements group, the file structure changes dynamically. and we would able to consider those new columns also. We should be able to changes the rules dynamically.
    Lets say, we doing fullouter join on Src_A and Src_B. on columns col1_A and col1_B.
    Now the requirement changes in a way that, the join should be done on Src_A and Src_C. on columns col1_A and col_C.
    For this I need to define a new package.
    Instead of that, I would like to do everything dynamically based on configuration parameters given as input.
    Thank you,
    Regards,
    Gowtham Sen

  • Problem regarding the creation of Table using CSS.

    Hi ,
    Here I have a Problem regarding the creation of Table using CSS.
    In My Application i have a table with multiple rows(Rows are Dynamically added to the table).First i am setting the table with the following properties:
    width:900px;
    height : auto,
    Overflow : visible,
    Max-height: : 200px.
    If I use above properties,I'm getting a table with 5 or 6 rows(height upto 200px).After that i am getting the Vertical ScrollBar.
    The problem is when a table has many columns, Vertical and Horizontal Scrolls are coming at the time of setting the table. The table height is not Increasing dynamically.
    How can i use "height" property in CSS? (I want the table height to be increased when the columns are more.)
    Thanks & Regards
    Madhavi

    Hey humble user. Errr I'm trying to understand what ur trying to do. U want to create a section of a region destructively from an existing region right? If so select the option convert to new region (opt-comm-R or selecting it by right clicking). Check your audio bin to make sure. Whats the "merge" function? Are u refering to the glue tool?

  • Displaying linked pages in an area of the screen, using CSS?

    Imagine that I have a column on the left of the page that has a list of links to other pages.  When you click on any of those links, then to the right the linked page is shown.
    I know how to do this with frames, but I'm trying to figure this one out using CSS.
    Can anyone point me in the right direction?
    Below is a code sample that if your save and then view in a browser will show you (hopefully) what I am trying to achieve.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <!--
    This html code creates a document with a:
        header that resizes to fit the width of the browser;
            sidebar on the left (of fixed width);
            'text' area, to the right of the sidebar, which resizes to fit the browser window width
            foot, which resizes to fit the browser window width.
    -->
    <title>Test site</title>
    <style type="text/css">
    <!--
    body {
    text-align: justify;
    min-width:700px;
    color:#000; <!-- text color for the whole document -->
    div.header {
    height:4em;
    width:auto;
    border:0;
    padding:0;
    text-align:center;
    background-color:#6CF;
    div.sidebar {
    width: 15em;
    float:left;
    text-align: left;
    border-bottom:0px;
    padding-top: 1em;
    padding-right: 1em;
    padding-bottom: 1em;
    padding-left: 0em;
        background-color:#390
    div.footer {
    width:auto;
    border:0;
    padding:0;
    text-align:center;
    background-color:#6CF
    -->
    </style>
    </head>
    <body>
    <div class="header">
       header goes here
    </div>
    <div class="sidebar">
    <!--   Siderbar goes here, and will have links to other pages.
       change width (in div.sidebar, to change width). -->
       Link to page 1<br />
       Link to page 2<br />
       Link to page 3<br />
       etc...<br />
    </div>
    <!-- <br clear="left" /> stops the footer overlapping the sidebar. -->
    This is the area  where the pages linked to should be displayed.<br />
    So, if you click on the "Link to page 1" link, to the left, the contents of page 1 will be shown here.<br />
    If you click on the link to the left that says "Link to page 2" then the contents of page 2 will be shown here, etc.<br clear="left" />
    <div class="footer">
    footer goes here
    </div>
    </body>
    </html>

    Thank you Nancy!  Your solution is (I believe) 99% of the way to being exactly what I want.
    The code fragment below:
    <div class="sidebar">
    <!--   Siderbar goes here, and will have links to other pages.
       change width (in div.sidebar, to change width). -->
       <a href="../Test/About.html" target="Frame1"> About</a><p>
       <a href="../Test/FAQ.html" target="Frame1"> FAQ</a><p>
       <a href="../Test/Contact.html" target="Frame1"> Contact us</a><p>
    </div>
    <iframe name="Frame1" id="Frame1" src="../Test/About.html" height="auto" width="auto" allowtransparency="true"  border="0" margin="0" scrolling="auto"  > </iframe>
    but I want the window that contains the 'imported' code to expand to be the same height as the sidebar and wide enough to stretch to the rightmost side of the visible screen.
    I was guessing that
    height="auto" width="auto"
    would have done the trick, but it would seem not. Any ideas?

  • Using CSS and Javascript to display a div with flash in it, mozilla reloads the flash file!

    I am using CSS and Javascript to display a div with an
    embedded flash object in it. Mozilla Firefox reloads the flash file
    when the div is displayed! (I dont want this to happen, as it's
    unexpected functionality, my expectation would be that the flash
    file would not change it's state at all, and would remain in
    whatever state it was left in.)
    I was wondering if anyone has come across this issue and is
    there something I can do to prevent this from occurring?
    To be more specific, I have a single HTML page with 8 flash
    files embedded in it (yeah I know, it's a bit much). I am then
    using CSS and Javascript to display (via a numbered link (with an
    id)) an equivalent numbered div tag containing the flash file.
    Mozilla Firefox reloads the flash object that is in the div.
    Internet Explorer will not do this and will instead, load the flash
    object only upon initial view of the flash object. All subsequent
    links (in IE) will NOT reload the flash object on the page. I'm
    guessing this is some kind of difference in the flash player as an
    Active X object and the plugin, or is it just IE being clever? Or
    am I way off?
    Anyway, here is the code...

    I am using CSS and Javascript to display a div with an
    embedded flash object in it. Mozilla Firefox reloads the flash file
    when the div is displayed! (I dont want this to happen, as it's
    unexpected functionality, my expectation would be that the flash
    file would not change it's state at all, and would remain in
    whatever state it was left in.)
    I was wondering if anyone has come across this issue and is
    there something I can do to prevent this from occurring?
    To be more specific, I have a single HTML page with 8 flash
    files embedded in it (yeah I know, it's a bit much). I am then
    using CSS and Javascript to display (via a numbered link (with an
    id)) an equivalent numbered div tag containing the flash file.
    Mozilla Firefox reloads the flash object that is in the div.
    Internet Explorer will not do this and will instead, load the flash
    object only upon initial view of the flash object. All subsequent
    links (in IE) will NOT reload the flash object on the page. I'm
    guessing this is some kind of difference in the flash player as an
    Active X object and the plugin, or is it just IE being clever? Or
    am I way off?
    Anyway, here is the code...

  • How can i upload a image file to server by using jsp or servlet.

    Hi,
    I m gurumoorthy. how can i upload a image file to server by using jsp or servlet without using third party API. pls anyone send me atleast outline of the source code.
    Pls send me anyone.
    Regards,
    Gurumoorthy.

    I'm not an applet programmer so I can't give you much advice there.
    If you want to stream the file from the server before it's entirely uploaded, then I don't believe you can treat it like a normal file. If you're just wanting to throw it up there and then listen to it, then you can treat it like a normal file.
    But again, I'm not entirely certain. You might be able to stream the start of the file from the server while you're still uploading the end of it, but it probably depends on what method you're using to do the transfer.

  • How to use CSS option in Answers

    Hi,
    I have around 5 Dashboards, which includes close to 20 Reports.
    I would like to learn how I can format column name (like Font, Size) and data appearance in each report.
    Currently am doing it manually, one column by one column. I would like to know how to use CSS option.
    Regards,
    Jitendra

    The easiest way is to do this is to create a new "skin" for your dashboards or either modify the default. The location of the default folder is /res/s_oracle10/b_mozilla/views.css. The view.css file is where you can go and customize the classes. For example, if you want to customize the Pivot Table Row Header, search for .PTRH and then you can alter the existing formatting or add additional specifications.

  • Resizing image using CSS - not working in IE

    Hello,
    I have a standard report with couple of columns one of which a image column. The images are of varying sizes and I manged to resize them to a fixed width & height by using CSS code in page header as below:
    td[headers="ITEM_PICTURE"] img {
      display: block;
      width: 70px;
      border: 1px solid #999;
      padding: 4px;
      background: #f6f6f6;
    }The CSS does the trick in Chrome & Firefox but does not work in internet explorer. Is there a way to make this CSS code IE friendly?
    Cheers for help.

    William Wallace wrote:
    I am using Apex 4.2.1 (had this issue in 4.1.1 as well) and using theme 10.Ah, the Sludge Sand theme. In 4.x that's a legacy theme only really included to allow applications to run on IE6. It's therefore intended to run in quirks mode, meaning in Internet Explorer terms there's no support for anything that didn't work in IE6 (for certain values of "work"). This means no CSS3, no support for a lot of useful CSS2.1 stuff (like attribute selectors), and probably problems with jQuery which requires standards mode. Adding a DOCTYPE to the page templates to trigger standards mode Interactive Report: how can I display carriage returns?. In 4.2 you really should switch to one of the latest Standard themes, or at least one of the standards mode Legacy themes (those not marked with a "*").
    If you must use theme 10, and there are no other images in this report (like edit icons) then you could add a static ID to the region and use a more basic selector like:
    #static-id td.t10data img {
      display: block;
      width: 70px;
      border: 1px solid #999;
      padding: 4px;
      background: #f6f6f6;
    }However, it appears that one of IE's quirkier quirks mode quirks is that CSS padding is not supported on images, so the presentation you want is not possible using theme 10 in IE and CSS alone.
    Switching to a modern theme is recommended.
    Edited by: fac586 on 02-Mar-2013 10:31

  • Buttons using CSS not working properly

    I am using Dreamweaver CS4.
    I can't get buttons to work properly using CSS.
    The buttons are supposed to have a red border around them when inactive (a:link).
    Hovering over the button causes it to change its appearence (this works).
    Clicking the button works.
    Do this then click the BACK arrow.
    Buttons no longer have red border.
    I have tried this with FireFox, IE 7, IE 6 and Safari. They all do the same thing.
    You may see it in action at www.justforso.net/buttons.htm
    What am I doing wrong???
         .....  Thanks for your help 
    Here is the code:
    /* CSS Document */
    Theme Name: Buttons Test
         margin: 0;
         padding: 0;
    body {
         font: 80%/1.6 Trebuchet MS, Verdana, Arial, Helvetica, sans-serif;
         color: black;
    a.example1:link
       font-size:14px;
       font-weight:bold;
       text-decoration:none;
       border-style:outset;
       border-color:red;
       border-width:5px;
       background-color: #FFFFCE;
       width:125px;
       color:navy;
    a.example1:hover
       font-size:14px;
       font-weight:bold;
       text-decoration:none;
       border-style:inset;
       border-color:red;
       border-width:5px;
       background-color: #FFFFCE;
       width:125px;
       color:maroon;
    /* CSS Document */
    /* HTML Document */
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Buttons Test</title>
    <link rel="stylesheet" href="buttons.css" type="text/css" media="screen" />
    </head>
    <body>
    <p> </p>
    <p> </p>
    <A href="http://www.sitepoint.com/" class="example1"> Beginners </A>
    <A href="http://www.sitepoint.com/" class="example1"> Promotion </A>
    <A href="http://www.sitepoint.com/" class="example1"> Site Point </A>
    </body>
    </html>
    /* HTML Document */

    It's because you have created styles only for the :link and :hover pseudo-classes. Your buttons revert to the default state when the link is active (being clicked) or has been visited. You need to assign properties to the :visited and :active pseudo-classes as well.
    Another point about your CSS is that you're failing to make use of the cascade. There's no need to repeat values that don't change. I have rewritten your CSS like this:
    a.example1
       font-size:14px;
       font-weight:bold;
       text-decoration:none;
       border-width:5px;
       border-color:red;
       background-color: #FFFFCE;
       width:125px;
       color:navy;
    a.example1:link, a.example1:visited {
         border-style:outset;
    a.example1:hover, a.example1:active
       border-style:inset;
       color:maroon;
    This applies common rules to the basic a.example1 selector, and sets the overrides for the pseudo-classes.
    One other point. You're using an XHTML DOCTYPE. All tag names MUST be in lowercase to be valid. This is wrong:
    <A href="http://www.sitepoint.com/" class="example1"> Beginners </A>
    The opening and closing <a> tags should be in lowercase.

Maybe you are looking for

  • Iphoto 9.2 crashes when importing photos

    iPhoto crashes when importing all picture formats, .jpg etc. from any source. iPhoto 9.2 is same as iPhoto 11 (part if iLife) Solution to problem is to ininstall or trash a 3rd party app called 3ivx. Look in Applicaton folder. Also look in library>ap

  • ALE settings in xi

    1) what are the ALE settings i have to maintain in R/3 system and XI in  Idoc 2 file scenario?(I know little bit RFC Destination, Port, Partner profile in R/3 system. is it required to maintain the port in XI also? ) 2) what is use of  Meta data ( ID

  • Itunes on Windows 7

    Had windows 7 installed on my pc. I tunes will only go so far and stops working. i cannot download anything from the itunes store on my computer. please help

  • Windows 7 64 bit COMHookDll.dll crash

    Hi I am trying to run itunes 9.1.1. Each time I start it, the itunes *32 process runs for a few (5ish) seconds and then quits with this in the windows application event log: Faulting application name: iTunes.exe, version: 9.1.1.12, time stamp: 0x4bd8

  • Windows 7 on Lenovo n500

    Hi everyone, I installed Windows 7 today just out of curiosity and now I wanna get rid of it and return to Vista. So the question is how do I do that? I have no Vista CD. I do have one DVD with Lenovo product recovery, which for some reason refuses t