Tommy
Tommy

Reputation: 1985

how to set dynamic variable and pass it to JSF like spring mvc?

In spring, I can do like this

Map<String, Object> model = new HashMap<String, Object>();
model.putAll(runtimeService.getVariables(executionId));
return new ModelAndView("page1", model);

runtimeService.getVariables(executionId) is returning a map For example,

String Object
"id"   "123"
"value" "4"

Then i can directly use ${id} to access the value

Variable name "id" is dynamic,

I am not sure how to do it in JSF way, since it uses getters and setters.

This should be simple, i am new to JSF :)

Thanks in advance.

Upvotes: 0

Views: 1051

Answers (1)

Jigar Joshi
Jigar Joshi

Reputation: 240996

You can have a Map in your Managed Bean and render it on XHTML using #

@ManagedBean
@RequestScoped
public class PersonBean{
  private Map<String, String> personPropertyMap;
  //setter + getters
}

on page

#{personBean.personPropertyMap['property1']}

Upvotes: 1

Related Questions