Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

retrieving textarea contents into a bean

 
J Pleau
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic