beans

Reply

Join Date: Mar 2008
Posts: 57
Reputation: hajjo is an unknown quantity at this point 
Solved Threads: 0
hajjo hajjo is offline Offline
Junior Poster in Training

beans

 
0
  #1
Aug 29th, 2009
consider i have this bean

  1. private string name = "fadi";
  2. public String getname()
  3. {
  4. return (name);
  5. }
  6. public String setName(String name1)
  7. {
  8. name = name1;
  9. return (name);
  10. }

Now I have jsp file..

  1. <%
  2. beanid.setname("lol");
  3. beanid.getname();
  4. %>

Now with this code name was fadi, i changed it into lol. Now I want to change it back to the original one. I dont want to do it by calling beanid.setname("fadi"); .. is there any other way?? thank you very much.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: beans

 
0
  #2
Aug 29th, 2009
I dont want to do it by calling beanid.setname("fadi"); .. is there any other way??
Well you could use the <jsp:setPropery> tag, but may I ask what you are trying to achieve with it ?
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 57
Reputation: hajjo is an unknown quantity at this point 
Solved Threads: 0
hajjo hajjo is offline Offline
Junior Poster in Training

Re: beans

 
0
  #3
Aug 29th, 2009
yes i can tell you. I have dictionary of words stored as array string ..

"ADD","DELETE" and so on..

I have a form where user enters words he wants to translate
say he adds ADD and his translation insert..
now array[0] is changed to insert ..
but in case he then deletes the the record( record that add = insert in the database), I want the array[0] to be back equal to ADD.



This is assignment I have. I also have to use getname(0) for add buttons..
so in case he changed it to insert, button value is insert...
Last edited by hajjo; Aug 29th, 2009 at 2:33 pm.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 57
Reputation: hajjo is an unknown quantity at this point 
Solved Threads: 0
hajjo hajjo is offline Offline
Junior Poster in Training

Re: beans

 
0
  #4
Aug 29th, 2009
basically i want to reset the beans into their original values in case of a record being deleted from the database.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,612
Reputation: adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of 
Solved Threads: 463
Moderator
adatapost's Avatar
adatapost adatapost is offline Offline
Posting Maven

Re: beans

 
0
  #5
Aug 30th, 2009
Create an instance of jsp bean with session scope and set value for each field once record after deletion of record in your controller.
Failure is not fatal, but failure to change might be. - John Wooden
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC