You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by babu <sb...@calsoft.co.in> on 2004/10/07 15:11:00 UTC

i've a form which has AttachmentName and URL and 3 buttons[add,update,delete]

i've a form which has AttachmentName and URL  and 3 buttons[add,update,delete]
the screen first appear as 1)for the relevant attachment name one select box will be display,user has provision to select the attachment from the select box and change the URL ,then it will added to the DB.
2) when the add button is clicked for the relevant attachmentname on textfield will be display, user has provision to enter the attachment name in the textfield and its pair in the URL textfield.again when the update button is clicked the entered value will updated into the DB.
How i do it? plz give suggestion [ i'm using struts1.1 only and not using struts-EL tags]

Re: File Upload DEPRECATED?

Posted by Martin Cooper <mf...@gmail.com>.
The package is *not* deprecated. What is deprecated is the old, buggy
implementation. The replacement is not Commons FileUpload, but is a
Struts wrapper around Commons FileUpload. See
CommonsMultipartRequestHandler. That implementation has been the
default implementation in Struts for quite some time now.

As for an example, there is an example in the Struts distribution
itself. Look for the 'upload' example within the 'struts-examples' web
app.

--
Martin Cooper


On Tue, 05 Oct 2004 11:47:56 +0200, Ivan <iv...@interd4u.com> wrote:
> I don t understand. As you see here
> (http://struts.apache.org/api/org/apache/struts/upload/package-
> frame.html) This package is almost deprecated in favor of commons-
> fileupload.
> 
> Ok i have remove the method based on struts 1.1 example(example and code
> that is remove on struts 1.2.2!!!), and i test that commons-
> fileupload... and several hours wasted i have found that it don t wanna
> work with struts.
> 
> Have you tested commons-upload with struts? Where is the example of
> using commons-upload with struts the same way it was an example using
> struts-self-thing.
> 
> It is REALLY a pain to code deprecated code without having access to the
> code that will replace the deprecated code (do you know ? the
> @deprecated use XXX class instead of, that you don t write on source).
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
> 
>

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


File Upload DEPRECATED?

Posted by Ivan <iv...@interd4u.com>.
I don t understand. As you see here
(http://struts.apache.org/api/org/apache/struts/upload/package-
frame.html) This package is almost deprecated in favor of commons-
fileupload.

Ok i have remove the method based on struts 1.1 example(example and code
that is remove on struts 1.2.2!!!), and i test that commons-
fileupload... and several hours wasted i have found that it don t wanna
work with struts.

Have you tested commons-upload with struts? Where is the example of
using commons-upload with struts the same way it was an example using
struts-self-thing.

It is REALLY a pain to code deprecated code without having access to the
code that will replace the deprecated code (do you know ? the
@deprecated use XXX class instead of, that you don t write on source).


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


Re: [OT] i've a form which has AttachmentName . . .

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Rick Reumann wrote:

> Erik Weber wrote:
>
>>> Oh yea. Ok:) Although I think Kramer's mom was named "Babs" ? 
>>

Yes.  Babu comes from "My Sweet Baboo", which was a knockoff on "Pumpkin 
Butt".

Michael


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


Re: [OT] i've a form which has AttachmentName . . .

Posted by Erik Weber <er...@mindspring.com>.
Damn! I must have missed a couple of episodes!

Rick Reumann wrote:

> Erik Weber wrote:
>
>>> Oh yea. Ok:) Although I think Kramer's mom was named "Babs" ?
>>
>
> Don't you remember she was worked in the bathrooms at one of the 
> hotels. And George wanted to use her for something I forget what now. 
> I think to eavesdrop on someone while they were in the bathroom. I 
> think Newman even had a thing with her and Kramer walked in on them.
>

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


Re: [OT] i've a form which has AttachmentName . . .

Posted by Rick Reumann <st...@reumann.net>.
Erik Weber wrote:

>> Oh yea. Ok:) Although I think Kramer's mom was named "Babs" ?

Don't you remember she was worked in the bathrooms at one of the hotels. 
And George wanted to use her for something I forget what now. I think to 
eavesdrop on someone while they were in the bathroom. I think Newman 
even had a thing with her and Kramer walked in on them.

