Hello All!
When I call anything UIComponent addClientBehavior function for example change (
InputText anam = new InputText();
AjaxBehavior changeBehavior = new AjaxBehavior();
changeBehavior.addAjaxBehaviorListener(new AnamAjaxChanged());
anam.addClientBehavior("change", changeBehavior);
) I had error if miss addClienBehavior its working:
java.io.NotSerializableException: org.primefaces.component.inputtext.InputText
java.io.ObjectOutputStream.writeObject0(Unknown Source)
java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
java.io.ObjectOutputStream.writeSerialData(Unknown Source)
java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
java.io.ObjectOutputStream.writeObject0(Unknown Source)
java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
java.io.ObjectOutputStream.writeSerialData(Unknown Source)
java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) ...etc
My Listener
private class AnamAjaxChanged extends AjaxBehaviorListenerImpl {
private static final long serialVersionUID = 7143366298515003573L;
@Override
public void processAjaxBehavior(AjaxBehaviorEvent event)
throws AbortProcessingException {
System.out.println("change");;
}
}
Please to help me why.
addClientBehavior error
- andyba
- Expert Member
- Posts: 2473
- Joined: 31 Mar 2011, 16:27
- Location: Steinfeld, near Bremen/Osnabrück, DE
- Contact:
First off please use code tags to format code in your post.
Never instantiate UIComponent instance yourself and don't have them as instance members, especially if the instance has to be serialized.
Do this instead.
If you don't know what the stack trace meant you may need to get a grounding in base Java EE or even Java SE as it showed that the InputText instance variable is not serializable and cannot be written out from a session.
Never instantiate UIComponent instance yourself and don't have them as instance members, especially if the instance has to be serialized.
Do this instead.
Code: Select all
FacesContext facesContext = FacesContext.getCurrentInstance();
Application application = facesContext.getApplication();
InputText anam = application.createComponent(InputText.COMPONENT_TYPE);
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
-
- PrimeFaces Core Developer
- Posts: 3979
- Joined: 03 Dec 2010, 14:11
- Location: Bavaria, DE
- Contact:
The exception is probably because you have a InputText as member variable in a Session/ViewScoped bean. This won't work.
Thomas Andraschko
PrimeFaces | PrimeFaces Extensions
Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE
Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko
PrimeFaces | PrimeFaces Extensions
Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE
Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko
- andyba
- Expert Member
- Posts: 2473
- Joined: 31 Mar 2011, 16:27
- Location: Steinfeld, near Bremen/Osnabrück, DE
- Contact:
Correctedtandraschko wrote:The exception is because you have a InputText as member variable in a Session/ViewScoped bean. This won't work.
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
-
- Information
-
Who is online
Users browsing this forum: No registered users and 61 guests