• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Order of the setter methods

 
saran ram
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have a jsp file as below:

<jsp:useBean id="person" class="com.nextlinx.tc.SaranUseBeanTest" scope="session" />
<jsp:setProperty name="person" property="*"/>

<html>
<body>
<form>

First Name: <input type="text" name="first" value="" ><br>
Middle Name: <input type="text" name="middle" value="" ><br>
Last Name: <input type="text" name="last" value="" >

<input type="submit" name="submit">
</form>
</body>
</html>

& .java file as

package com.nextlinx.tc;

import java.util.*;

public class SaranUseBeanTest {

public String a = "";
public String b = "";
public String c = "";

public void setFirst(String value){
System.out.println("*****First: " + value);
a = value;
}

public void setMiddle(String value){
System.out.println("*****Middle: " + value);
b = value;
}

public void setLast(String value){
System.out.println("*****Last: " + value);
c = value;
}

public String getFirst(){
return a;
}

public String getMiddle(){
return b;
}

public String getLast(){
return c;
}
}

Now will the setter methods will be called in the same order as in jsp?
ie. setFirst,setMiddle,setLast.
Though it may not have any significant effect.
Just I want to clarify..
[ November 28, 2005: Message edited by: Bear Bibeault ]
 
C Broussard
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm only taking a stab at this. but i think it's totally dependant on how
they come across in the POST or GET. the webbrowser builds this based on the RFC specification for the http protocol. so you can not guarantee this order, since each browser is different. i wouldn't rely on it.

www.binaryfrost.com
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the same order as in jsp?


What order? The JSP specifies no explicit or implied order.
[ November 28, 2005: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic