tag:blogger.com,1999:blog-5643789161706320234.post3569327588873656464..comments2024-01-22T01:50:03.406-05:00Comments on Test, Test, JSF: Setting JSF ProjectStage with JNDIStan Silverthttp://www.blogger.com/profile/15448185150356520608noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-5643789161706320234.post-52966926342384755682020-01-07T07:57:27.634-05:002020-01-07T07:57:27.634-05:00Sorry, I forgot the limitations for xml tags: The ...Sorry, I forgot the limitations for xml tags: The "true" has to be set in spec-descriptor-property-replacement in the standalone.xml<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5643789161706320234.post-38925126368541555222020-01-07T07:55:01.321-05:002020-01-07T07:55:01.321-05:00If you use the system-property approach do not for...If you use the system-property approach do not forget to set true in the configuration.<br />Oh, and the replacemet in the added example goes with ${jsf.project.stage}, not with ${jsf.project.stage:Production}.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5643789161706320234.post-72814726493531432822012-12-27T07:12:22.185-05:002012-12-27T07:12:22.185-05:00I just noticed that deploying a webapp that uses p...I just noticed that deploying a webapp that uses property expansion causes a console message like<br /><br />13:08:42,535 INFO [javax.enterprise.resource.webcontainer.jsf.application] (MSC service thread 1-8) Unable to discern ProjectStage for value ${jsf.project.stage:Production}.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5643789161706320234.post-34521905385833224982012-12-27T06:52:11.716-05:002012-12-27T06:52:11.716-05:00I was unseccessful with the property expansion tri...I was unseccessful with the property expansion trick on JBoss AS 7.1.1.<br /><br />I tried param-values like ${jsf.project.stage:UnitTest} and ${jsf.project.stage} but PROJECT_STAGE was always set to the default value of Production. Do I have to take additional steps in order to activate system parameter expansion in web.xml?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5643789161706320234.post-73486579879402507842012-12-14T09:02:47.845-05:002012-12-14T09:02:47.845-05:00Good tip Jaikiran. I agree. That's a little e...Good tip Jaikiran. I agree. That's a little easier, but not portable to other containers.<br /><br />For those who don't know, you don't even have to use -D for that. System props can also be set in standalone.xml and/or CLI.<br /><br /><system-properties><br /> <property name="jsf.project.stage" value="Production"/><br /></system-properties><br /><br />/system-property=jsf.project.stage/:add(value=Production)Stan Silverthttps://www.blogger.com/profile/15448185150356520608noreply@blogger.comtag:blogger.com,1999:blog-5643789161706320234.post-36374906690809614842012-12-13T23:50:51.634-05:002012-12-13T23:50:51.634-05:00IMO, a much simpler *AS7 specific* way would perha...IMO, a much simpler *AS7 specific* way would perhaps be to take advantage of the AS7 system property expansion support in deployment descriptors. So your web.xml would then just have:<br /><br /><context-param><br /> <param-name>javax.faces.PROJECT_STAGE</param-name><br /> <param-value>${jsf.project.stage:Production}</param-value><br /></context-param><br /><br />where the jsf.project.stage system property (which can be set during server startup via -Djsf.project.stage) can then control the value. By default, we set it to Production, so that the absence of that system property can be treated as Production environment. Of course, this isn't standardized.Jaikiranhttps://www.blogger.com/profile/08503182723143814781noreply@blogger.com