• Post Reply Bookmark Topic Watch Topic
  • New Topic

using h:message for non error

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

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

Following is my code:




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

<f:view>
<HEAD>

<TITLE>AdminPage.jsp</TITLE>
<SCRIPT type="text/javascript">


function func12() {


alert("Hello");


}
</SCRIPT></HEAD>
<BODY>
<CENTER>

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

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

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


</h:form>


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


</BODY>
</f:view>

</HTML>
===========================================
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
Ayub
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!