aspose file tools*
The moose likes JSF and the fly likes adding image with h:messages tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "adding image with h:messages tag" Watch "adding image with h:messages tag" New topic
Author

adding image with h:messages tag

valiant bhardwaj
Greenhorn

Joined: Oct 30, 2008
Posts: 1
I am trying to put an image in front of error messages.

I am setting the error messages in my bean class(using facesContext and displaying that in jsp file using h:message tag.
ralph soika
Greenhorn

Joined: Jun 05, 2008
Posts: 11
Hi,

did you find a solution for this problem?
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
I don't think that he will respond sooner or later.

Why don't you just start your own topic wherein you elaborate the problem in detail so that others can help you? This way you get more chance on help than only asking it to one specific person who may not have any moderate knowledge about this.
Hatem Alimam
Ranch Hand

Joined: Dec 14, 2008
Posts: 30
Hi,
I had this issue before and I solve it in this way ,

<h:messages infoStyle="background-image:url(D:/yourImage.JPG);"/>

here in my example this style for infoStyle ... you can customize it like this fatalStyle ="background-image:url(D:/yourImage.JPG);".

and you have to make the right speace in the image to let the message to be displayed I mean you have to desgin the image right.

In other words If you want to display like X image , you have to make the image with this X and proper space for the message text.
in my case I knew the messages what they'll display so , I solved it in this way .
Best regards.


SCJP 5.0, SCWCD 1.4, SCBCD 3.0 with 100 score
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
The idea is good, but the example is bad. Local file system paths aren't going to work when the client runs at a different machine than the server. You should use URL's. The property name even states "background-url".
[ December 14, 2008: Message edited by: Bauke Scholtz ]
ralph soika
Greenhorn

Joined: Jun 05, 2008
Posts: 11
Hi,

thanks for the tip with the message infoStyle.
No bad idea :-)
I think I will try this solution.
But I wonder that there is no additional feature in JSF available to solve such a problem. As I understood it is also impossible to use path trough HTML for a message text :-(
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Originally posted by ralph soika:
Hi,

thanks for the tip with the message infoStyle.
No bad idea :-)
I think I will try this solution.
But I wonder that there is no additional feature in JSF available to solve such a problem. As I understood it is also impossible to use path trough HTML for a message text :-(


It is certainly possible with JSF. Indeed not with the basic implementation, but there are additional component libraries available which may be able to do a bit more with the messages. Alternatively, you have the freedom to write your own component for that. That's JSF.
ralph soika
Greenhorn

Joined: Jun 05, 2008
Posts: 11
Hi,

RichFaces did support such a extension for messages.
http://livedemo.exadel.com/richfaces-demo/richfaces/message.jsf?tab=usage

This seems to be a good solution.
 
 
subject: adding image with h:messages tag