You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brandon Goodin <ma...@phase.ws> on 2002/10/04 00:54:58 UTC

RE: JavaBean question (OOPS)

the secon setter was a copy and past it should be

	private String stringTimestamp;

	public void setStringTimestamp(String stringTimestamp){
		this.stringTimestamp = stringTimestamp;
	}

-----Original Message-----
From: Brandon Goodin [mailto:mail@phase.ws]
Sent: Thursday, October 03, 2002 4:52 PM
To: Struts Users Mailing List
Subject: RE: JavaBean question


Since i don't completely know your bean... i'll make a guess at it.

It would probably look something like this:

public class MyTimeStamp  {

	private Timestamp timestamp;

	public MyTimeStamp(){
	}

	public void setTimestamp(Timestamp timestamp){
		this.timestamp = timestamp;
	}

	public Timestamp getTimestamp(){
		return timestamp;
	}

	public void setTimestamp(Timestamp timestamp){
		this.timestamp = timestamp;
	}

	public String getStringTimestamp(){
		return timestamp.toString()
	}
}

then use:

<html:text property="myTimestamp.stringTimestamp" >

Brandon Goodin
Phase Web and Multimedia
P(406)862-2245
F(406)862-0354
http://www.phase.ws

-----Original Message-----
From: Dan Tran [mailto:danttran@hotmail.com]
Sent: Thursday, October 03, 2002 4:29 PM
To: Struts Users Mailing List
Subject: Re: JavaBean question


Hi Brandon,  thank you for  the quick reply

What I try to achieve is somehow move a String
presetantation of a object between JSP page and a JavaClass

As far as I know how, if my java class provides set/get
method for primitive types, JSP can move the data for me

However, my java class get/set property method uses a object define by me
(ex  MyTimestamp)

The question here is What kind of method(s) in the MyTimestamp do I need to
implement  inorder for JSP to move the string presentation of my MyTimestamp
to the JSP form?

Hope I am able to be specific this time.

-Dan

----- Original Message -----
From: "Brandon Goodin" <ma...@phase.ws>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Thursday, October 03, 2002 3:16 PM
Subject: RE: JavaBean question


> If you are asking how you would get the value of "B" from the "A" bean.
The
> you could use the nested property reference dot notation like: <html:text
> property="a.b.someProperty">. Otherwise, you need to be more specific.
What
> are you trying to accomplish?
>
> Brandon Goodin
> Phase Web and Multimedia
> P(406)862-2245
> F(406)862-0354
> http://www.phase.ws
>
> -----Original Message-----
> From: Dan Tran [mailto:danttran@hotmail.com]
> Sent: Thursday, October 03, 2002 4:04 PM
> To: Struts Users Mailing List
> Subject: JavaBean question
>
>
> Hi I have a java bean A that has a property which is defined as a nother
> java object B.
>
>
> class A {
>     private B _b;
>
>     public A() {}
>     public B getB() { return _b ;}
>     public void setB( B b) { _b = b ; }
> }
>
> How can I implement B so that it can be "transfered" from bean to a form
> like
>
> <html:text property="b" >
>
>
> Any suggestion?
>
> -Dan
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JavaBean question (OOPS)

Posted by Dan Tran <da...@hotmail.com>.
Thank you for the example,   for now I will try to
use it .

However, I also happen to see a example in Hans Bergsten 's JSP pages,

which is similar to what I have but using the standard
java Date class which only implements toString() and
valueOf(String ...)

Does it mean, JSP hardwire the translation with some specific primative type
and some specifict classes?

-Dan
----- Original Message -----
From: "Brandon Goodin" <ma...@phase.ws>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Thursday, October 03, 2002 3:54 PM
Subject: RE: JavaBean question (OOPS)


> the secon setter was a copy and past it should be
>
> private String stringTimestamp;
>
> public void setStringTimestamp(String stringTimestamp){
> this.stringTimestamp = stringTimestamp;
> }
>
> -----Original Message-----
> From: Brandon Goodin [mailto:mail@phase.ws]
> Sent: Thursday, October 03, 2002 4:52 PM
> To: Struts Users Mailing List
> Subject: RE: JavaBean question
>
>
> Since i don't completely know your bean... i'll make a guess at it.
>
> It would probably look something like this:
>
> public class MyTimeStamp  {
>
> private Timestamp timestamp;
>
> public MyTimeStamp(){
> }
>
> public void setTimestamp(Timestamp timestamp){
> this.timestamp = timestamp;
> }
>
> public Timestamp getTimestamp(){
> return timestamp;
> }
>
> public void setTimestamp(Timestamp timestamp){
> this.timestamp = timestamp;
> }
>
> public String getStringTimestamp(){
> return timestamp.toString()
> }
> }
>
> then use:
>
> <html:text property="myTimestamp.stringTimestamp" >
>
> Brandon Goodin
> Phase Web and Multimedia
> P(406)862-2245
> F(406)862-0354
> http://www.phase.ws
>
> -----Original Message-----
> From: Dan Tran [mailto:danttran@hotmail.com]
> Sent: Thursday, October 03, 2002 4:29 PM
> To: Struts Users Mailing List
> Subject: Re: JavaBean question
>
>
> Hi Brandon,  thank you for  the quick reply
>
> What I try to achieve is somehow move a String
> presetantation of a object between JSP page and a JavaClass
>
> As far as I know how, if my java class provides set/get
> method for primitive types, JSP can move the data for me
>
> However, my java class get/set property method uses a object define by me
> (ex  MyTimestamp)
>
> The question here is What kind of method(s) in the MyTimestamp do I need
to
> implement  inorder for JSP to move the string presentation of my
MyTimestamp
> to the JSP form?
>
> Hope I am able to be specific this time.
>
> -Dan
>
> ----- Original Message -----
> From: "Brandon Goodin" <ma...@phase.ws>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Thursday, October 03, 2002 3:16 PM
> Subject: RE: JavaBean question
>
>
> > If you are asking how you would get the value of "B" from the "A" bean.
> The
> > you could use the nested property reference dot notation like:
<html:text
> > property="a.b.someProperty">. Otherwise, you need to be more specific.
> What
> > are you trying to accomplish?
> >
> > Brandon Goodin
> > Phase Web and Multimedia
> > P(406)862-2245
> > F(406)862-0354
> > http://www.phase.ws
> >
> > -----Original Message-----
> > From: Dan Tran [mailto:danttran@hotmail.com]
> > Sent: Thursday, October 03, 2002 4:04 PM
> > To: Struts Users Mailing List
> > Subject: JavaBean question
> >
> >
> > Hi I have a java bean A that has a property which is defined as a nother
> > java object B.
> >
> >
> > class A {
> >     private B _b;
> >
> >     public A() {}
> >     public B getB() { return _b ;}
> >     public void setB( B b) { _b = b ; }
> > }
> >
> > How can I implement B so that it can be "transfered" from bean to a form
> > like
> >
> > <html:text property="b" >
> >
> >
> > Any suggestion?
> >
> > -Dan
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>