I would like to pass an value to a managed bean under the hood. So I have this managed bean:
@ManagedBean(name = "mbWorkOrderController")
@SessionScoped
public class WorkOrderController {
// more attributes...
private WorkOrder workOrderCurrent;
// more code here...
public WorkOrder getWorkOrderCurrent() {
return workOrderCurrent;
}
public void setWorkOrderCurrent(WorkOrder workOrderCurrent) {
this.workOrderCurrent = workOrderCurrent;
}
}
It holds a parameter workOrderCurrent
of the custom type WorkOrder
. The class WorkOrder
has an attribute applicant
of type String
.
At the moment I am using a placeholder
inside my inputtext
to show the user, what he needs to type inside an inputText
.
<p:inputText id="applicant"
value="#{mbWorkOrderController.workOrderCurrent.applicant}"
required="true" maxlength="6"
placeholder="#{mbUserController.userLoggedIn.username}" />
What I want to do, is to automatically pass the value of mbUserController.userLoggedIn.username
to mbWorkOrderController.workOrderCurrent.applicant
and remove the inputText
for applicant
completely from my form.
I tried to use c:set
:
<c:set value="#{mbUserController.userLoggedIn.username}" target="#{mbWorkOrderController}" property="workOrderCurrent.applicant" />
But unfortunatelly I get a javax.servlet.ServletException
with the message:
The class 'WorkOrderController' does not have the property 'workOrderCurrent.applicant'.
Does anybody have an advice?