[Logo] OLD FORUM - Use new one: https://www.CaptainCasa.online/forum
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Chained expression resolving  XML
Forum Index -> Development
Author Message
bthalheim

Power User

Joined: 05/04/2012 11:45:24
Messages: 72
Offline

Hi,

for some weird feeling of intuition I tried to do the following:

JSP:
Code:
 <t:row id="g_13" >
 <t:label id="g_14" text="Static I18N Test" width="150" />
 <t:label id="g_15" text="#{rr.literals['literals.usage.static']}" />
 </t:row>
 <t:row id="g_16" >
 <t:label id="g_17" text="Dynamically used literal" width="150" />
 <t:label id="g_18" text="#{d.HelloWorldUI.resourceLiteralExpression}" />
 </t:row>
 


Java Ui class:
Code:
 	public String getResourceLiteralExpression() {
 		return "#{rr.literals['literals.usage.dynamic']}";
 	}
 


Properties-File:
Code:
 literals.usage.dynamic=Dynamically used literal
 literals.usage.static=Statically used literal
 


This (the second way to internationalize) does not work since the expression is resolved once, but for my "expression in expression" scenario it would need to be resolved twice (first the property in the UI class and with the result of this the literal of the properties file).

Björn, could you imagine that it could be possible to resolve expressions iteratively until it's no expression any more.

The reason why I find it desirable to do this is the fact that, as long as you use unparameterized literals, UI classes would only need to know about the message keys and could be language- and message-source-agnostic. I hope this does not seem too weird of an idea to you.

Regards,

Björn
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5555
Offline

Hi,

no, this is not possible - by JSF definition (+ there for good reason ;-)...).

I believe what you want to do is do-able by some "creative usage" of the danymic get-resolution.

If b in the expression "#{a.b['some.key.info.whatever']}" is a hashmap implementation then "deom.key.info.whatever" is passed into get get(Object key) method and it's your way to dynamically provide some object.

Just derive your b-implmentation from HashMap and override the get-method.

Regards, Björn

Björn Müller, CaptainCasa GmbH
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team