-2

I have a java class which adds keys and values to a map, which works fine. I need to access these values in a JSP page

During debugging this is the structure of the map:

 riskIdx.month={Feb=40, Mar=50, Apr=10, May=20, Jan=30}

This is how I am trying to access the values of the map in the JSP page:

 chart(${riskIdx.Jan},${riskIdx.Feb},${riskIdx.Mar},${riskIdx.Apr},${riskIdx.May})

This doesnt work. What am I doing wrong? Please help.

Algorithmist
  • 6,657
  • 7
  • 35
  • 49
Sindu_
  • 1,347
  • 8
  • 27
  • 67
  • What is chart here? Is it a method? We need to see more code. – Ravi K Thapliyal Aug 15 '13 at 12:16
  • @RaviThapliyal chart is a method in another JSP page which is used to draw a chart. It works fine. If i pass in values such as chart(10,20,31,45) the chart is drawn. I have trouble accessing the map and passing them into the chart method. – Sindu_ Aug 15 '13 at 12:22
  • No, I meant I need to see the scriptlet (<% %> if you're using them) to invoke the chart from JSP. – Ravi K Thapliyal Aug 15 '13 at 12:39

1 Answers1

0

Bean:

@ManagedBean(name = "mainPageBean")
@SessionScoped
public class MainPageBean implements Serializable {
  private Map<String, Boolean> isUserInRole = new HashMap<String, Boolean>();
  ....

In *.xhtml:

  ... disabled="#{!(mainPageBean.isUserInRole['ROLE'])}"
Roman
  • 16
  • 1