0

consider i have this bean

private string name = "fadi";
public String getname()
{
return (name);
}
public String setName(String name1)
{
name = name1;
return (name);
}

Now I have jsp file..

<%
beanid.setname("lol");
beanid.getname();
%>

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.

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by __avd
0

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 ?

0

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...

0

basically i want to reset the beans into their original values in case of a record being deleted from the database.

0

Create an instance of jsp bean with session scope and set value for each field once record after deletion of record in your controller.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.