• Post Reply Bookmark Topic Watch Topic
  • New Topic

using h:message for non error  RSS feed

Ayub ali khan
Ranch Hand
Posts: 395
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am trying to use h:message for non error messages. Similar to Here

Following is my code:

<%@ page language="java" contentType="text/html"
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>


<SCRIPT type="text/javascript">

function func12() {



<P style="color:blue" align="center">Scheduler Administration Page</P>

<h:inputText id="input" value="#{time.val}" >
</h:inputText >

<h:message for="input" />
<h:commandButton id="button" action="#{time.validate}" value="Message Button" />


<h:messages globalOnly="true" showDetail="true" />


Below is the bean

public class Time {
String val;
FacesMessage message;
public String getVal(){
return val;
public String validate(){

FacesContext context = FacesContext.getCurrentInstance();
message= new FacesMessage("Invalid Username and/or Password");
context.addMessage(null, message);

return "failure";

* @param val The val to set.
public void setVal(String val) {
this.val = val;


I am not able to pint the message as mentioned in the bean. Please help me fix this issue.

Thanks and Regards
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!