This content has been marked as final.
Show 6 replies
-
1. Re: Lame question about form posting and command links
denis-karpov May 19, 2006 5:08 AM (in response to najgor)Hi.
First, for h:inputText you do not need injection. This code should work. Read more carefully about h:inputText in JSF documentation.<h:form> <h:inputText id="command" value="#{wsTest.command}" required="true" /> <h:commandButton action="#{wsTest.next}" class="button" /> </h:form>
@Name("wsTest") public class FooAction implements Foo { String command; public String getCommand(){ return command; } public void setCommand(String val){ command = val; } public String next() {....
Second, Nested injection? What do you mean?
Third, As i understand outputLink was designed for get requests. So that you do not need 'action' attribute.
Hope it helps. Denis -
2. Re: Lame question about form posting and command links
najgor May 19, 2006 5:16 AM (in response to najgor)"denis-karpov" wrote:
Second, Nested injection? What do you mean?
For example, my Action class has 'user' attribute of custom type User. It has, for example, 'name' property etc, usuall stuff.
So, I wonder if I can put @RequestParameter annotation on 'user' attribute (that is defined in action) and to put something like this on xhtml:<f:param name="user.name" value="John Doe"/>
So this is what I meant by 'nested' injection, or, nested property setting.
Any help?
Thanx for the 1st answer, I am going to test it. -
3. Re: Lame question about form posting and command links
najgor May 19, 2006 5:50 AM (in response to najgor)"denis-karpov" wrote:
Hi.
First, for h:inputText you do not need injection. This code should work. Read more carefully about h:inputText in JSF documentation.
Unfortunatelly, it won't work - and, yes, it really seems that it should. I am not able to render page, with the following exception:11:45:16,691 ERROR [STDERR] May 19, 2006 11:45:16 AM com.sun.facelets.FaceletViewHandler handleRenderException SEVERE: Error Rendering View javax.faces.el.PropertyNotFoundException: /wsTest.xhtml @13,74 value="#{wsTest.command}": Bean: $Proxy196, property: command at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:58) at javax.faces.component.UIOutput.getValue(UIOutput.java:75) ...
How to make 'command' property visible? (I have added getters/setters in seam action class).
Please note that my seam action is also stateless bean.
thanx in advance -
4. Re: Lame question about form posting and command links
denis-karpov May 19, 2006 7:04 AM (in response to najgor)How to make 'command' property visible? (I have added getters/setters in seam action class).
Try to define getter and setter inside Foo interface too.
For example, my Action class has 'user' attribute of custom type User. It has, for example, 'name' property etc, usuall stuff. So, I wonder if I can put @RequestParameter annotation on 'user' attribute (that is defined in action) and to put something like this on xhtml:<f:param name="user.name" value="John Doe"/>
No. You can't.
But You can do this, for instance ;-)<h:inputText id="userName" value="#{wsTest.user.name}"/>
Denis. -
5. Re: Lame question about form posting and command links
najgor May 19, 2006 8:45 AM (in response to najgor)"denis-karpov" wrote:
How to make 'command' property visible? (I have added getters/setters in seam action class).
Try to define getter and setter inside Foo interface too.
This made the trick, partially:) I didnt put get/set into interface, since I dont like that, however, it is needed if seam action is an ejb component.
Moreover, I found out that is not possible to have one action attribute used for both <h:inputText and <f:param. If @RequestParameter exist, seam will first set the attribute from form, and then it will null it, because there is no request paramter with that name.
If @RequestParameter do not exist, form will work correctly (as Denis has stated), except, commandLinks will not work.
This might be solved by having a new flag for @RequestParameter that will not null-arize actions attribute if request parameter does not exist.
Thanx. -
6. Re: Lame question about form posting and command links
gavin.king May 19, 2006 1:24 PM (in response to najgor)Seam actions that expose value bindings MUST be stateful, not stateless!