Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 761
  • Last Modified:

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

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
Lucinda08
Asked:
Lucinda08
1 Solution
 
eszaqCommented:

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

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now