You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by red phoenix <ro...@gmail.com> on 2006/12/12 02:08:23 UTC

struts2.0 question

I have a question about Struts 2.0 Action,I find Action will extends
ActionSupport,like follows:
public class GetUpdatedHangmanAction extends ActionSupport implements
SessionAware {
 private static final long serialVersionUID = 5506025785406043027L;
 .....


I am puzzled with variable serialVersionUID,I want to know if this variable
is necessary for Action,if it is necessary,how to calculate the value of
serialVersionUID,why it is equals 5506025785406043027?

Anyone can give me some advice?

Thanks

Re: struts2.0 question

Posted by Chris Pratt <th...@gmail.com>.
You can use the serialver program that comes with the JDK to generate those
values.
  (*Chris*)


On 12/11/06, Christopher Goldman <cg...@dhapdigital.com> wrote:
>
> On Tue, 2006-12-12 at 09:08 +0800, red phoenix wrote:
> > I have a question about Struts 2.0 Action,I find Action will extends
> > ActionSupport,like follows:
> > public class GetUpdatedHangmanAction extends ActionSupport implements
> > SessionAware {
> >  private static final long serialVersionUID = 5506025785406043027L;
> >  .....
> >
> >
> > I am puzzled with variable serialVersionUID,I want to know if this
> variable
> > is necessary for Action,if it is necessary,how to calculate the value of
> > serialVersionUID,why it is equals 5506025785406043027?
> >
> > Anyone can give me some advice?
>
> Red Phoenix,
>
> No, I don't think the serialVersionUID is necessary for Struts, but it
> is good practice to give your Serializable classes some value for it.
> Check out the Javadocs for the Serializable interface -- it's a standard
> Java interface.
>
> Probably that number was generated by calculating a hash value from the
> object's fields.  I seem to remember reading something about some IDEs
> producing that value for you.  You can maintain it yourself as well.
>
> Chris
>
> --
> Christopher D. Goldman
> cgoldman@dhapdigital.com
> 415.962.4884
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: struts2.0 question

Posted by Christopher Goldman <cg...@dhapdigital.com>.
On Tue, 2006-12-12 at 09:08 +0800, red phoenix wrote:
> I have a question about Struts 2.0 Action,I find Action will extends
> ActionSupport,like follows:
> public class GetUpdatedHangmanAction extends ActionSupport implements
> SessionAware {
>  private static final long serialVersionUID = 5506025785406043027L;
>  .....
> 
> 
> I am puzzled with variable serialVersionUID,I want to know if this variable
> is necessary for Action,if it is necessary,how to calculate the value of
> serialVersionUID,why it is equals 5506025785406043027?
> 
> Anyone can give me some advice?

Red Phoenix,

No, I don't think the serialVersionUID is necessary for Struts, but it
is good practice to give your Serializable classes some value for it.
Check out the Javadocs for the Serializable interface -- it's a standard
Java interface.

Probably that number was generated by calculating a hash value from the
object's fields.  I seem to remember reading something about some IDEs
producing that value for you.  You can maintain it yourself as well.

Chris

-- 
Christopher D. Goldman
cgoldman@dhapdigital.com
415.962.4884


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org