index.jsp
<HTML>
<HEAD>
<TITLE>Submitting Text Areas</TITLE>
</HEAD>
<BODY>
<H1>Submitting Text Areas</H1>
<FORM ACTION="basic.jsp" METHOD="POST">
Please enter your text:
<BR>
<TEXTAREA NAME="textarea1" ROWS="5"></TEXTAREA>
<BR>
<INPUT TYPE="SUBMIT" VALUE="Submit">
</FORM>
</BODY>
<HTML>
basic.jsp
<HTML>
<HEAD>
<TITLE>Reading Text Areas</TITLE>
</HEAD>
<BODY>
<H1>Reading Text Areas</H1>
You typed:
<BR>
<%
StringBuffer text = new StringBuffer(request.getParameter("textarea1"));
int loc = (new String(text)).indexOf('\n');
while(loc > 0){
text.replace(loc, loc+1, "<BR>");
loc = (new String(text)).indexOf('\n');
}
out.println(text);
%>
</BODY>
</HTML>
Download: JSPReadFormTextArea.zip( 1 k)23.18.Form TextArea |
| 23.18.1. | Read value in Form TextArea using JSP | |