943,929 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Unsolved
  • Views: 493
  • JSP RSS
Aug 29th, 2009
0

beans

Expand Post »
consider i have this bean

JSP Syntax (Toggle Plain Text)
  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..

JSP Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster
hajjo is offline Offline
101 posts
since Mar 2008
Aug 29th, 2009
0

Re: beans

Quote ...
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 ?
Featured Poster
Reputation Points: 653
Solved Threads: 151
Nearly a Posting Virtuoso
stephen84s is offline Offline
1,316 posts
since Jul 2007
Aug 29th, 2009
0

Re: beans

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.
Reputation Points: 10
Solved Threads: 0
Junior Poster
hajjo is offline Offline
101 posts
since Mar 2008
Aug 29th, 2009
0

Re: beans

basically i want to reset the beans into their original values in case of a record being deleted from the database.
Reputation Points: 10
Solved Threads: 0
Junior Poster
hajjo is offline Offline
101 posts
since Mar 2008
Aug 30th, 2009
0

Re: beans

Create an instance of jsp bean with session scope and set value for each field once record after deletion of record in your controller.
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,527 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: read value from jsp page to servlet
Next Thread in JSP Forum Timeline: reset a bean to null





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC