You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by bj...@yahoo.com on 2005/08/25 21:07:27 UTC

CSS not working with JSF

I am having problem with JSF and CSS.
 
In my css I have
 
#linkMe:link {
  color: #C9C9C9;
}
#linkMe:visited {
  color: #C9C9C9;
}
#linkMe:hover, #linkMe:active { 
  text-decoration: none; 
  color: #C9C9C9;
}

In my JSP I have:
 
<f:verbatim>
    <h:outputLink styleClass="linkMe" value="#"><h:outputText value="click me"/></h:outputLink><br>    
</f:verbatim>
 
It is not using the css.  Any ideas?  Thanks
Bob


		
---------------------------------
 Start your day with Yahoo! - make it your home page 

Re: CSS not working with JSF

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Just a semi-on-topic aside... I believe the best approach is to use IDs 
as their name implies: as a unique ID for a given element, and use class 
to mark the element as using a given CSS class.  Unless you know you 
have a requirement to change a batch of elements together, and its a 
change that can't be made via CSS (i.e., content changes for a batch of 
DIVs), then this approach gives you maximum flexibility I believe.  That 
has been my experience anyway.

Frank

Ivan Rodriguez wrote:
> bjester_2004@yahoo.com escribió:
> 
>> Rick, classes seem to work.  Thank You.  But the requirement is to use 
>> ID.  May be I can convince my team.  I will go try Geeta's idea now to 
>> see how fun that is...:=)
>>  
>>
> Keep in mind that ID must be unique in the same HTML page. You can`t 
> write for example, 2 links <A> with the same ID.
> ( XHTML mode of course)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: [OT] RE: CSS not working with JSF

Posted by "David G. Friedman" <hu...@ix.netcom.com>.
You should join us over at the myfaces.apache.org
user list to discuss JSF.

Regards,
David

-----Original Message-----
From: Mark Benussi [mailto:mark_benussi@hotmail.com]
Sent: Saturday, August 27, 2005 4:19 AM
To: 'Struts Users Mailing List'
Subject: [OT] RE: CSS not working with JSF


This is a Struts discussion list, not JSF.

-----Original Message-----
From: Ivan Rodriguez [mailto:ivan@interd4u.com]
Sent: 26 August 2005 07:12
To: Struts Users Mailing List
Subject: Re: CSS not working with JSF

bjester_2004@yahoo.com escribió:

>Rick, classes seem to work.  Thank You.  But the requirement is to use ID.
May be I can convince my team.  I will go try Geeta's idea now to see how
fun that is...:=)
>
>
Keep in mind that ID must be unique in the same HTML page. You can`t
write for example, 2 links <A> with the same ID.
( XHTML mode of course)

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


[OT] RE: CSS not working with JSF

Posted by Mark Benussi <ma...@hotmail.com>.
This is a Struts discussion list, not JSF.

-----Original Message-----
From: Ivan Rodriguez [mailto:ivan@interd4u.com] 
Sent: 26 August 2005 07:12
To: Struts Users Mailing List
Subject: Re: CSS not working with JSF

bjester_2004@yahoo.com escribió:

>Rick, classes seem to work.  Thank You.  But the requirement is to use ID.
May be I can convince my team.  I will go try Geeta's idea now to see how
fun that is...:=)
>  
>
Keep in mind that ID must be unique in the same HTML page. You can`t 
write for example, 2 links <A> with the same ID.
( XHTML mode of course)

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: CSS not working with JSF

Posted by Ivan Rodriguez <iv...@interd4u.com>.
bjester_2004@yahoo.com escribió:

>Rick, classes seem to work.  Thank You.  But the requirement is to use ID.  May be I can convince my team.  I will go try Geeta's idea now to see how fun that is...:=)
>  
>
Keep in mind that ID must be unique in the same HTML page. You can`t 
write for example, 2 links <A> with the same ID.
( XHTML mode of course)

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: CSS not working with JSF

Posted by bj...@yahoo.com.
Rick, classes seem to work.  Thank You.  But the requirement is to use ID.  May be I can convince my team.  I will go try Geeta's idea now to see how fun that is...:=)

Rick Reumann <st...@reumann.net> wrote:
bjester_2004@yahoo.com wrote the following on 8/25/2005 3:29 PM:

> I know that this is wrong. It should be click me and I do not know how to make jsf to do it.

Oh I should have caught that you were using ids vs classes. For testing 
why not make you 'id' a class attribute in your style sheet just to see 
if it works?

use .linkMe in your css (vs #) and see if it works.

-- 
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: CSS not working with JSF

Posted by Rick Reumann <st...@reumann.net>.
bjester_2004@yahoo.com wrote the following on 8/25/2005 3:29 PM:

> I know that this is wrong.  It should be <a href="#" id="linkMe">click me</a>  and I do not know how to make jsf to do it.

Oh I should have caught that you were using ids vs classes. For testing 
why not make you 'id' a class attribute in your style sheet just to see 
if it works?

use .linkMe in your css (vs #) and see if it works.

-- 
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: CSS not working with JSF

Posted by gr...@intellicare.com.
<bj...@yahoo.com> wrote on 08/25/2005 03:29:57 PM:

> here is my html source:
> 
> <html>
>   <head>
>     <link href="pages/site.css" type="text/css" rel="stylesheet" 
> media="screen">
>     <title>Test JSF and Shale</title>
>   </head> 
>   <body>
>     jsf link test: <a href="#" class="linkMe">click me</a>
>   </body>
> </html>
> 
> I know that this is wrong.  It should be <a href="#" 
> id="linkMe">click me</a>  and I do not know how to make jsf to do it.

Well, did you try the code I gave you earlier? This is just what I was 
struggling with and finally the code I posted earlier worked. Here it is 
again:
<link rel="stylesheet" href="<h:outputText value
="#{facesContext.externalContext.requestContextPath}/layout/style.html" />
" />

You will have to change /layout/style.html to (I suppose) 
/pages/site.css..

give it a shot!
Geeta 

Re: CSS not working with JSF

Posted by bj...@yahoo.com.
here is my html source:
 
<html>
  <head>
    <link href="pages/site.css" type="text/css" rel="stylesheet" media="screen">
    <title>Test JSF and Shale</title>
  </head>  
  <body>
    jsf link test: <a href="#" class="linkMe">click me</a>
  </body>
</html>
 
I know that this is wrong.  It should be <a href="#" id="linkMe">click me</a>  and I do not know how to make jsf to do it.


gramani@intellicare.com wrote:
wrote on 08/25/2005 03:19:07 PM:

> Here is my include:
> 
> 
> 
> media="screen">
> 

How does the source for the stuff look like? As Rick says it is 
possible your stylesheet isn't being found..

Geeta

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: CSS not working with JSF

Posted by gr...@intellicare.com.
<bj...@yahoo.com> wrote on 08/25/2005 03:19:07 PM:

> Here is my include:
> 
> <head>
>     <link href="pages/site.css" type="text/css" rel="stylesheet" 
> media="screen">
>   </head> 

How does the source for the <head> stuff look like? As Rick says it is 
possible your stylesheet isn't being found..

Geeta

Re: CSS not working with JSF

Posted by bj...@yahoo.com.
Here is my include:
 
<head>
    <link href="pages/site.css" type="text/css" rel="stylesheet" media="screen">
  </head> 
 
here is the generated source:
 
<a href=""  value="" class="linkMe" jsp:id="C:/Projects/JsfShale/WebContent/pages/main.jsp:47:6">click me</a>

Rick Reumann <st...@reumann.net> wrote:
bjester_2004@yahoo.com wrote the following on 8/25/2005 3:07 PM:
> I am having problem with JSF and CSS.
> 
> In my css I have
> 
> #linkMe:link {
> color: #C9C9C9;
> }
> #linkMe:visited {
> color: #C9C9C9;
> }
> #linkMe:hover, #linkMe:active { 
> text-decoration: none; 
> color: #C9C9C9;
> }
> 
> In my JSP I have:
> 
> 
> 

> 

Does the generated source code look correct? Are you sure you didn't 
forget to import the css file?

-- 
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


		
---------------------------------
 Start your day with Yahoo! - make it your home page 

Re: CSS not working with JSF

