Hey there,
I have two JSPs where I am displaying some info from database in a h:dataTable
. One of them is showing all the info, and one of them user specifically.
I have showXML.jsp
that shows the "XML" column of a dataTable row detailedly, since a String
that big wouldn't be nice in the dataTable. So what I'm doing is passing the row id and the navigation case, to navigate back to the parent page.
<h:commandLink action="show_xml" value="Show">
<f:param name="cid" value="#{row.id}" />
<f:param name="toview" value="history" />
</h:commandLink>
On the xml page I have a h:commandLink
with it's action set to a method:
JSP:
<h:outputText value="#{calculationBean.xml}" />
...
<h:commandLink action="#{myBean.toView}" value="Back to history" />
Backing Bean:
public String toView() {
return "back_to_" + Util.getRequestParameter("toview");
}
Problem is that on the xml page, methods get invoked multiple times. For example the getXML()
method in the h:outputText
gets called once when it successfully gets the cid
parameter with the getRequestParameter
, and again, when I click on the Back to history
link, but this time the cid
parameter is null
, traditionally causing NullPointerException
.
EDIT:
On the dataTable page, each row has 4 commandLinks, with 2 params each. Not sure this does any harm, however something seems to slow down/crash the server after a few navigation clicks. I always close my resources after database access.
EDIT2: Performance issues were caused because I've been aquiring connections through a @Resource
. This has been solved after I started using standalone connections.
Is there any other way to get the name and navigate back to the parent page?
I'm probably stuck with some noobish problem, but I have been trying for some time now. Please if you have any idea, help!
Thanks in advance, Daniel