Web tier: servlets, JSP, Web frameworks: action does not declare serialversionuid warning
when Action extends Action Support i get a warning action does not declare serialversionuid. Please excuse my ignorance if this was basic questions... 1) what is advantage of declaring serialversionuid in action class? 2) when does the action class gets serialized.Even in Clustered Environment i don't see action needs serialization. Please tell any scenario where action needs to be serialized.? 3) If my action does not get serialized why do i need to add unnecessary code(declare serialversionuid) to my action making it Big.? 4) I assume serialversionuid makes sense only when the action gets serialized.is this right? I will be really grateful if someone shares your ideas.
- Posted by: anand nandu
- Posted on: July 23 2009 12:45 EDT
- Re: action does not declare serialversionuid warning by Sergei Batiuk on September 14 2009 20:53 EDT
Hi Anand: You are probably using the Eclipse IDE and developing using the Struts framework. Eclipse by default expects that every class declares a serialVersionUID field, whether it is a Data Transfer Object or a Struts Action. In many cases this is just not needed. It is only useful for serialization and in Action class it is not important. You can turn off this feature in Eclipse for the whole workspace or for a specific project. To turn this feature for the workspace, go to Window -> Preferences -> Java -> Compiler -> Errors/Warnings -> Potential programming problems and set the 'Serializable class without serialVersionUID' from 'Warning' to 'Ignore'. To turn this feature for the workspace, in the project properties go to Java Compiler -> Errors/Warnings -> Potential programming problems and set the 'Serializable class without serialVersionUID' from 'Warning' to 'Ignore'. Java Development on Demand http://www.hitech.com.ua/en/