Posted by Rick Reumann <st...@reumann.net>.
bjester_2004@yahoo.com wrote the following on 8/25/2005 3:07 PM:
> I am having problem with JSF and CSS.
>  
> In my css I have
>  
> #linkMe:link {
>   color: #C9C9C9;
> }
> #linkMe:visited {
>   color: #C9C9C9;
> }
> #linkMe:hover, #linkMe:active { 
>   text-decoration: none; 
>   color: #C9C9C9;
> }
> 
> In my JSP I have:
>  
> <f:verbatim>
>     <h:outputLink styleClass="linkMe" value="#"><h:outputText value="click me"/></h:outputLink><br>    
> </f:verbatim>

Does the generated source code look correct? Are you sure you didn't 
forget to import the css file?

-- 
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: CSS not working with JSF

Posted by bj...@yahoo.com.
I would liek it also if please:  bjester_2004@yahoo.com

Rick Reumann <st...@reumann.net> wrote:gramani@intellicare.com wrote the following on 8/25/2005 3:26 PM:
> 
> - right now I'm *finally* getting tiles to play nice with JSF/Shale so am 
> too excited to do much else than play with the app, adding links in 
> menu.jsp, images in layout.jsp... ah, heaven..!..:))

Care to email me the app zipped up so I can learn from it:) (rick at 
reumann.net preferably).

-- 
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



		
---------------------------------
 Start your day with Yahoo! - make it your home page 

[Shale] Shale with Tiles web app example - was CSS not working with JSF

Posted by gr...@intellicare.com.
Hi Rick, bjester, anyone else who's interested:

As promised, I have uploaded a very trivial app which integrates Shale and 
Tiles using the new code which David Geary committed a couple of days back 
(btw, I built the jars here using the source from a couple of days back.. 
so am not sure if they are different from what's available now..):

http://www.sightsoftware.com/shale/

Please note that I am a complete newbie at this whole Shale thing so it is 
perhaps best not to learn any Shale using this app..:) 

Also, you will doubtless find better ways of doing almost everything I've 
done.  All comments and suggestions will be gratefully received.

Thanks!
Geeta

Re: CSS not working with JSF

Posted by gr...@intellicare.com.
Rick Reumann <st...@reumann.net> wrote on 08/25/2005 03:35:06 PM:
> 
> Care to email me the app zipped up so I can learn from it:) (rick at 
> reumann.net preferably).
> 

Absolutely!.. But I do have to clean out all the test1.jsp, 
test2.jsp,...test567.jsp... first..;) Plus do a *final* check and see i'm 
not realy fooling myself..:) 

But in the meantime I have to drive down to Boston in about 15 miuntes. So 
you will get this I'd say sometime tomorrow..:)

> -- 
> Rick
> 

Geeta

Re: CSS not working with JSF

Posted by Rick Reumann <st...@reumann.net>.
gramani@intellicare.com wrote the following on 8/25/2005 3:26 PM:
>  
> - right now I'm *finally* getting tiles to play nice with JSF/Shale so am 
> too excited to do much else than play with the app, adding links in 
> menu.jsp, images in layout.jsp... ah, heaven..!..:))

Care to email me the app zipped up so I can learn from it:) (rick at 
reumann.net preferably).

-- 
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: CSS not working with JSF

Posted by gr...@intellicare.com.
Neil Erdwien <ne...@k-state.edu> wrote on 08/25/2005 03:22:23 PM:

> Beware that some browsers won't use stylesheets if they aren't sent by 
> the server as "text/css".  I don't know authoritatively which ones, but 
> I think Firefox and IE *in strict mode*, require text/css.
> 

Thanks for the warning! But Firefox must be ok with that since that's what 
i'm using..:) But you are right, I will need to get to the bottom of this 
- right now I'm *finally* getting tiles to play nice with JSF/Shale so am 
too excited to do much else than play with the app, adding links in 
menu.jsp, images in layout.jsp... ah, heaven..!..:))

Geeta

Re: CSS not working with JSF

Posted by Neil Erdwien <ne...@k-state.edu>.
Beware that some browsers won't use stylesheets if they aren't sent by 
the server as "text/css".  I don't know authoritatively which ones, but 
I think Firefox and IE *in strict mode*, require text/css.


