Inplace provides easy inplace editing and inline content display. For inplace editing, "save" and "cancel" ajax behavior events are provided for customizing the use-case.
<div class="card">
<h:form>
<h5 class="mt-0">Basic</h5>
<p:inplace>
<p:inputText value="Edit Me"/>
</p:inplace>
<h5>Edit</h5>
<p:inplace editor="true">
<p:inputText value="#{inplaceView.text}" required="true" label="text"/>
</p:inplace>
<h5>Double Click</h5>
<p:inplace label="Cities" effectSpeed="fast" event="dblclick">
<p:selectOneMenu>
<f:selectItem itemLabel="New York" itemValue="0"/>
<f:selectItem itemLabel="London" itemValue="1"/>
<f:selectItem itemLabel="Paris" itemValue="2"/>
<f:selectItem itemLabel="Berlin" itemValue="3"/>
</p:selectOneMenu>
</p:inplace>
<h5>Custom Content</h5>
<p:inplace effect="none">
<f:facet name="output">
Yes or No
</f:facet>
<f:facet name="input">
<p:selectBooleanCheckbox/>
</f:facet>
</p:inplace>
<h5>Image</h5>
<p:inplace label="Show" effect="slide">
<p:graphicImage name="/demo/images/nature/nature3.jpg"/>
</p:inplace>
<h5>Password</h5>
<p:inplace>
<p:password redisplay="true" value="#{inplaceView.password}"/>
</p:inplace>
</h:form>
</div>
package org.primefaces.showcase.view.input;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Named;
import java.io.Serializable;
import io.quarkus.runtime.annotations.RegisterForReflection;
@Named
@RequestScoped
@RegisterForReflection(serialization = true)
public class InplaceView implements Serializable {
private String text = "PrimeFaces";
private String password = "secret";
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}