-- 
Rick

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


Re: [OT] i've a form which has AttachmentName . . .

Posted by Erik Weber <er...@mindspring.com>.
Rick Reumann wrote:

> Erik Weber wrote:
>
>>
>>
>> Rick Reumann wrote:
>>
>>> Isn't Babu, Kosmo Kramer's mom's name?
>>
>>
>>
>>
>> No. You are a veddy, veddy bod mon.
>
>
> Oh yea. Ok:) Although I think Kramer's mom was named "Babs" ?
>

Sounds right, but I don't think I ever saw her on the show.

Babu was Jerry's Pakistani friend/neighbor who owned a local restaurant 
that served American food. Jerry went in and convinced him to serve 
authentic Pakistani food. Babu immediately lost all his customers and 
went out of business. Later he lost his green card (thanks to another 
fiasco involving Jerry and Newman) and was deported.

He later resurfaced to help seal Jerry's fate (a prison term) during the 
"good samaritan" trial.

:)

Erik

P.S. And if you NEVER want this thread to end, just start quoting the 
Simpsons. :)




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


Re: i've a form which has AttachmentName and URL and 3 buttons[add,update,delete]

Posted by Rick Reumann <st...@reumann.net>.
Erik Weber wrote:

> 
> 
> Rick Reumann wrote:
> 
>> Isn't Babu, Kosmo Kramer's mom's name?
> 
> 
> 
> No. You are a veddy, veddy bod mon.

Oh yea. Ok:) Although I think Kramer's mom was named "Babs" ?

-- 
Rick

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


Re: i've a form which has AttachmentName and URL and 3 buttons[add,update,delete]

Posted by Erik Weber <er...@mindspring.com>.

Rick Reumann wrote:

> Isn't Babu, Kosmo Kramer's mom's name?


No. You are a veddy, veddy bod mon.

>
> Michael McGrady wrote:
>
>> Bill Siggelkow wrote:
>>
>>> Okay -- what you need to do is first stand on one foot ... now with 
>>> your nose and your right index finger press Ctrl-Alt-F7.
>>> Then spin around three times while singing "I am a little teapot ..."
>>>
>>> This should solve your problem -- if it doesn't maybe you can 
>>> provide more details.
>>>
>>> babu wrote:
>>>
>>>> i've a form which has AttachmentName and URL and 3 
>>>> buttons[add,update,delete]
>>>> the screen first appear as 1)for the relevant attachment name one 
>>>> select box will be display,user has provision to select the 
>>>> attachment from the select box and change the URL ,then it will 
>>>> added to the DB.
>>>> 2) when the add button is clicked for the relevant attachmentname 
>>>> on textfield will be display, user has provision to enter the 
>>>> attachment name in the textfield and its pair in the URL 
>>>> textfield.again when the update button is clicked the entered value 
>>>> will updated into the DB.
>>>> How i do it? plz give suggestion [ i'm using struts1.1 only and not 
>>>> using struts-EL tags]
>>>

Sounds to me like you are trying to do a file upload, with a few extras 
(such as letting the user delete and rename existing files).

There are a couple areas of complication here, but nothing you can't 
handle if you are willing to do your homework. Start with the Struts 
file upload example which comes with the 1.1 distribution. Look at the 
JSP (the form) and the source code for the form bean and the action. 
FormFile is the key. Once you get a simple file upload working, the rest 
is just Java IO and JDBC programming.

Next, you'll need to design a database to hold your file metadata, and 
allocate a directory on the server box where you can begin a storage 
tree for uploaded files. I suggest keeping all files on the filesystem 
and keeping all information about the files in the database. There is 
the possibility of keeping the file data in the database as well, but I 
wouldn't consider doing that until you know you have a good reason, 
unless the files are very small.

I would suggest scratching out some possible method signatures such as 
renameFile(String oldName, String newName), 
renameFileByPrimaryKey(String pk, String newName), 
deleteFileByPrimaryKey(String pk), etc., so you'll know ahead of time 
what you've got to implement.

