• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

retrieving textarea contents into a bean

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic