0

I have a problem passing parameters to another page in JSF.

I have two databases, connected with OneToMany relation. In first are pests with their properties. In second database are names of every pest in different languages (index of English is 1, German is 4, ...)

On first page is searching in first database (side One) for specific pests. Results are displayed in datatable under it. In last column of datatable is Edit button. By clicking on it you go on second page with data from both databases of specific pest.

Entity SmPests is:

Integer idPest;
String latinName;
String code:
@OneToMany(fetch = FetchType.LAZY, mappedBy = "smPests", cascade = CascadeTyoe.ALL, orphanRemoval = true)
List<SmPestsNames> smPestsNames = new ArrayList<SmPestsName>();
...

Entity SmPestsNames is:

Integer idPest;
int idLanguage;
String name;

In SmPestList.xhtml i have:

<p:button outcome="SmPestsEditable"update="pestsListEdit" value="Edit" style="fontsize:3em" title="edit">
<f:param name="id" value="#{zuzek.idPest}" />
<f:param name="code" value="#{zuzek.code}" />
<f:param name="lname" value="#{zuzek.latinName}" />

In SmPestsEdit.xhtml I have:

<f:viewParam name="id" value="#{smPestsEditable.idPest}" />
<f:viewParam name="code" value="#{smPestsEditable.code}" />
<f:viewParam name="lname" value="#{smPestsEditable.latinName}" />

My problem is that I cannot load data from second database. I send data from first to second page using f:param, but for me it works only for data in first database. After the page load I can get also data from the second database. Is there a way to also send data from The Second database? Or is there a way to get data from the second database with given idPest before page loads?

Any help will be appreciated. If it helps, I am using Eclipse, postgresql, Wildfly17 and primefaces.

Freeky
  • 11
  • 1
  • 5

0 Answers0