Include css in jsp

hy!
i know that this topic isn't posted the first time! i searched and found something, but nothing solved my problem!
heres my code:
<html:html>
<link href="/WEB-INF/css/formats.css" rel=stylesheet type="text/css">
<body>the exception:
[ServletException in:/WEB-INF/pages/vmi_login.jsp] Cannot create rewrite URL: java.net.MalformedURLException: You must specify exactly one of "forward", "href", "page" or "action"' my project looks like this:
module-directory
web-inf
css
pages
images
welcome.jsp
i don't know where the problem is!
furthermore, thats not the only problem:
code:
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<html:html>
<link rel="stylesheet" type="text/css" href="../css/formats.css">
<div id="cssFooterContainerRight">
     <html:img width="95" height="37" name="" property="struts-power" border="0" src="../images/struts-power.jpg"/>
</div>
</html:html>exception:
ServletException in:/WEB-INF/pages/vmi_footer.jsp] Cannot find bean in any scope' no images are shown...nothing!
only placeholders for the images, and the header!
i use tiles!
i hope someone can help me!
tia
ciao david

<link href="/css/formats.css" rel=stylesheet type="text/css">
and put the css directory in the directory that WEB-INF is in...
/webapps/ROOT/index.jsp
/webapps/ROOT/WEB-INF/...
/webapps/ROOT/css/formats.css
You can't store things in WEB-INF that the browser is going to ask for directly. The CSS file in the link tag has nothing to do with JSP. The browser will interpret the HTML in the page and then get the CSS file separately. The path needs to point to a public directory on the server, and stuff in WEB-INF is private.

