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.

Similar Messages

  • Images, ,js, .css   and jsp

    Hi i've a problem, i wrote an application jsp based, each jsp produce an html file that contains tags <img, that link to .css and .js files, i added to my jsp the scriplet:
    <%
    response.addHeader("Cache-Control", "no-cache");
    response.addHeader("Pragma", "no-cache");
    response.addHeader("Expires","-1");
    %>
    to prevent caching into the Temporary Internet files, because i don't want to give the user my application, html files arn't cached but images, .css files and .js files are still cached.
    What can i do to prevent this????
    Thankk for all lbdb:

    Thank you rameshinjava, i tested your solution but it does'n work i still view the .js,.css and .class(applet) file into the Temporary Internet Files directory.
    can anyone give me one other solution?

  • Jdevelopper and Integrated Tomcat and JSP/jscript DEBUG search information

    Hi,
    Where Could i found some informations on installing an integrated Tomcat INTO JDEVELLOPER for Debuging JSP and JSCRIPT PAGES ???
    Regards
    Philippe

    JDeveloper comes with a built-in J2EE container (OC4J) that will let you debug your J2EE apps.
    You can then use one click deploy to deploy your application on Tomcat from inside JDeveloper.
    And you can do remote debugging in JDeveloper to debug the application as it runs in the remote Tomcat instance.
    More information is in the online help.

  • Help With Integrating Servlet and JSP Page?

    Hello There
    --i made jsp page that contain name and description fields and add button
    --and i made servlet that contain the code to insert name and description in the database
    --and i want to make that when the user hit the add button
    -->the entered name and description is sent to the servlet
    and the servlet sent them to database?
    here's what i 've done:
    the jsp code:
    <html:html locale="true">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>
            Categories Page
           </title>
            <html:base/>
        </head>
        <body style="background-color: white">
        <form action="jpage.jsp" method="get">
            <h1>
                <center>
    categories Operations
                </center>
            </h1>
            <h3>
                 <label>Name</label>
            <input type="text" name="name" value="" size="10" />
                 <label>Description</label>
             <input type="text" name="description" value="" size="10" />
             <input type="submit" value="Add" name="button" />
           </h3>
       </form>
        </body>
    </html:html>the servlet code:
    import java.io.*;
    import java.util.Enumeration;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.net.*;
    class NewServlet1 extends HttpServlet{
         Connection conn;
         private ServletConfig config;
    public void init(ServletConfig config)
      throws ServletException{
         this.config=config;
    public void service (HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException {
       HttpSession session = req.getSession(true);
       res.setContentType("text/html");
    try{
         Class.forName("com.mysql.jdbc.Driver");
       conn = DriverManager.getConnection("jdbc:mysql://localhost/struts", "root", "");
         PreparedStatement ps;
       ps = conn.prepareStatement ("INSERT INTO categories (Name, Description) VALUES(?,?)");
          ps.setString (1, "aa");
          ps.setString (3, "bb");
          ps.executeUpdate();
          ps.close();
          conn.close();
      }catch(Exception e){ e.getMessage();}
      public void destroy(){}
    }

    The JSP Code:
    <html:html locale="true">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>
            Categories Page
           </title>
            <html:base/>
        </head>
        <body style="background-color: white">
        <form action="actionServlet.do?action=Additem" method="*post*">
            <h1>
                <center>
    categories Operations
                </center>
            </h1>
            <h3>
                 <label>Name</label>
            <input type="text" name="name" value="" size="10" />
                 <label>Description</label>
             <input type="text" name="description" value="" size="10" />
             <input type="button" value="Submit">
           </h3>
       </form>
        </body>
    </html:html>The Servlet Code:
    import java.io.*;
    import java.util.Enumeration;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.net.*;
    public class NewServlet1 extends HttpServlet implements SingleThreadModel {
        public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException {
            doPost(request,response);
        public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException {
              String action = request.getParameter("action"); // action = "Additem"
              if (action.equals("Additem")) {
                   String name = request.getParameter("name");
                   String description = request.getParameter("description");
                         RequestDispatcher reqDisp = null;
                   try{
                  Connection conn;
                  PreparedStatement ps;
         Class.forName("com.mysql.jdbc.Driver");
       conn = DriverManager.getConnection("jdbc:mysql://localhost/struts", "root", "");
       ps = conn.prepareStatement ("INSERT INTO categories (Name, Description) VALUES(?,?)");
          ps.setString (1, name);
          ps.setString (3, description);
          ps.executeUpdate();
          ps.close();
          conn.close();
          reqDisp= request.getRequestDispatcher("./index.jsp");
          reqDisp.forward(request, response);
                   catch (Exception ex){
                        System.out.println("Error: "+ ex);
    }The web.xml code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
        <servlet>
            <servlet-name>action</servlet-name>
            <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
            <init-param>
                <param-name>config</param-name>
                <param-value>/WEB-INF/struts-config.xml</param-value>
            </init-param>
            <init-param>
                <param-name>debug</param-name>
                <param-value>2</param-value>
            </init-param>
            <init-param>
                <param-name>detail</param-name>
                <param-value>2</param-value>
            </init-param>
            <load-on-startup>2</load-on-startup>
            </servlet>
        <servlet>
            <servlet-name>NewServlet1</servlet-name>
            <servlet-class>NewServlet1</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>action</servlet-name>
            <url-pattern>*.do</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>NewServlet1</servlet-name>
            <url-pattern>/NewServlet1</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
            </welcome-file-list>
            <servlet>
         <servlet-name>actionServlet</servlet-name>
         <servlet-class>com.test.servlet.NewServlet1</servlet-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>actionServlet</servlet-name>
         <url-pattern>*.do</url-pattern>
    </servlet-mapping>
        </web-app>

  • Regarding  CSS and CLASS TAG.

    Hi Java People,
    I am basicaly an ABAPer , can anyone please tell me where is are attributes of the Tag CLASS defined in an HTML page?
    Basically i am working on BSP where we have to use Javascript along with ABAP.
    In the layout part of BSP i am not able to find the definition of the CLASS tag.
    Thanks in advance.
    Regards,
    Vevek.

    Dear Vivek,
                      This is the following example where you can use the CSS and JSP togeather...
    http://www.w3schools.com/css/tryit.asp?filename=trycss_background-color
    http://www.w3schools.com/css/css_examples.asp
    Jsp Examples to use CSS in Class Tags:
    <table class="table_bdr">
                        <tr>
                     <td class="datatxt">
                     <td><input type="text" name="assoid" value="" size="10" class="inputText_Full" /></td>
    Reward Points if useful

  • Css and RequestDispatcher problem

    I'm using JBoss + embedded Tomcat (not using apache
    yet in development).
    I have problem with JSP and css. My JSP includes css
    with this tag:
    <link rel="stylesheet" href="style.css" type="text/css">If I access the JSP directly from web-browser IE5
    to http://127.0.0.1:8080/myContext/fileName.jsp ,
    it's displayed correctly.
    However, if I let a servlet dispatch the JSP, the css didn't
    included somehow (browser displayed the JSP without css-formatting).
    RequestDispatcher dispatcher = getServletContext().
                             getRequestDispatcher("/fileName.jsp");
        if (dispatcher != null)
            dispatcher.forward(request, response);
        /* ... */I put css and JSP in the same subdir. Is this a Tomcat error, or
    I forgot to set something in the request object, or
    I need to append something to "/fileName.jsp"?
    Thanks in advance.
    Verdi

    Unfortunately, the solution I found was to "hardcode" the absolute path. For example:<link rel="stylesheet" href="<%= request.getContextPath() %>/style.css" type="text/css">There're another way I think may preserve the context
    path, that is to use response.sendRedirect. Problem with
    this approach is however, you can't embedd javabean
    as "attribute" cause attribute will be removed in the new request (of redirected jsp).
    -- Verdi March --

  • CSS difference in Integrated Weblogic and Development Server

    I'm using JDeveloper 11.1.1.2.0
    I noticed that when i was developing in my Integrated WLS, CSS and inline Styles was just working the way it was showing up when i was running tests on my app.
    But the moment it was deployed in a development server, inline styles started getting "messed" up. To be exact, a panelBox header element, began aligning in center even though i never declared an inline style nor a CSS to modify it.
    I'm not very familiar with Application Server configurations, but i'd like to be pointed in the right direction where i could try to investigate with regards to this matter.
    if there are other information i could add in this thread please let me know.
    Thank you.

    A separate forums seems to have cleared this issue.
    Re: CSS in ADF Question
    Edited by: Mar Vince Reyes on Sep 22, 2010 5:48 AM

  • 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

  • WL vs. WL-express and JSP vs. javascript/SQL

    folks-
    i am trying to convince a certain party to
    disband a web-based job tracking system being
    written in ASP, javascript, html, css and SQL.
    it will be hosted on MS webserver running NT.
    i am trying to convince them to use JSP and
    WL express. i have done two years of EJB
    component work on weblogic, however, i have not
    done work with JSP or thin-clients. i was mostly
    business-logic.
    anyway i have some questions and need some
    direction. i already know JSP is better than
    ASP/javascript etc. because:
    * ASP is proprietary. ditto for VBscript
    * with an IDE creating JSP is easy and JSP
    automatically creates servlets which is way
    faster than by hand
    * JSP is JAVA based and hence benefits from
    all the portability pluses of JAVA
    but here are the more difficult questions:
    * why is WL express better than an MS
    web server? (not including WL market share
    and size. after all MS can claim that)
    * since WL express does not have an EJB
    container, how do you access the database?
    via JDBC? does one just have JDBC code
    floating around?
    * since there is no EJB container how does
    one separate presentation from logic from
    data access? this is a major downside of
    javascript, html, css and SQL etc.
    * if a web app grows beyond JSP with WL express
    into the need for an EJB container, i would
    think that most of the app needs to re-written
    as business-logic must be refactored into EJBs
    and all JDBC code will be replaced by container
    managed beans. this sounds a like a lot of
    rework.
    * isn't JSP slower than javascript as the
    servlet and hmtl code is bounced back and
    force across the network?
    with respect to architecture, scalability,
    and robustness what are the downsides to an
    MS webserver and non-JSP coding?

    * since WL express does not have an EJB
    container, how do you access the database?
    via JDBC? does one just have JDBC code
    floating around?
    Use JDO or an OR-mapper or embed JDBC into your own data access classes.
    * since there is no EJB container how does
    one separate presentation from logic from
    data access? this is a major downside of
    javascript, html, css and SQL etc.
    Presentation=JSP
    Logic=Servlet
    Data access=JDO or similar
    * if a web app grows beyond JSP with WL express
    into the need for an EJB container, i would
    think that most of the app needs to re-written
    as business-logic must be refactored into EJBs
    and all JDBC code will be replaced by container
    managed beans. this sounds a like a lot of
    rework.
    You should be able to tell up front if it a tx-intensive app that requires
    WLS.
    * isn't JSP slower than javascript as the
    servlet and hmtl code is bounced back and
    force across the network?
    They aren't exclusive. For dynamic pages, use Javascript on the front end,
    JSP on the back.
    * with respect to architecture, scalability,
    and robustness what are the downsides to an
    MS webserver and non-JSP coding?
    In the real world, and for most apps, while Java has the architectural edge,
    they both have similar scalability and similar robustness. MS gives you no
    choice though, and you rewrite every time they see a new buzzword. You can't
    leave MS-land without abandoning almost everything. You can leave WLS in a
    week if you have to.
    It's an investment. Invest wisely.
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    Clustering Weblogic? You're either using Coherence, or you should be!
    Download a Tangosol Coherence eval today at http://www.tangosol.com/
    "shane miller" <[email protected]> wrote in message
    news:[email protected]...
    folks-
    i am trying to convince a certain party to
    disband a web-based job tracking system being
    written in ASP, javascript, html, css and SQL.
    it will be hosted on MS webserver running NT.
    i am trying to convince them to use JSP and
    WL express. i have done two years of EJB
    component work on weblogic, however, i have not
    done work with JSP or thin-clients. i was mostly
    business-logic.
    anyway i have some questions and need some
    direction. i already know JSP is better than
    ASP/javascript etc. because:
    * ASP is proprietary. ditto for VBscript
    * with an IDE creating JSP is easy and JSP
    automatically creates servlets which is way
    faster than by hand
    * JSP is JAVA based and hence benefits from
    all the portability pluses of JAVA
    but here are the more difficult questions:
    * why is WL express better than an MS
    web server? (not including WL market share
    and size. after all MS can claim that)
    * since WL express does not have an EJB
    container, how do you access the database?
    via JDBC? does one just have JDBC code
    floating around?
    * since there is no EJB container how does
    one separate presentation from logic from
    data access? this is a major downside of
    javascript, html, css and SQL etc.
    * if a web app grows beyond JSP with WL express
    into the need for an EJB container, i would
    think that most of the app needs to re-written
    as business-logic must be refactored into EJBs
    and all JDBC code will be replaced by container
    managed beans. this sounds a like a lot of
    rework.
    * isn't JSP slower than javascript as the
    servlet and hmtl code is bounced back and
    force across the network?
    with respect to architecture, scalability,
    and robustness what are the downsides to an
    MS webserver and non-JSP coding?

  • Facing problem in integrating my custom jsp with the workflow engine

    Hi,
    I am using Jdeveloper 11.1.1.6.0 for BPM 11g implementation on my Application.I have Weblogic Server 10.3 Installed and configured the domain. Also the server is up and running.
    I am trying to create workflow and wants to integrate it with my custom jsp but i am facing problem in integrating my custom jsp with the workflow engine.Can you please answer the following questions:
    1)how to link BPM human task with my custom jsp (Requester jsp).
    2)how my custom jsp data(Requester data) will be stored in workflow engine and how the same data will be visible to the next custom jsp(Reviewer jsp).
    This is urgent .Any early reply will be great help.
    Thanks in advance.
    Edited by: 990133 on Mar 24, 2013 5:31 AM

    you forgot to add the usage dependency in the DC metadata section in your DC, you have to add the XSS~utils and fpm as a used DC's as part of your DC, try to add those, if you already done that, so check where missed the adding of used webdynpro components in any of the VAC's or FC's,
    Cheer,
    Appa

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

  • Cannot start SAP XI - Integration Respository and Directory

    Dear Expert,
    Some of developers cannot start Integration repository and directory at his/her client. It still running after logon with "PISUPER" user.
    Do I missing some necessary applications on the clients?
    Please advise.
    Thank and regards,

    Thanks for your answer, Alexander Bruch,
    I think the host name is no problem because the Integration Builder page can be started with URL "http://iwdfvm2160:51000/rep/start/index.jsp" and also prompt me the logon window.  But after input the user/password, normally is PISUPER, the logon window is running for a long time, nothing happen.
    We also using user PISUPER and it's fine with another laptop.
    Regards,
    Kobsak

  • Advice on integrating Flash and HTML

    I have googled and researched this topic on the web.
    Integrating Flash and HTML seems like a popular topic but much of
    the information is dated (using FS commands or solutions based on
    2000-2004 coding and/or hacks) I am using Flash CS3 and Dreamweaver
    CS3. I can use Actionscript 2 or Actionscript 3. Here is my goal
    I want to use a Flash navigation in the top third of my page
    and have it control and load new HTML pages in the bottom two
    thirds of the page. Some of these html pages use SPRY code but most
    are simple HTML pages. I prefer Flash over CSS because I have more
    control and predictability. What I have found so far is three
    different solutions.
    1.HTML Framesets. This seems like a really good idea but I
    thought using framesets was a fading technique and should be
    avoided. Is this true?
    2. Using the ExternalInterface class to communicate between
    Javascript and Actionscript. This also seemed like a good idea but
    it is not clear to me how to implement. Do I combine this with
    innerHTML or some type of AJAX technique.
    3. Keep everything in Flash and load different swfs into main
    Flash page. I like this idea the best and it would work for most
    pages but I still like html pages when there is alot of text or I
    want to use SPRY techniques.
    When I have posted elsewhere I get references to articles
    telling me why Flash is bad or framesets are bad or innerHTML is
    not standard HTML. The only thing I am sure about is that most
    people are pretty passionate about defending their own way of doing
    things. I am hoping someone can provide some solid information
    about what is possible and how to implement a solution.

    It works when you put it online... :)1

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

  • CSS and Wordpress

    I have integrated a wordpress blog into an existing website. So besides creating the index.php, header.php, footer.php, functions.php, sidebar.php and comments.php, there is the style.css and it links to external style sheets on the site. My problem is adjusting the css now that the theme is activated. The hyperlinks in the blog post content area and sidebar widget area are a light grey (I believe #ccc) but I want to change them to appear in black (#000). I have addressed this in the style.css and the mainBlog.css but nothing seems to be working to get those links changed. Am I missing something?
    The site is: www.jillgrovemezzo.com/wordpress
    Regina

    You have 2 instances of the CCM CSS linked. The last instance takes
    precedence so either remove one instance or edit the link styles in
    both. Also, if you updated to the latest version of CCM, your page would
    be automatically responsive.
    http://www.projectseven.com/support/updatepages/ccm.htm
    Al Sparber - PVII
    http://www.projectseven.com
    The Finest Dreamweaver Menus | Galleries | Widgets
    Since 1998

Maybe you are looking for