aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes retrieving textarea contents into a bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "retrieving textarea contents into a bean" Watch "retrieving textarea contents into a bean" New topic
Author

retrieving textarea contents into a bean

J Pleau
Greenhorn

Joined: Oct 09, 2003
Posts: 3
Hi All

I have a form that has a textarea field, but after I submit the form, the textarea field is always null (on the database as well). I am not sure why this is happenning. I am using a bean for the form variables and then processing through a JSP. If any fields are missing, then the form is redisplayed with some erros messages and the user must try again. I want the original values from the textarea on the form to be displayed on the retry form. Here is the code (I have left out the non-releveant portions):

Original form:

<form action="process.jsp" method=post>
.....
<p class="subhead2">Additional Comments</p>
<p>Please include any comments you wish regarding your experiences with the documentation.
</p>
<p><a href="#"></a><textarea name="additionalComments" cols="50" rows="5" id="additionalComments"></textarea><a href="#"></a>
</p>
......
<p><a href="#"></a><input type="submit" name="Submit" value="Submit" />
</p>
</form>

The retry form section regarding the textarea:

<p class="subhead2">Additional Comments</p>
<p>Please include any comments you wish regarding your experiences with the documentation.
</p>
<p><a href="#"></a><textarea name="additionalComments" cols="50" rows="5" id="additionalComments">
<%=formHandler.getadditionalComments()%>
</textarea><a href="#"></a>
</p>

The bean code:

package docSurvey.mypackage;
import java.util.*;

public class FormBean {

private String additionalComments;
public FormBean() {
AdditionalComments = "";
}
public String getadditionalComments() { return additionalComments; }
public void additionalComments( String value )
{
additionalComments = value;
}
}

Thanks for any help you can offer
Jeff
J Pleau
Greenhorn

Joined: Oct 09, 2003
Posts: 3
Found my mistake...dumb one

I forgot the 'set' when declaring the set method

I had

public void additionalComments( String value )

should have been

public void setadditionalComments( String value )

Jeff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: retrieving textarea contents into a bean
 
Similar Threads
How can I include a file(.html) in jsp dynamically.
form problems
My form submit is called twice
GET Method Working But POST is not
how do I submit without a submit button textarea contents