jsf - What would be a good way to display static message in facelets? -
i came across following managed bean , .xhtml in jsf 2.x application. static variable has long string value , referred bean in .xhtml page display message. armed limited experience of java/jsf, decided improve somehow.
- take out static first step
- create proper getter/setter methods
- load text message properties file.
- bind loaded value message variable
not convinced of myself googled here , found thread: fetching values property file inside xhtml file. sounds promising hoping find best practice in regards load/referring static message in jsf.
@managedbean @viewscoped public class foo { private static string message = "....long...message..."; // getter available public string getmessage() { .... }
from .xhtml page:
<h:outputtext value="#{foo.message}" />
Comments
Post a Comment