Click here to Skip to main content
15,881,840 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Experts,

I have a JSP form page which has Text Area field.I have a string contains 300 lines. when I paste the content in text area field, it accepting the content.but when i submit the form, page got stuck there only and not moving to servlet.

If I give less than 50/60 lines. its accepting and moving the content to servlet. Any pointers would help how to achieve getting this 300 lines of content to servlet from jsp.

here is my index.jsp
HTML
<form id="form1" name="form1" action="FirstwebServlet">
    <div id="textAreaField"  style="display: none;" >
        <textarea rows="50" cols="50" id="textAreaField" name="textAreaField">Please pass your custom filter in Standard format. please refer HyperLink for the format.</textarea>
    </div>
</form>

-------------------------------------------------------------------------
My servlet on submitting this index.jsp form will be called and it has the below code

In FirstwebServlet this is the code,
Java
StringBuffer test= new StringBuffer(request.getParameter("textAreaField"));
System.out.println("get the TextAreaFieldValue: "+test);

My string test has 300 lines of string. Its not working.
--------------------------------------------------------------------

What I have tried:

I tried the same with html and its working. not sure if the servlet doesn't have the capability or not. Please advise.

index.jsp
HTML
<HTML>
    <HEAD>
        <TITLE>Submitting Text Areas</TITLE>
    </HEAD>    
    <BODY>
        <H1>Submitting Text Areas</H1>
        <FORM ACTION="formAction.jsp" METHOD="POST">
            Please enter your text:
            <BR>
            <TEXTAREA NAME="textarea1" ROWS="5"></TEXTAREA>
            <BR>
            <INPUT TYPE="SUBMIT" VALUE="Submit">
        </FORM>
    </BODY>
<HTML>

-----------------------------------------------------------------------------
formAction.jsp
HTML
<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>
Posted
Updated 24-Oct-19 6:22am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900