gramani@intellicare.com wrote:
> Hi Bob, I think I solved my style sheet problem something like 2 minutes 
> ago.. :) 
> 
> So assuming yours is the same problem..
> 
> Here's how I declared my stylesheet up top of my layout.jsp:
> <link rel="stylesheet" href="<h:outputText value
> ="#{facesContext.externalContext.requestContextPath}/layout/style.html" />
> " />
> 
> (I changed my style sheet name from .css to .html because of (I think) new 
> access rules with my new Tomcat 5.5.9 and I really can't be bothered 
> looking into that now. So you may not have to do that..)

-- 
Neil Erdwien, neil@k-state.edu, Web Technologies Manager
Computing and Network Services, Kansas State University

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts-Tiles Design question

Posted by Michael Rasmussen <ra...@gmail.com>.
Dilip,
The tiles controller sounds like an interesting way to do it, but I
have never used it.  I agree with Nels that you should stay away from
a JSP implementation of this.  I have stretched tiles pretty far as to
what it can do conditionally, and I have been very happy with it.  I
would suggest using an action to make decisions about where to go, and
use tiles templates to put the right fragments in the right places.

Michael

On 8/25/05, Nels Overgaard-Cook <ne...@gmail.com> wrote:
> If you put the business logic in the JSPs, then it seems to me that you're
> essentially mixing the business and presentation layers. I would put the
> business login in an action and figure out which tile to forward to from
> there. Of course, I haven't used the Tiles Controller that Greg suggested...
> 
> Nels
> 
> On 8/25/05, Dilip Ladhani <di...@hotmail.com> wrote:
> >
> > I have an application built on struts and tiles. I have a design question
> > and would like some of your valuable opinions.
> >
> > I have a huge jsp, which is broken into many includes, say abc.jsp and
> > includes one.jsp, two.jsp etc.
> > As, I mentioned I use tiles so in the config file, I have a forward
> > element,
> > which is like this
> > <forward name="abc" path="abc" contextRelative="true"/>
> >
> > The "abc" is defined in the tiles as
> > <put name="body-content" value="/abc.jsp" />
> >
> > Now for the design question...
> > I am going to have to switch the includes (one.jsp, two.jsp etc) based on
> > some business rules like the geographical area, app type etc.
> >
> > 1) Should I just put this logic in the jsp (using if statements like :if
> > apptype = "A" use one.jsp else use one-next.jsp etc) or
> > 2)Should I use tiles by having different action mappings based on
> > different
> > business parameters(say app type) and have each mapping forward to a
> > different "forward" defined in tiles-def.
> >
> > Also the business parameters (based on which jsp is selected) may change
> > in
> > the future.
> >
> > Thanks for your input
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts-Tiles Design question

Posted by Nels Overgaard-Cook <ne...@gmail.com>.
If you put the business logic in the JSPs, then it seems to me that you're 
essentially mixing the business and presentation layers. I would put the 
business login in an action and figure out which tile to forward to from 
there. Of course, I haven't used the Tiles Controller that Greg suggested...

Nels

On 8/25/05, Dilip Ladhani <di...@hotmail.com> wrote:
> 
> I have an application built on struts and tiles. I have a design question
> and would like some of your valuable opinions.
> 
> I have a huge jsp, which is broken into many includes, say abc.jsp and
> includes one.jsp, two.jsp etc.
> As, I mentioned I use tiles so in the config file, I have a forward 
> element,
> which is like this
> <forward name="abc" path="abc" contextRelative="true"/>
> 
> The "abc" is defined in the tiles as
> <put name="body-content" value="/abc.jsp" />
> 
> Now for the design question...
> I am going to have to switch the includes (one.jsp, two.jsp etc) based on
> some business rules like the geographical area, app type etc.
> 
> 1) Should I just put this logic in the jsp (using if statements like :if
> apptype = "A" use one.jsp else use one-next.jsp etc) or
> 2)Should I use tiles by having different action mappings based on 
> different
> business parameters(say app type) and have each mapping forward to a
> different "forward" defined in tiles-def.
> 
> Also the business parameters (based on which jsp is selected) may change 
> in
> the future.
> 
> Thanks for your input
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

Re: Struts-Tiles Design question

