Solved

how can i call my stylesheet file from anywhere in my jsp to display the data in my servlet

Posted on 2008-10-22
1
753 Views
Last Modified: 2013-11-24
how can i call my stylesheet file from anywhere in my jsp to display the data in my servlet---

this is a snipet of code in my index.jsp page my stylesheet is in my WEB-INF foldercalled mystyle....my servlet is propertycontroller and the table i want to use stylesheet in has been created in the servlet...im not sure im placing the code in the right place ......help
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"

    pageEncoding="ISO-8859-1"%>
 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml.dtd">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Welcome to Lucinda's Estate Agency</title>

</head>

<body>
 

<h1>Lucinda's Estate Agency  <img src="images/mestonLogo.jpg" alt="Meston Movies" /></h1>

 <h3>If we don't have it, then it's not worth waiting for</h3>

 
 

<p><a href="PropertyController?action=list" <%=request.getContextPath()%>/WEB-INF/mystyle.css" type="text/css" rel="stylesheet">List of Properties</a></p>
 

<input name="person" type="textfield"/>

<input name="submit" type="submit" value="say hello"/>

</form></p>
 

</body>

</html>

Open in new window

0
Comment
Question by:Lucinda08
1 Comment
 
LVL 8

Accepted Solution

by:
eszaq earned 500 total points
ID: 22783423

You are trying to mix together two completely different ways of using style sheets: external and embedded. You cannot do this.

Either call external css from your HTML <head>, one of two ways:
<style type="text/css">@import url("<%=request.getContextPath()%>/WEB-INF/mystyle.css");</style>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/WEB-INF/mystyle.css" />

Either use inline styles, if you want to apply styles to this one specific <a> tag.:
<a href="PropertyController?action=list" style="custom declarations - static OR <%  - dynamically generated if you wish %>">

Read this:
http://webdesign.about.com/od/css/qt/aatypesofcss.htm
http://webdesign.about.com/od/beginningcss/f/css_import_link.htm
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Centering a nested div 16 58
Can't get the PDF Icon to appear on the webpage 1 21
.php tree directory? 5 56
P tag not forcing line space 2 23
When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now