0

I'm using Primefaces and jsf in my application. I'm using mutiple commandlink with onclick function. All the onclick function call the same bean method but parameters are different. Pages are working fine & passing parameters also different even though all the pages are showing same metrics. Based on parameter should display different metrics but not working properly.

XHTML:

<h:commandLink value="Defects" 
action="#{loginbean.setCurrPage('metrics','defects.xhtml')}"
onclick="#{reportsBean.MetricPage('defect')}"
rendered="#{sub_selected =='defects'}" />

<h:commandLink value="Test Case" 
action="#{loginbean.setCurrPage('metrics','testcase.xhtml')}"
onclick="#{reportsBean.MetricPage('testcase')}"
rendered="#{sub_selected =='testcases'}" />

Bean:

public void MetricPage(String ipageid) {
metricssection = metricsProcess.getMetricsProcess().getUserMetrics(ipageid, SessionMgr.getProj());
metricsfeature = metricsProcess.getMetricsProcess().getMetricFeatures(ipageid, SessionMgr.getPro());
        }

How can i resove the problem?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user3114967
  • 639
  • 5
  • 15
  • 38

1 Answers1

0

onclick is a client side event. You can only call Javascript functions from onlcick. Not methods from Managedbean.
Since you tagged this question as Primefaces, I assume you are using Primefaces. In that case you can use p:remoteCommand See this on how to use p:remotecommand

Kishor Prakash
  • 8,011
  • 12
  • 61
  • 92