Accessing javabeans from a form within a form multiply times?

[nobr]Hello

I have a form that gets the name of a term and some other information and then gets different values that can be attached to this term for example different URLs. the form looks something like this:

<form id="expertForm" method="post">

<input type="hidden" name="sendAll" /><br />

<table>

<tr>

<td>Terms name:</td>

<td><input type="text" name="termname"></td>

</tr>

<tr>

<td>Description:</td>

<td><textarea rows="2" cols="20" name="description"></textarea></td>

</tr>

<tr>

<form id="expertRelForm" method="post">

<table>

<tr>

<td>Relationship:</td>

<td><textarea rows="1" cols="20" name="relationship"></textarea></td>

<td>

<select name="relType">

<option value="isa">Is_A</option>

<option value="partof">Part_Of</option>

</select>

</td>

</tr>

<tr>

<td align="right" colspan="">

<input type="submit" name="addRelation" value="Add"></td>

</tr>

</table>

</form>

</tr>

<tr>

<td align="right" colspan="2">

<input type="submit" name="termForm" value="ok"></td>

</tr>

</table>

</form>

<br>

I'm thinking of using a Javabean, i should use one, but how can I use the set method of the Javabean with the "add" button in the inner form, by clicking on this button I should be able to add different values to the javabean.

I want the user to be able to add different values if needed.

cheers,

ehsan[/nobr]

[2409 byte] By [Ehsan.Sa] at [2007-11-27 11:18:02]
# 1

public ArrayList addValue(String newVal) {

try {

ArrayList example = new ArrayList();

MyBean bean = new MyBean();

bean.setName(newVal);

example.add(bean);

} catch (Exception e) {

e.printStackTrace();

}

return example;

}

By clicking the add button, pass the new value to your BO and add it to the bean.

skp71a at 2007-7-29 14:28:23 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Hello

Thanks for the code, but I don't need an array of beans. By the way this code make a bean and an arraylist everytime it's called?

I was looking for something like this:

<form action="myjsp.jsp" method="post">

....

...

so after submitting the result will go to the myjsp.jsp file and in the myjsp.jsp file

<jsp:useBean id="value" class"myBean">

<jsp:setpropertiy name"value" ....>

so everytime I click the add button the values will go the mysjp.jsp file and that will set them in the javabean file. this method uses two files but I was looking for doing this in the same jsp file and not sending it to another file.

chers

Ehsan

Ehsan.Sa at 2007-7-29 14:28:23 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...