I am using NetBeans for a Web Application in Java EE.
I have one controller for an absence entity class (absenceController) and one controller for an employee entity class (employeeController).
I am able to get to the employee creation page via any page controlled by absenceController:
<h:commandLink action="#{absenceController.prepareCreate}"
value="#{bundle.ListAbsenceCreateLink}"/>
I am able to get to the absence creation page via any page controlled by employeeController:
<h:commandLink action="#{employeeController.prepareCreate}"
value="#{bundle.ViewEmployeeCreateLink}" />
When I want to set up a new absence instance, I need the employee to be set in advance so I am trying to reach the absence creation page from an employee view page (called Tasks.xhtml), sending the employee instance as a parameter.
In MVC .NET I would have used an Html.ActionLink a bit like this:
Html.ActionLink("Report Absence for employee"
, "Create"
, "Absence"
, new { employeeid = employee.Id } // <- I would only be able to send the id
, null)
In Java, this is the closest I've got:
<h:commandLink action="/absence/create"
value="#{bundle.TasksEmployeeCreateAbsenceLink}" >
<f:setPropertyActionListener target="#{absenceController.selected.employee}"
value="#{employeeController.selected}" />
</h:commandLink>
The folder structure is shown below:
I know the action tag is not correct, but is there some way to change it to get the desired result please?