-
1. Re: request parameter and method binding
kragoth Nov 11, 2009 12:35 AM (in response to alpha88)I'm not quite sure why you are having a hard time doing what you want to do.
This is what you have at the moment
<h:commandButton action="#{accountService.deposit}" value="Deposit amount"/>
And all you want to do is pass the request params in so you can do something like this (I havn't tested this, I have just done some googling so it is probably not 100% correct but if you do a bit of reading about requestParameters in EL expressions I'm sure you'll be able to get it to work.)
So.... maybe something like...
<h:commandButton action="#{accountService.deposit(param.accountId, param.amount)}" value="Deposit amount"/>
Here I am accessing the request params by using the expression param.paramId
I found this info HERE
If that way doesn't work then maybe accessing the param like this might.
#{param['accountId']}
This idea is from HERE
I hope this helps.
-
2. Re: request parameter and method binding
asookazian Nov 11, 2009 12:47 AM (in response to alpha88)30.1. Parameterized Method Bindings
Standard EL assumes that any parameters to a method expression will be provided by Java code. This means that a method with parameters cannot be used as a JSF method binding. Seam provides an enhancement to the EL that allows parameters to be included in a method expression itself. This applies to any Seam method expression, including any JSF method binding, for example:
<h:commandButton action="#{hotelBooking.bookHotel(hotel)}" value="Book Hotel"/>
30.1.1. Usage
Parameters are surrounded by parentheses, and separated by commas:
<h:commandButton action="#{hotelBooking.bookHotel(hotel, user)}" value="Book Hotel"/>
http://docs.jboss.org/seam/2.0.0.GA/reference/en/html/elenhancements.html
-
3. Re: request parameter and method binding
alpha88 Nov 12, 2009 12:45 AM (in response to alpha88)You are right,
When i use param as follows
<h:commandButton action="#{accountService.deposit(param.accountId, param.amount)}" value="Deposit amount"/>
It works fine.
You save me a lot of time.
Congratulations!
-
4. Re: request parameter and method binding
alpha88 Nov 12, 2009 12:47 AM (in response to alpha88)You are right,
When i use param, i can pass request parameter. It works fine!
Congratulations!