Reputation: 29
1.1.9.0 I have method calling procedure,i what to display those msg which are been return in my procedure how can I do that
my method is
public void validUsr(FacesContext facesContext, UIComponent uIComponent, Object object){
String inputString =object.toString().toUpperCase();
// executeQueryADF("cal.SignId(?)",new Object[] {inputString});
callPerformSdmsLogon("cal.SignId(?)",new Object[] {inputString});
}
this is how my procedure define
procedure SignId(p_signid varchar2,PROC_ERR_MSG OUT varchar2)
I
Upvotes: 0
Views: 1316
Reputation: 1709
public void validUsr(FacesContext facesContext, UIComponent uIComponent, Object object){ String inputString =object.toString().toUpperCase(); // executeQueryADF("calmain.SignId(?)",new Object[] {inputString}); String msg = null; callPerformSdmsLogon("calmain.SignId(?,?)",new Object[] {inputString,msg}); if(msg != null){ //System.out.println(msg); throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,msg,null)); } }
If you only want to show your message you don't have to throw an exception but you can do something like this:
public void validUsr(FacesContext facesContext, UIComponent uIComponent, Object object){
String inputString =object.toString().toUpperCase();
String msg = null;
callPerformSdmsLogon("calmain.SignId(?,?)",new Object[] {inputString,msg});
if(msg != null){
showMessage(msg);
}
}
public void showMessage(String messageText) {
FacesMessage fm = new FacesMessage(messageText);
fm.setSeverity(FacesMessage.SEVERITY_INFO);
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, fm);
}
Still I am not sure what are you trying to achieve.
Upvotes: 0
Reputation: 1709
I am not sure weather I understood you correctly but if you want to display a message you need something like this:
public void showMessage(String messageText) {
FacesMessage fm = new FacesMessage(messageText);
fm.setSeverity(FacesMessage.SEVERITY_INFO);
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, fm);
}
Here a source https://mjabr.wordpress.com/2011/07/29/how-to-show-afmessage-programatically/
Upvotes: 1