Why is the component showing as an input associated with a bean in read mode?
If the bean has a getter and setter for a component, then it becomes rendered as an input field.
Use the property of an input field readonly
to determine whether it should be displayed as an input field or as a read-only text field.
<xp:inputText
id="inputText1"
readonly="#{myBean.readOnly}"
value="#{myBean.myField}">
</xp:inputText>
If you have multiple fields bound to a bean, then a panel with a property surrounds them readonly
. This way you don't need to set this property for every field.
source to share
I believe you need a method isReadOnly(Object key)
for your bean that handles whether the bean is readonly or not. The isreadOnly () method can base its logic on, for example, an action parameter. Here's a simplified example:
public boolean isReadOnly(final Object key) {
String action = ExtLibUtil.readParameter(FacesContext.getCurrentInstance(), "action");
if ("editdocument".equalsIgnoreCase(action)) {
return false;
}
return true;
}
The controls then automatically use this to determine whether the inputText control should be displayed in readmode or editmode.
source to share