wood burning stoves
The moose likes JSP and the fly likes storing textfield values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "storing textfield values" Watch "storing textfield values" New topic

storing textfield values

Brandon Broschinsky
Ranch Hand

Joined: Aug 21, 2004
Posts: 41
I have a jsp page that is created dynamically. The number of text boxes is created dynamically, and i don't know before hand how many there will be. I know that if I name the text boxes the same i can store the value in an array. My question is there anyway to do this using a bean. i.e. I have a bean that i am storing all the values in from the text fields using setters. But if all the text fields are the same name is there a way to store these values in an array in the bean.
Here is my jsp
<head><title>JSP Page</title></head>
<body bgcolor="#F0E9D7">

<jsp:useBean id="write" scope="request" class="Beans.WriteBean" />
<jsp:setProperty name="write" property="*"/>
<form action="index.jsp" method="post">
<input type=text name=email value="whaterver" size="15">
<input type=text name=email value="whaterver" size="15">
<input type="submit">

and my bean is just a simple bean shown below
public class WriteBean extends Object implements Serializable {
private String fileName;
String email;

public WriteBean() {

public void setEmail(String name){
email = name;
public String getEmail() { return email; }

public void writeFile(String name){
FileWriter out = new FileWriter("C:/Documents and Settings/Bbroschinsky/Desktop/"+email+".txt");
out.write("test for out");
}catch(IOException e){

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63342

Look up the term "indexed property" with regards to JavaBeans.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link: http://aspose.com/file-tools
subject: storing textfield values
It's not a secret anymore!