aspose file tools*
The moose likes JSP and the fly likes Order of the setter methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Order of the setter methods" Watch "Order of the setter methods" New topic
Author

Order of the setter methods

saran ram
Ranch Hand

Joined: Dec 13, 2002
Posts: 69
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

Joined: Jun 18, 2004
Posts: 28
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

Joined: Jan 10, 2002
Posts: 61623
    
  67

the same order as in jsp?


What order? The JSP specifies no explicit or implied order.
[ November 28, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: Order of the setter methods