Posted by Greg Reddin <gr...@fnf.com>.
On Aug 25, 2005, at 3:15 PM, Dilip Ladhani wrote:

> I have an application built on struts and tiles. I have a design 
> question and would like some of your valuable opinions.
>
> I have a huge jsp, which is broken into many includes, say abc.jsp and 
> includes one.jsp, two.jsp etc.
> As, I mentioned I use tiles so in the config file, I have a forward 
> element, which is like this
> <forward name="abc" path="abc" contextRelative="true"/>
>
> The "abc" is defined in the tiles as
> <put name="body-content" value="/abc.jsp" />
>
> Now for the design question...
> I am going to have to switch the includes (one.jsp, two.jsp etc) based 
> on some business rules like the geographical area, app type etc.
>
> 1) Should I just put this logic in the jsp (using if statements like 
> :if apptype = "A" use one.jsp else use one-next.jsp etc) or

You should probably stay away from this if possible.

Have you looked at the Tiles Controller interface?  You might be able 
to put your business logic in a controller class.  The ComponentContext 
is passed into the controller and you can set attribute values, etc.

Greg


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Struts-Tiles Design question

Posted by Dilip Ladhani <di...@hotmail.com>.
I have an application built on struts and tiles. I have a design question 
and would like some of your valuable opinions.

I have a huge jsp, which is broken into many includes, say abc.jsp and 
includes one.jsp, two.jsp etc.
As, I mentioned I use tiles so in the config file, I have a forward element, 
which is like this
<forward name="abc" path="abc" contextRelative="true"/>

The "abc" is defined in the tiles as
<put name="body-content" value="/abc.jsp" />

Now for the design question...
I am going to have to switch the includes (one.jsp, two.jsp etc) based on 
some business rules like the geographical area, app type etc.

1) Should I just put this logic in the jsp (using if statements like :if 
apptype = "A" use one.jsp else use one-next.jsp etc) or
2)Should I use tiles by having different action mappings based on different 
business parameters(say app type) and have each mapping forward to a 
different "forward" defined in tiles-def.

Also the business parameters (based on which jsp is selected) may change in 
the future.

Thanks for your input



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: CSS not working with JSF

Posted by gr...@intellicare.com.
Hi Bob, I think I solved my style sheet problem something like 2 minutes 
ago.. :) 

So assuming yours is the same problem..

Here's how I declared my stylesheet up top of my layout.jsp:
<link rel="stylesheet" href="<h:outputText value
="#{facesContext.externalContext.requestContextPath}/layout/style.html" />
" />

(I changed my style sheet name from .css to .html because of (I think) new 
access rules with my new Tomcat 5.5.9 and I really can't be bothered 
looking into that now. So you may not have to do that..)

Once I did this, something like this worked:
<h:panelGrid columns="3" columnClasses="header">

with proper "class" stuff in the <tds...

Hope this helps,
Geeta

<bj...@yahoo.com> wrote on 08/25/2005 03:07:27 PM:

> I am having problem with JSF and CSS.
> 
> In my css I have
> 
> #linkMe:link {
>   color: #C9C9C9;
> }
> #linkMe:visited {
>   color: #C9C9C9;
> }
> #linkMe:hover, #linkMe:active { 
>   text-decoration: none; 
>   color: #C9C9C9;
> }
> 
> In my JSP I have:
> 
> <f:verbatim>
>     <h:outputLink styleClass="linkMe" value="#"><h:outputText 
> value="click me"/></h:outputLink><br> 
> </f:verbatim>
> 
> It is not using the css.  Any ideas?  Thanks
> Bob
> 
> 
> 
> ---------------------------------
>  Start your day with Yahoo! - make it your home page 
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> 

> 
> CONFIDENTIALITY NOTICE:This email is intended solely for the person 
> or entity to which it is addressed and may contain confidential 
> and/or protected health information.  Any duplication, 
> dissemination, action taken in reliance upon, or other use of this 
> information by persons or entities other than the intended recipient
> is prohibited and may violate applicable laws.  If this email has 
> been received in error, please notify the sender and delete the 
> information from your system.  The views expressed in this email are
> those of the sender and may not necessarily represent the views of 
> IntelliCare.