View Single Post
Old 02-22-08, 11:12 PM   #2
jcrox
Mahna Mahna
 
jcrox's Avatar
 
Join Date: Jul 2006
Location: Madison, Wi
Posts: 6,134
Default Re: Arrays in JSP's?

lets say you have a form in your JSP with fields with these names:

add1
add2
add3

you fill in the data, click the submit button....

in your servlet:

private webBean bean;

create an array and populate it with the form fields
String[] adds = {request.getParameter("add1"), request.getParameter("add2"), request.getParameter("add3")};

instantiate a new bean and pass the array to the beans constructor
bean = new webBean(adds);

in your webBean constructor:

public webBean(String[] adds) {

setAddress1(adds[0]);
setAddress2(adds[1]);
setAddress3(adds[2]);
}


Is that about what you're trying to do?
__________________

Gaming

MSI MPower Z87 | 4770k | CNPS9900MAX-B | 8GB G.Skill 1866 | EVGA GTX760 |ThermalTake 850w | X-Fi Titanium | HAF | Asus PA248Q | Lycosa | Death Adder | Win8 Pro 64

Dev/Backup

MSI GD65 | 2500k | H50 | 8GB G.skill | GTX570 | Ubuntu 13.10

Laptop

17" Inspiron | i5 | 4GB DDR3 | 500GB HDD | Win7 Pro 64

jcrox is offline   Reply With Quote