Since you also have more than one submit button, you'll need to do a 
little research on multiple submit buttons with Struts (and in general). 
There have been many threads on this topic in this list, so search the 
archives (www.mail-archive.com, etc.).

Hope that helps,
Erik


>>>>
>>
>> Is there a question here or just a request to do the coding. My 
>> apologies if there is a language barrier.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
>

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


Re: i've a form which has AttachmentName and URL and 3 buttons[add,update,delete]

Posted by Rick Reumann <st...@reumann.net>.
Isn't Babu, Kosmo Kramer's mom's name?

Michael McGrady wrote:

> Bill Siggelkow wrote:
> 
>> Okay -- what you need to do is first stand on one foot ... now with 
>> your nose and your right index finger press Ctrl-Alt-F7.
>> Then spin around three times while singing "I am a little teapot ..."
>>
>> This should solve your problem -- if it doesn't maybe you can provide 
>> more details.
>>
>> babu wrote:
>>
>>> i've a form which has AttachmentName and URL  and 3 
>>> buttons[add,update,delete]
>>> the screen first appear as 1)for the relevant attachment name one 
>>> select box will be display,user has provision to select the 
>>> attachment from the select box and change the URL ,then it will added 
>>> to the DB.
>>> 2) when the add button is clicked for the relevant attachmentname on 
>>> textfield will be display, user has provision to enter the attachment 
>>> name in the textfield and its pair in the URL textfield.again when 
>>> the update button is clicked the entered value will updated into the DB.
>>> How i do it? plz give suggestion [ i'm using struts1.1 only and not 
>>> using struts-EL tags]
>>>
> 
> Is there a question here or just a request to do the coding.  My 
> apologies if there is a language barrier.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


-- 
Rick

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


Re: i've a form which has AttachmentName and URL and 3 buttons[add,update,delete]

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Bill Siggelkow wrote:

> Okay -- what you need to do is first stand on one foot ... now with 
> your nose and your right index finger press Ctrl-Alt-F7.
> Then spin around three times while singing "I am a little teapot ..."
>
> This should solve your problem -- if it doesn't maybe you can provide 
> more details.
>
> babu wrote:
>
>> i've a form which has AttachmentName and URL  and 3 
>> buttons[add,update,delete]
>> the screen first appear as 1)for the relevant attachment name one 
>> select box will be display,user has provision to select the 
>> attachment from the select box and change the URL ,then it will added 
>> to the DB.
>> 2) when the add button is clicked for the relevant attachmentname on 
>> textfield will be display, user has provision to enter the attachment 
>> name in the textfield and its pair in the URL textfield.again when 
>> the update button is clicked the entered value will updated into the DB.
>> How i do it? plz give suggestion [ i'm using struts1.1 only and not 
>> using struts-EL tags]
>>

Is there a question here or just a request to do the coding.  My 
apologies if there is a language barrier.


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


Re: i've a form which has AttachmentName and URL and 3 buttons[add,update,delete]

Posted by Bill Siggelkow <bi...@bellsouth.net>.
Okay -- what you need to do is first stand on one foot ... now with your 
nose and your right index finger press Ctrl-Alt-F7.
Then spin around three times while singing "I am a little teapot ..."

This should solve your problem -- if it doesn't maybe you can provide 
more details.

babu wrote:

> i've a form which has AttachmentName and URL  and 3 buttons[add,update,delete]
> the screen first appear as 1)for the relevant attachment name one select box will be display,user has provision to select the attachment from the select box and change the URL ,then it will added to the DB.
> 2) when the add button is clicked for the relevant attachmentname on textfield will be display, user has provision to enter the attachment name in the textfield and its pair in the URL textfield.again when the update button is clicked the entered value will updated into the DB.
> How i do it? plz give suggestion [ i'm using struts1.1 only and not using struts-EL tags]
> 


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


Re: COMPARING PROPERTY VALUES OF TWO JAVABEANS ...please help

Posted by Craig McClanahan <cr...@gmail.com>.
On Sun, 19 Sep 2004 19:17:25 -0400 (EDT), Frank W. Zammetti (MLists)
<fz...@omnytex.com> wrote:

> Erik's answer is what I would call the correct one... 

I agree as well, but just wanted to point out one additional detail
... if you override the equals() method, you will probably also want
to override the hashCode() method as well, because the semantics of
the two are linked.  Normally this can be done by calculating the hash
for the bean itself based on the hashCode() value of all the
properties -- the important thing is that if equals() returns true,
the hashCode values should be equal.

See the javadocs for java.lang.Object for more details.

Craig

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


Re: COMPARING PROPERTY VALUES OF TWO JAVABEANS ...please help

Posted by "O. Oke" <re...@yahoo.co.uk>.
Erik and Frank,

Thanks.  I would consider your suggestions.

Ola.


 --- "Frank W. Zammetti (MLists)"
<fz...@omnytex.com> wrote: 
> Erik's answer is what I would call the correct
> one... That being said, if
> for some reason you don't want to use that approach,
> I don't think there's
> anything specifically in Struts to do what you want
> anyway, but you might
> want to have a look through the Commons BeanUtils
> packages.  If such a
> thing exists, I'd bet on it being there.
> 
> -- 
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Sun, September 19, 2004 6:47 pm, Erik Weber said:
> > Why don't you just override the equals method in
> your bean class?
> >
> > public boolean equals(Object o) {
> >
> >   if (!(o instanceof MyClass)) return false;
> >
> >   MyClass bean = (MyClass) o;
> >
> >   if (!(name.equals(bean.name))) return false;
> >
> >   if (!(sex.equals(bean.sex))) return false;
> >
> >   //etc. . .
> >
> >   return true;
> >
> > }
> >
> >
> > Then you can just ask:
> >
> > if (bean1.equals(bean2))
> >
> >
> > Erik
> >
> >
> > O. Oke wrote:
> >
> >>Please, I want find out if the value of each of
> the
> >>matching properties in two beans are the same.
> >>
> >>BACKGROUND
> >>==========
> >>I have two JAVABEANS A AND B. They both have name
> and
> >>sex properties amongst others.  I want to find out
> if
> >>A.name == B.name and A.sex == B.sex.
> >>Is there any method in Struts that is designed to
> do
> >>this type of comparison? i.e.
> >>int objName.compareJavaBeans(javaBean1, javaBean2)
> >>
> >>Presently, I am doing this:
> >>String beanBk = customerBeanBk.getCustomerNo()+
> >>customerBeanBk.getFirstName() +
> >>customerBeanBk.getLastName();
> >>...
> >>
> >>String beanDbCp = customerBeanDbCp.getCustomerNo()
> +
> >>customerBeanDbCp.getFirstName() +
> >>customerBeanDbCp.getLastName();
> >>...
> >>if (beanBk.equals(beanDbCp)){   .....   }
> >>
> >>
> >>
> >>Thank you
> >>
> >>
> >>
> >>
> >>
> >>
> >>
>
>>___________________________________________________________ALL-NEW
> Yahoo!
> >> Messenger - all new features - even more fun!
> >> http://uk.messenger.yahoo.com
> >>
>
>>---------------------------------------------------------------------
> >>To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> >>For additional commands, e-mail:
> user-help@struts.apache.org
> >>
> >>
> >>
> >>
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> >
> >
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
>  


	
	
		
___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun!  http://uk.messenger.yahoo.com

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


Re: COMPARING PROPERTY VALUES OF TWO JAVABEANS ...please help

Posted by "Frank W. Zammetti (MLists)" <fz...@omnytex.com>.
Erik's answer is what I would call the correct one... That being said, if
for some reason you don't want to use that approach, I don't think there's
anything specifically in Struts to do what you want anyway, but you might
want to have a look through the Commons BeanUtils packages.  If such a
thing exists, I'd bet on it being there.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Sun, September 19, 2004 6:47 pm, Erik Weber said:
> Why don't you just override the equals method in your bean class?
>
> public boolean equals(Object o) {
>
>   if (!(o instanceof MyClass)) return false;
>
>   MyClass bean = (MyClass) o;
>
>   if (!(name.equals(bean.name))) return false;
>
>   if (!(sex.equals(bean.sex))) return false;
>
>   //etc. . .
>
>   return true;
>
> }
>
>
> Then you can just ask:
>
> if (bean1.equals(bean2))
>
>
> Erik
>
>
> O. Oke wrote:
>
>>Please, I want find out if the value of each of the
>>matching properties in two beans are the same.
>>
>>BACKGROUND
>>==========
>>I have two JAVABEANS A AND B. They both have name and
>>sex properties amongst others.  I want to find out if
>>A.name == B.name and A.sex == B.sex.
>>Is there any method in Struts that is designed to do
>>this type of comparison? i.e.
>>int objName.compareJavaBeans(javaBean1, javaBean2)
>>
>>Presently, I am doing this:
>>String beanBk = customerBeanBk.getCustomerNo()+
>>customerBeanBk.getFirstName() +
>>customerBeanBk.getLastName();
>>...
>>
>>String beanDbCp = customerBeanDbCp.getCustomerNo() +
>>customerBeanDbCp.getFirstName() +
>>customerBeanDbCp.getLastName();
>>...
>>if (beanBk.equals(beanDbCp)){   .....   }
>>
>>
>>
>>Thank you
>>
>>
>>
>>
>>
>>
>>
>>___________________________________________________________ALL-NEW Yahoo!
>> Messenger - all new features - even more fun!
>> http://uk.messenger.yahoo.com
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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


Re: COMPARING PROPERTY VALUES OF TWO JAVABEANS ...please help

Posted by Erik Weber <er...@mindspring.com>.
Why don't you just override the equals method in your bean class?

public boolean equals(Object o) {

  if (!(o instanceof MyClass)) return false;

  MyClass bean = (MyClass) o;

  if (!(name.equals(bean.name))) return false;

  if (!(sex.equals(bean.sex))) return false;

  //etc. . . 

  return true;

}


Then you can just ask:

if (bean1.equals(bean2))


Erik


O. Oke wrote:

>Please, I want find out if the value of each of the
>matching properties in two beans are the same.
>
>BACKGROUND
>==========  
>I have two JAVABEANS A AND B. They both have name and
>sex properties amongst others.  I want to find out if
>A.name == B.name and A.sex == B.sex.
>Is there any method in Struts that is designed to do
>this type of comparison? i.e. 
>int objName.compareJavaBeans(javaBean1, javaBean2)
>
>Presently, I am doing this:
>String beanBk = customerBeanBk.getCustomerNo()+   
>customerBeanBk.getFirstName() +
>customerBeanBk.getLastName();
>...
>
>String beanDbCp = customerBeanDbCp.getCustomerNo() +
>customerBeanDbCp.getFirstName() +
>customerBeanDbCp.getLastName();
>...         	
>if (beanBk.equals(beanDbCp)){   .....   }     	
>
>
>
>Thank you
>
>
>
>
>	
>	
>		
>___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun!  http://uk.messenger.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>  
>

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


COMPARING PROPERTY VALUES OF TWO JAVABEANS ...please help

Posted by "O. Oke" <re...@yahoo.co.uk>.
Please, I want find out if the value of each of the
matching properties in two beans are the same.

BACKGROUND
==========  
I have two JAVABEANS A AND B. They both have name and
sex properties amongst others.  I want to find out if
A.name == B.name and A.sex == B.sex.
Is there any method in Struts that is designed to do
this type of comparison? i.e. 
int objName.compareJavaBeans(javaBean1, javaBean2)

Presently, I am doing this:
String beanBk = customerBeanBk.getCustomerNo()+   
customerBeanBk.getFirstName() +
customerBeanBk.getLastName();
...

String beanDbCp = customerBeanDbCp.getCustomerNo() +
customerBeanDbCp.getFirstName() +
customerBeanDbCp.getLastName();
...         	
if (beanBk.equals(beanDbCp)){   .....   }     	



Thank you




	
	
		
___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun!  http://uk.messenger.yahoo.com

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