[jboss-user] [JBoss Seam] - Re: @RequestParameter value become null in conversation sfsb

bfo81 do-not-reply at jboss.com
Thu Aug 17 07:47:27 EDT 2006


Request parameters usually are only sent once, namely when there is a corresponding parameter in the HTTP request. If there are other requests following with no key parameter, then the variable gets null ;).

So if you want to have that "String key" during the whole conversation, there are two possibilities:

- add (f:param name="key" value="#{yourBean.key}" /) to every commandLink, commandButton, ... on your page, so that it gets always re-injected (BAD IDEA, blows up your page code and it's silly to pass the same parameters from client to server on and on ;))

- copy the key to another property during the conversation's begin:@RequestParameter
  | String key;
  | 
  | String keyCopy; //choose a better name ;)
  | 
  | @Begin
  | public String beginActionMethod() {
  |     keyCopy = key;
  |     ...
  | }
  | 
  | public String someOtherActionMethod() {
  |     doSomethingWith(keyCopy);   //key would be null here, so use keyCopy
  | }

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965702#3965702

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965702



More information about the jboss-user mailing list