點擊一個區域,提交到jsf bean。
<div class="grida">
<div class="category" οnclick="document.getElementById('categoty_filter_form:aa:#{status.index}:abutton').click()">
<p>#{category.name}</p>
<h:commandLink id="abutton" action="#{categoryController.print()}" >
<f:param name="category" value="#{category.name}" />
</h:commandLink>
<canvas id="grida_#{status.index}" class="category_type_#{category.type}" width="40" height="20" style="border:0px solid #000000;">
</canvas>
</div>
</div>
後臺是
public void print(){
System.out.println(FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("category"));
}