This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes CSS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "CSS" Watch "CSS" New topic
Author

CSS

shaf maff
Ranch Hand

Joined: Sep 07, 2008
Posts: 180
Hi Guys

How can I manage CSS in JSP pages using the struts tag lib. Everytime I code a page and run it in browser all the html is at the top and all the tags are at the bottom. Its like I cannot mix the two. Why is this ?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You'll have to be more specific. CSS doesn't really have anything to do with Struts, so you'll need to explain (a) what you're trying to do, (b) how you're doing it, and (c) how the results vary from your expectations.

http://faq.javaranch.com/java/TellTheDetails

It saves everybody time.
shaf maff
Ranch Hand

Joined: Sep 07, 2008
Posts: 180
Ok - Here is the code:



As you can see, there is a tag above the "Contact Details" header and one below it. When I run it in the browser it should output as follows:



But instead the browser displays it as follows:




.
[ December 21, 2008: Message edited by: shaf maff ]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'm not sure what this has to do with CSS at all.

Are you using the "simple" theme or the default "xhtml" theme? I'm guessing "xhtml" theme. Have you examined the rendered HTML? That will provide you with a hint as to what's gone wrong.
shaf maff
Ranch Hand

Joined: Sep 07, 2008
Posts: 180
well since it was to do with the layout I assumed it was a css issue because the html was fine. I will play around with the themes and see if that works.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It'd have been quicker to tell me which theme you were using.

The "xhtml" theme renders form elements inside tables. If you're using the "xhtml" theme the snippet you posted would be invalid HTML, and different browsers would treat the invalid HTML in different ways.

I don't know if I believe you when you say that "the HTML was fine", because you didn't post the rendered HTML--considering how easy it is to cut-and-paste it'd be just as easy to cut-and-paste what's actually being emitted than to type something in that isn't complete.
 
jQuery in Action, 2nd edition
 
subject: CSS
 
Similar Threads
Servlet css file location
How CSS works for Images
Fontmetrics, Graphics
GWT and @keyframes
using css file in jsp along with tiles