I am relatively new in using Primefaces and I am stack with an issue that normally is easy for an
experienced Primeface user, but seems to me impossible to achieve.
I created a flow intro-flow.xml and a page intro.xhtml.
I use JPA and I managed to bring some data (Articles) from the database on my UI. I present you
the UI code here:
Code: Select all
<h:form id="resultsForm">
<p:panel id="resultsPanel" header="Results"
style="margin-bottom:10px;">
<ui:repeat value="#{listOfArticles}" var="prd">
<h:panelGroup layout="block" >
<div id="#{prd.ean}|#{prd.shortDescription}" class="itemStyle"
onclick="#{MyArticlesService.getSelectedProduct(this.id)}" <!-- "this.id" is javascript -->
style="hover { background-color: #D3D3D3;}">
<img style="width:100px;height:75px;" src="#{prd.pictureUrl}" />
<h:outputText value="#{prd.shortDescription}"
style="padding-bottom:2cm;font-weight:bold;" />
</div>
</h:panelGroup>
<hr />
</ui:repeat>
</p:panel>
</h:form>
which is called MyArticlesService in my flow.
The problem is that the piece of code this.id is not recognized as javascript and I get the following error:
Code: Select all
Jul 07, 2016 2:41:02 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/eshopWebApp] threw exception [Request processing failed; nested exception is org.springframework.webflow.execution.FlowExecutionException: Exception thrown in state 'intro' of flow 'intro'] with root cause
javax.el.ELException: The identifier [this] is not a valid Java identifier as required by section 1.19 of the EL specification (Identifier ::= Java language identifier). This check can be disabled by setting the system property org.apache.el.parser.SKIP_IDENTIFIER_CHECK to true.
Code: Select all
onclick="#{MyArticlesService.getSelectedProduct('this.id')}"
So my question is:
How can I pass a javascript value/parameter to Java?
In case you have any idea or an answer, I will really appreciate your feedback.