We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,548 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Adding css to JSP

Please let me know how to add css to a jsp page?

3
Contributors
9
Replies
1 Year
Discussion Span
3 Years Ago
Last Updated
14
Views
Question
Answered
jeetudaljit
Newbie Poster
16 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Exactly as to any other HTML based document, either use internal or external approach.

peter_budo
Code tags enforcer
Moderator
15,812 posts since Dec 2004
Reputation Points: 2,871
Solved Threads: 944
Skill Endorsements: 52

Exactly as to any other HTML based document, either use internal or external approach.

i used ....
<LINK href="style1.css" rel="stylesheet" type="text/css">


in <head> tags but it did't work. Plz help

jeetudaljit
Newbie Poster
16 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Incorrect order of tag elements, it should be as

<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>

also make sure their are in correct directory (in your case together with JSP document)

peter_budo
Code tags enforcer
Moderator
15,812 posts since Dec 2004
Reputation Points: 2,871
Solved Threads: 944
Skill Endorsements: 52

yes, I have rechecked. . Both files are in same directory.

here is css file

root { 
    display: block;
    font-size: 14px;
  font-style: italic;
  font-weight: normal;
  font-variant: normal;
  color: navy;
  background-color: #ccffcc;
  background-attachment: none;
  font-family: Georgia,'Times New Roman',times,serif;
}
jeetudaljit
Newbie Poster
16 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Can you please post the JSP file?

PS: Please use code tags here is small help

peter_budo
Code tags enforcer
Moderator
15,812 posts since Dec 2004
Reputation Points: 2,871
Solved Threads: 944
Skill Endorsements: 52
<html>
    <head>
          
          <LINK href="style1.css" rel="stylesheet" type="text/css">
       
        <title>JSP Page</title>
    </head>
    <body>
        
        <form>
         <h2>Hello World!</h2>
    </form>

    </body>
</html>
jeetudaljit
Newbie Poster
16 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Just did little bit of search on internet and seems to me there is more trouble with use of the root then you want to go through. Just replace it with html or html,body

peter_budo
Code tags enforcer
Moderator
15,812 posts since Dec 2004
Reputation Points: 2,871
Solved Threads: 944
Skill Endorsements: 52
Question Answered as of 4 Years Ago by peter_budo

Hi Peter.. This problem is solved as I made following changes in jsp
..

<form>
            <root>
            Welcome... To this style1.       
 </root></form>

Thanks a lot for ur help.

jeetudaljit
Newbie Poster
16 posts since Jul 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

you can add the following things inside the <head> tag

<meta http-equiv="Content-Style-Type" content="text/css">
<title> Home </title>
<html:base/>
<link HREF="../theme/screens.css" REL="stylesheet" TYPE="text/css" >
shahpraneel
Newbie Poster
1 post since Apr 2010
Reputation Points: 8
Solved Threads: 0
Skill Endorsements: 0

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page generated in 0.5558 seconds using 2.69MB