views:

50

answers:

2

There is this sentence in JBoss EL resolver online documentation:

It's important to fully understand how this extension to EL works. When the page is rendered, the parameter names are stored (for example, hotel.id and user.username), and evaluated (as value expressions) when the page is submitted. You can't pass objects as parameters!

But I had used objects as function parameters in my project before I accidentally read this hint and it worked! How is it possible? I'm afraid of that there is some magic now...

EDIT: Please notice that I'm actually using full-worthy objects as parameters without any problem with our framework stack (MyFaces, Facelets, Trinidad, Spring, Webflow) and I'm asking how is this possible. For example I can do this in xhtml template: "#{pageBean.formatAccount(account)}" where account is very complex class. I know that according to the documentation it shouldn't be possible, but it is. Should I be afraid of some difficulties in the future? That's the question.

+1  A: 

it's allowed in Seam framework.JSF alone doesn't allow it.That's one of the advantages of using Seam. you can pass objects as parameters.

khairil
+1  A: 

It meant to say "non-standard" Objects there. I.e. not a String, Integer, etc, but fullworthy value objects like Javabeans and so on.


Update: I now see what the documentation means. It meant to say that those values are actually not been passed around as complex objects, but just as plain vanilla strings representing a value expression. Literally, "bean.hotel", "bean.user.address", etc. When the page is submitted, those strings are evaluated as value expressions and the complex object associated with it will be retrieved from the JSF memory.

The importance here is that you need to preserve the same complex object in the subsequent request of the form submit as it was in the initial display of the form. If the bean is request scoped, the original object would namely get lost when the response is finished. You'd like to construct exactly the same complex object again in the bean's constructor during the subsequent request. Another way to fix this "problem" is to put the bean in a broader scope like session scope or Seam conversation scope or JSF 2.0 view scope.

That is also what the next sentence of the documentation is trying to tell:

You must ensure that the parameters are available not only when the page is rendered, but also when it is submitted. If the arguments can not be resolved when the page is submitted the action method will be called with null arguments!

BalusC
You meant to say it where? I don't understand...
calavera.info
I didn't said "I", I said "It", referring to the JBoss documentation.
BalusC
Sorry, I overlooked "t":). But I edited my question to be clear that I'm already using fullworthy objects and I'm asking how is it possible.
calavera.info