java - How to display the appropriate message (info or warn) in s:decorate? -
I'm actually checking for the availability of the login name and warning the information image or image with an appropriate message We do not currently have the availability of a login name on two names.
& lt; S id = "loginIdField" template = "/ layout / edit.xhtml" & gt; & Lt; Ui: defined name = "label" & gt; The desired login name & lt; / UI: Define & gt; & Lt; A: area & gt; & Lt; H: inputText id = "loginId" required = "true" value = "# {userHome.instance.loginId}" /> & Lt; S: Message warning: style = "color: red" info style = "color: green" /> & lt; Div class = "actionbutton" & gt; & Lt; A: commandButton id = "submit" value = "check availability" action = "# {userHome.isUnique (userHome.instance.loginId)}" render = "login idfield" /> & Lt; / Div & gt; & Lt; / A: Sector & gt; & Lt; / S: Decorate & gt;
Code to add the appropriate message in the bean.
if (! Unique!) {StatusMessages .adtocontrolontemble } Other {statusMessages.addToControlFromResourceBundle ("login id", INFO, "log iduinic", new object [] {inputLoginId}); }
edit.xhtml
& lt; Ui: Composition xmlns = "http://www.w3.org/1999/xhtml" xmlns: ui = "http://java.sun.com/jsf/facelets" xmlns: h = "http: // java. Sun.com/jsf/html "xmlns: f =" http://java.sun.com/ jsf / core "xmlns: rich =" http://richfaces.org/rich "xmlns: s =" http: / /jboss.com/products/seam/taglib "& gt; & Lt; Div class = "prop" & gt; & Lt; S: Label style class = "name # {invalid? Errors': ''}" & gt; & Lt; Ui: Insert name = "label" /> & Lt; S: span styleClass = "required" sung = "# {required}" & gt; * & Lt; / S: span & gt; & Lt; / S: Labels & gt; & Lt; Div style = "clear: both" /> & Lt; Span class = "value # {invalid? Errors': ''}" & gt; & Lt; S: validateAll & gt; & Lt; Ui: insert / & gt; & Lt; / S: validateAll & gt; & Lt; / Span & gt; & Lt; Span class = "error" & gt; & Lt; H: graphic image value = "/ img / error.gif" sung = "# {invalid}" style class = "errors" /> & Lt; S: Message style class = "Errors" / & gt; & Lt; / Span & gt; & Lt; / Div & gt; & Lt; / Ui: Composition & gt;
Maybe this template? Have you tried to do this without a template?
Comments
Post a Comment