{"id":3794,"date":"2024-10-04T20:25:16","date_gmt":"2024-10-04T18:25:16","guid":{"rendered":"https:\/\/bob-team.de\/wordpress\/?p=3794"},"modified":"2025-04-17T19:52:52","modified_gmt":"2025-04-17T17:52:52","slug":"resources-und-jsf","status":"publish","type":"post","link":"https:\/\/bob-team.de\/wordpress\/2024\/10\/04\/resources-und-jsf\/","title":{"rendered":"Resources und JSF"},"content":{"rendered":"<p>Ordner in &#8222;main&#8220; f\u00fchrt zu <code>RES_NOT_FOUND<\/code>. Resources folder must be inside the webapp folder, not in the root main (siehe <a href=\"https:\/\/stackoverflow.com\/questions\/24264188\/res-not-found-in-jsf\">https:\/\/stackoverflow.com<\/a>).<\/p>\n<p>siehe auch: <a href=\"https:\/\/mkyong.com\/jsf2\/resources-library-in-jsf-2-0\/\">Resources (library) in JSF 2.0<\/a><\/p>\n<hr \/>\n<p><a href=\"https:\/\/mkyong.com\/jsf2\/jsf-2-internationalization-example\/\">JSF 2 internationalization example<\/a><br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/2668161\/internationalization-in-jsf-faces-when-to-use-message-bundle-resource-bundle-a\">Messages-Datei verwenden (i18n)<\/a><br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/13655540\/read-resource-bundle-properties-in-a-managed-bean\">Read resource bundle properties in a managed bean<\/a><\/p>\n<pre lang=\"xml\">\r\n<f:view locale=\"#{facesContext.externalContext.requestLocale}\">\r\n<h:outputText value=\"#{msg['abcd']}\" \/>\r\n<\/pre>\n<hr \/>\n<p>Using varName:<\/p>\n<p>varName: is the String representing the <var><\/var> in <resource-bundle><\/p>\n<pre lang=\"java\">\r\nFacesContext context = FacesContext.getCurrentInstance();\r\nApplication app = context.getApplication();\r\nResourceBundle bundle = app.getResourceBundle(context, varName);\r\nString msg = bundle.getString(\"key\");\r\n<\/pre>\n<p>Using baseName:<\/p>\n<p>baseName: The fully qualified name of the resource bundle (<base-name> in <resource-bundle>).<\/p>\n<pre lang=\"java\">\r\nFacesContext context = FacesContext.getCurrentInstance();\r\nLocale locale = context .getViewRoot().getLocale();\r\nClassLoader loader = Thread.currentThread().getContextClassLoader();\r\nResourceBundle bundle = ResourceBundle.getBundle(baseName, locale, loader);\r\nString msg = bundle.getString(\"key\");\r\n<\/pre>\n<pre lang=\"xml\">\r\n<h:outputFormat value=\"#{mytext.WelcomeMessage}\" >          \r\n  <f:param value=\"#{userSessionBean.first}\" \/>\r\n  <f:param value=\"#{userSessionBean.last}\" \/>\r\n<\/h:outputFormat>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Ordner in &#8222;main&#8220; f\u00fchrt zu RES_NOT_FOUND. Resources folder must be inside the webapp folder, not in the root main (siehe https:\/\/stackoverflow.com). siehe auch: Resources (library) in JSF 2.0 JSF 2 internationalization example Messages-Datei verwenden (i18n) Read resource bundle properties in a managed bean Using varName: varName: is the String representing the in FacesContext context = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3794","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"_links":{"self":[{"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/posts\/3794","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/comments?post=3794"}],"version-history":[{"count":6,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/posts\/3794\/revisions"}],"predecessor-version":[{"id":4085,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/posts\/3794\/revisions\/4085"}],"wp:attachment":[{"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/media?parent=3794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/categories?post=3794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/tags?post=3794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}