Similar Messages

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

    Hello
    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

  • Integrating css and jsp

    Hi,
    I need a way to let my users custimize their view of the system Im currently developing. Right now I have most of the information about how the page looks in css files (using <link href="style.css" rel="stylesheet" type="text/css"> in order to fetch that information). The question I have is how to let jsp change the colors, fonts etc of the css. Is this only possible if I use include on the css instead of linking? Is there a program/metod developed to use? Should I build some classes which I can ask for the right style (e.g span style="<% StyleHandler.getTitleNormal() %>")?
    I guess there is a number of ways to handle this problem but I dont want to invent the wheel again. Help me out finding something making my work easier..;) Thanks in advance!
    /Lobtec

    Well, you could make the CSS file link be a link to a JSP page which could print out CSS instead of HTML, and it could dynamically print CSS values stored for the user on the server.
    <link href="style.jsp" rel="stylesheet" type="text/css">
    style.jsp:
    body {
      background-color:<%= session.getAttribute("bgColor") %>;
    }Of course, you might store the values in some object in the session read from a database or whatever, but I think you get the point.

  • Dynamic include file in JSP page

    <span class="value">Hi
    i have index.jsp , this page can include jsp
    pages dynamically by passing the name of the page to be included to the
    index page with out .jsp , so if i want to include page "code.jsp" i
    put: .../index.jsp?page=code , this have to include code.jsp page
    i made the following code , but it did not find the file
    so can any one help plz ?
            String pg=request.getParameter("page");
            if( pg!= null && ! "".equals(pg)){
                    File f=new File(request.getParameter("page")+".jsp");
                    if(f.exists()){
                            out.print("file exist");
                            %>
                            <jsp:include page="<%=request.getParameter("page")+".jsp" %>" />
            <%
                    }else{
                            out.print("file not exist");
         

    What does the file existing or not really have to do with it?
    You can try it like this:
    String pg=request.getParameter("page");
            if( pg!= null && ! "".equals(pg)){
                    String webPath = pg + " .jsp";
                    String realPath = request.getRealPath(webPath);
                    File f=new File(realPath);
                    if(f.exists()){
                            out.print("file exist");
                            %>
                            <jsp:include page="<%= webPath %>" />
            <%
                    }else{
                            out.print("file not exist");
            }Alternatively you could try using a request dispatcher:
    RequestDispatcher rd = request.getRequestDispatcher(webPath);
    if (rd == null){
      // doesn't exist
    }

  • Include file in jsp not working

    Hi ,
    I have an include file statement in my jsp file which is not working. Not getting any error message either only the page is displayed without the jsp file included.
    My include code looks like this :
    <%@ include file ="Includes/hello.jsp" %>Also i tried including an html file or an image in the same place neither of the two displayed.
    <!--#include virtual="includes/footer.html" -->
    My jsp file is hosted on IIS

    nb123 wrote:My jsp file is hosted on IIS
    Hi ,
    I have an include file statement in my jsp file which is not working. Not getting any error message either only the page is displayed without the jsp file included.
    My include code looks like this :
    <%@ include file ="Includes/hello.jsp" %>Also i tried including an html file or an image in the same place neither of the two displayed.
    <!--#include virtual="includes/footer.html" -->
    My jsp file is hosted on IIS
    Check the path you've specified. It may well be;
    <%@include file="hello.jsp" %>or
    <%@include file="/Includes/hello.jsp" %>

  • Dreamweaver Extension to view all included CSS files in a document?

    Is there such an extension that would allow you to view, via a panel, all inlcuded CSS filed within a document?
    It would be so nice to see a nice list of all of your included CSS files, especially when there are several, and also being able to launch them and edit them without having to go into code view within the document, find the reference, and then Ctrl+D to edit the stylesheet.  I swear I saw something like this once, but I can't find it anywhere now...

    Have you looked in the CSS Styles panel? If you have "All" selected, then you can see cach attached CSS file and perofrm any edits you want to and not have to open the files. Also, if you have Dreamweaver CS4, then the Related Files bar lists all related files, including any CSS files and you can select the CSS file name and you can edit the files directly.
    While in the CSS Styles panel, if you right click on the selector, or on the properties for a selector, then you can choose Goto Code which will take you to the correct file and the correct line for the code of the specific selector.
    Or am I missing something that you're trying to accomplish?

  • Include a page .jsp

    It is possible to include a page .jsp in another page???
    How??
    thanks

    Perhaps you mean a page fragment (jspf)?
    If so, see http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/pagefragments.html

  • Error when using %@ include file="/test.jsp"%&

    UsingNitrox version 2.1 M3 (build 419 06022005):
    with jdk version: 1.5.0_03 and Tomcat 5.5.9
    This is the error :cry: when using <%@ include file="/test.jsp"%> in jsp:
    Severity     2
    The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files (test.jsp)
    It used to work in previuos version of Nitrox. I can't use struts tiles because the tiles content is dynamic (run time) and I need it to be static (at compile time).
    Have you encountered this problem? What is the fix? Nitrox bug?
    I need your help please,
    Alberto

    M7,
    I found the problem :wink: . In the java Build path having the default (ALL) is not picking up the content of the package. I had to use add multiple and include all the folders and subfolders (many L) in my packages. After that I added *.java and *.properties to select all the java files. Now it is working. I assume this is a bug in Nitrox. The default ALL should include the all the files in the path.
    Thanks,
    Alberto

  • Including CSS in xml defination instead of using labelattribute tag every where

    I am creating a report using XMl defination
    but i don't wanna type all the font syle color for each field , i want to use css
    so that i can include css and use class for
    each element just like we use in html/css
    i have seen the documentaion , i could'nt find it , can some one help me with example
    thanks
    Manks
    null

    I think it would be simpler to use just a normal report template that can define the colors and font for the different sections in the report.

  • "include directive or jsp:include "

    Hi,
    Which amongst <%@ include file="header.jsp" %> and
    <jsp:include page="header.jsp"/>to be used, when performance is taken into account.

    Code copy from serverside.com
    Is it the same as --> jsp:include and %@ include directive.
    Actually, <jsp:include> vs. <%@ include %> is a different story.
    <%@ include %> is a "compile-time" include. The included file is inserted into the JSP when the JSP compiles.
    <jsp:include> is a "run-time" include. If JSP-1 includes JSP-2, JSP-2 is invoked when JSP-1 executes, and the output of JSP-2 is inserted into the output stream of JSP-1.
    The run-time include runs a bit slowly, but can save a lot of system memory, so in general, the run-time include is preferable. Only use the compile-time include if the include code must be in the same page.
    For example, if you want to use an include that defines a bunch of tag libraries with the taglib directive, it will have to be a compile-time include. If you just want to insert a standard header and footer in your page, a run-time include will be more effecient.
    I hope its enough for you to get an clear cut idea,

  • Pls tell me use %@ include file="myfile.jsp"% with endcoding UTF-8??

    My jsp pages use some endcoding as UTF-8.
              When I use <%@ include file="myfile.jsp"%> endcoding lose format UTF-8. But
              if I use <jsp:forward page="myfile.jsp"/> it work fine.
              Pls tell me use <%@include %>
              (I use Jbuilder 6 and weblogic server 6.1)
              Thanks .
              

    From http://java.sun.com/products/jsp/tags/12/syntaxref1214.html#8828 (emphasis mine):
    page="{ relativeURL | <%= expression %> }"
    The relative URL that locates the resource to be included, or an expression that evaluates to a String equivalent to the relative URL.
    The relative URL looks like a pathname--it cannot contain a protocol name, port number, or domain name. The URL can be absolute or relative to the current JSP page. If it is absolute (beginning with a /), the pathname is resolved by your web or application server.
    You could use a servlet in your "path" attribute and have that servlet read and return the page from a different server; there are ways to do what you want, but <jsp:include> isn't one of them.

  • Problems with include where the include is a jsp

    Hi ,
    I have a typical problem. The iplanet server doesn't interpret the code
    from a jsp which is included in another jsp. For eg.
    code for main jsp
    request.getParameter("username");
    <%@ include file="/jsp/ui/left_nav.jsp" %>
    processing code.
    Now when I start the server and the first time I load this page I get a
    dearranged page which has the code of the left_nav.jsp present in the html
    output.
    On opening this page to edit, when a small modification is made and the file
    is saved, a reload of the same page gives the proper output with all the
    jsp's interpreted.
    Thanks to one and all,
    Regards,
    Gurjit

    You definitely want to use a jsp include action, not a directive. The directive
    happens at translation time and does not process the requested page. An action
    happens at request time and treats the requested page as a new request, thus
    including the results of the invoked jsp.
    BTW, the include action is the tags that looks line <jsp:inculde
    page="included_page.jsp" flush="true"/> or something similar (parameters can
    also be specified).
    The JSP 1.1 spec has more details. See sections 2.7.5 & 2.7.6 (for the include
    directive and a quick comparison of the directive vs the action) and 2.13.4 (for
    the include action).
    Matt
    Gurjit wrote:
    Hi ,
    I have a typical problem. The iplanet server doesn't interpret the code
    from a jsp which is included in another jsp. For eg.
    code for main jsp
    request.getParameter("username");
    <%@ include file="/jsp/ui/left_nav.jsp" %>
    processing code.
    Now when I start the server and the first time I load this page I get a
    dearranged page which has the code of the left_nav.jsp present in the html
    output.
    On opening this page to edit, when a small modification is made and the file
    is saved, a reload of the same page gives the proper output with all the
    jsp's interpreted.
    Thanks to one and all,
    Regards,
    Gurjit

  • 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

  • Accessing static content (javscript, css) from JSPs in portal component

    Hello,
    I have a portal component with some jsp files in the folder dist/PORTAL-INF/jsp . Within the jsps I want to access some css and javascript files which I've put in the folders dist/css and dist/scripts. Can anybody tell me how I can access them from the jsp?
    Thanks and best regards
    Dominik

    Hello,
    I finally solved it. To whom it may concern:
    The integration in the JSP should look like the following:
    <%
    IPortalComponentResponse componentResponse = (IPortalComponentResponse)pageContext.getAttribute(javax.servlet.jsp.PageContext.RESPONSE);
    IResource css = componentRequest.getResource(IResource.CSS, "css/style.css");
    IResource js = componentRequest.getResource(IResource.SCRIPT, "scripts/script.js");
    componentResponse.include(componentRequest, css);
    componentResponse.include(componentRequest, js);
    %>
    And make sure that the css file does NOT start with the tag
    <style type="text/css">
    Best regards,
    Dominik

  • Load CSS  in JSP - Deploying in Portlet

    Hello:
    I work development Portlets in netbeans and jetspeed 2.
    A Portlet include a jsp page (include(request, response) ), this jsp have a css pagestyle. a view in my browser very good, but this page into the portlet not load a css page (No color, no fonts, plain tables, etc ).
    Help me please!!!

    You will have to in clude the css inside the jsp in <style> tags
    Cheers
    Varun rathore

Maybe you are looking for

  • How can I change my e-mail on icloud to match my Apple id?

    I have recently changed my phone and got a new Apple ID, unfortunately it keeps popping up to enter the password on i cloud for my old Apple id which I cant remeber..... how can i change it so its the same??

  • SQL 2005 to Oracle 10g migration

    We are migrating from SQL 2005 on Windows to Oracle 10g on Linux. If any one has experience with this kind of migration please share the steps involved. Also is it possible to migrate subset of data from SQL to Oracle or is migrating entire data/sche

  • Need help in the Query

    I am trying to build a query with 1)Customer name,Account number and monthly revenue. 2) Customer name, Year-to -date revenue. I dont know which tables should i join to get the results.

  • Extensions do not stay Enabled

    Hi Extensions do not stay enabled when shut down and restart DW CS4, I can enable the extensions and use them while in DW CS4. But these do not stay enable. No pre-existing software, new PC,  Vista 64bit. Tried running  both applications as administr

  • MacBook Air won't wake up after sleep

    I've been reporting sleep problems with my iMac for a while in the past. No-one here would take it seriously (probably hardware, your reports are incidents, no-one else has these problems) so I just went away and I disabled the sleep function of my i