Jason Carreira wrote:
Message
Sorry, the docs are a little sparse for the taglib... Take a look at the example JSPs in the example web app...
 
For getting texts from a resource bundle, you can use getText() like so:
 
<ww:textfield label="getText('some.text.key')" name="'username'"/>
 
You can supply default messages, arg lists for parameterized messages, etc. Take a look at the com.opensymphony.xwork.TextProvider Interface. If your Action extends ActionSupport you've already got an implementation of this Interface, otherwise you can implement it yourself (see com.opensymphony.xwork.TextProviderSupport for an implementation you can delegate to)

Jason,

I've now gone through the examples, and I'm still having difficulties.  Unfortunately, your example doesn't seem to work for me.  I've tried

<ww:form action="">
<ww:textfield label="text('testKey')" name="foo"/>
</ww:form>

as well, with no luck.  My TestAction simply extends ActionSupport and adds a get/setFoo.  I have a TestAction.properties file with the key

testKey=TEST LABEL

I'm pretty much doing exactly what the i18n example is doing, and I'm getting nothing.  Any ideas?

Speaking of the i18n example, it's the only place in the example web-app where textfield is used in this manner, and alas, the i18n example is broken.  It fails with the following exception:

java.lang.RuntimeException: No object in the CompoundRoot has a property named 'language'.
	com.opensymphony.xwork.util.CompoundRootAccessor.setProperty(CompoundRootAccessor.java:63)
	ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1460)
	ognl.ASTProperty.setValueBody(ASTProperty.java:105)
	ognl.SimpleNode.setValue(SimpleNode.java:215)
	ognl.Ognl.setValue(Ognl.java:478)
	com.opensymphony.xwork.util.OgnlValueStack.setValue(OgnlValueStack.java:75)
	com.opensymphony.xwork.interceptor.ParametersInterceptor.before(ParametersInterceptor.java:47)
[snip]


Is the Action automatically placed on the Value Stack?  How does it now which action to place on the ValueStack?  Does it come from the enclosing <ww:form> tag?  Is there a way to put an Action on the VS without executing it (which is what ww:action does)?

I tried to follow the logic behind the textfield tag but soon got lost once it got passed into OGNL land...

Thanks,
-Mark

Reply via email to