aspose file tools*
The moose likes JSP and the fly likes Can't display large amounts of text - help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Can Watch "Can New topic
Author

Can't display large amounts of text - help

Mark Stringham
Greenhorn

Joined: Nov 30, 2001
Posts: 12
I have a form that allows a user to cut and paste text into an HTML text area and then submit to a second page which will display what they have submitted.
I am using request.getParameter(""); to retreive the submitted text. My problem is if the user cuts and pastes a large amount of text and then submits - it breaks
If the text isn't quite as long - it submits fine.
Is there another way to capture large chunks of data that is submitted through a form? (like the size of a magazine article)
It's like the request.getParameter("") will only accept a certain amount of data and then break.
Anyone heard of this?
Any ideas?
Thanks
Mark

------------------
A gentle push and a mild arc, and the cowhide globe hits home - Hot Rod Hundley


A gentle push and a mild arc, and the cowhide globe hits home - Hot Rod Hundley
Dharmesh Chheda
Ranch Hand

Joined: May 08, 2001
Posts: 204
Hello Mark
well you are right. Both netscape and IE have certain maximum length for the url in the address field..so using the request.getParameter your program will cause problems for passing paragraphs.
what you can do is use Beans and bind it to the session . and on the next page get the value using some getXXX method.


regards,<br />Dharmesh Chheda
Mark Stringham
Greenhorn

Joined: Nov 30, 2001
Posts: 12
Thanks Dharmesh for your insight.
I have a few more questions now ....
1)
I'm not sure what you mean by
<b>"Both netscape and IE have certain maximum length for the url in the address field..so using the request.getParameter your program will cause problems for passing paragraphs."</b>
I am passing all data by "post" so none of it gets passed via the URL.
2)<b>...what you can do is use Beans and bind it to the session . and on the next page get the value using some getXXX method.</b>
How is this done? do I pass the string into a session var and then call it? If so, I have already tried something like this and got the same result.
Any code or explanation would be helpful


Mark
------------------
A gentle push and a mild arc, and the cowhide globe hits home - Hot Rod Hundley
Dharmesh Chheda
Ranch Hand

Joined: May 08, 2001
Posts: 204
I am passing all data by "post" so none of it gets passed via the URL
since you are passing using method="POST" data is passedas a seperate section following the HTTP header. and the header also has a limited length beyond which passing of data wont occur.
as far as the second solution is concerned.. when i thought about it .. me too got into slight confusion and and figured that the second method i mentioned will not work as required.. but i am trying to get a solution so will get back to you in no time.. in the mean time in case you get the solution .. notify me .
------------------
IBM Certified WebSphere Application Server V3.5 Specialist
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16137
    
  21

In theory, at least, the amount of data you can submit in a POST is unlimited. What I suspect is more likely is that there's a maximum capacity in the the textarea controls themselves like the old Windows 64K limit. If so, that contstraint would be imposed by the browser. To get around it, you'd probably have to use a Java applet or ActiveX that could be pasted to.


Customer surveys are for companies who didn't pay proper attention to begin with.
Mark Stringham
Greenhorn

Joined: Nov 30, 2001
Posts: 12
Thanks again for your input. I seriously can't believe there isn't a good way to input a chunk of text and pull it out.
I am developing a content management system that allows office staff to update their own website via a form and haven't had any problems retrieving most text using the getParameter("") method.
It just breaks when the text reaches a certain length.
Is there a buffer control that can be used?
thanks again,
Mark
------------------
A gentle push and a mild arc, and the cowhide globe hits home - Hot Rod Hundley
Mark Stringham
Greenhorn

Joined: Nov 30, 2001
Posts: 12
Anyone have any ideas?
I am completely stumped.
Mark
------------------
A gentle push and a mild arc, and the cowhide globe hits home - Hot Rod Hundley
Frank Lin
Ranch Hand

Joined: Jan 26, 2001
Posts: 76
Mark,
What is the exact error message? What is the size of text when it starts causing problem?
Mark Stringham
Greenhorn

Joined: Nov 30, 2001
Posts: 12
If I submit 8-10 paragraphs of text the browser crashes - I get "the page cannot be displayed" or if I refresh - I get a "null error" But if I submit 5-6 paragraphs through the text area - it submits fine and displays.
I really think there is a buffer or browser limit to how much text you can submit - but I'm not sure.
Again, any help is appreciated.
Mark
------------------
A gentle push and a mild arc, and the cowhide globe hits home - Hot Rod Hundley
Frank Lin
Ranch Hand

Joined: Jan 26, 2001
Posts: 76
Mark,
is there any error message on the server side when it breaks? How do you know it breaks at getParameter()? If you see some errors on the server side, then it does not look like browser issue(I doubt about it). Can you add some println statements in your servlet program to see exactly where it breaks? By the way, what application server or servlet container do you use?
Mark Stringham
Greenhorn

Joined: Nov 30, 2001
Posts: 12
If I submit a large amount of text through the form and then submit - like I said - I get "this page cannot be displayed" error. If I then refresh, I get a "null" error. I can't even display a results page to see where or if an error has occurred.
I am using JRUN 3.0 as my app server.
Thanks
Mark
Sarath Mohan
Ranch Hand

Joined: Mar 17, 2001
Posts: 213
Mark,
I suppose you have to pass a chunk of text to another page without any page.
Could you try this?
capture the text in a String variable.
in the source page
request.setAttribute("chunk", text);
in the destination page use
String text = request.getAttribure("chunk");
and try to print
Correct me if i am wrong or misunderstood your question
Thanks
Binu

Sarath Mohan
Jian Zhang
Greenhorn

Joined: Aug 30, 2003
Posts: 20
maybe the default value of your browse set the 'wrap' attribute to off, so use wrap=virtual to return data which is not broken and wrap=physical to send data with newline characters
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
It sounds like you are using a MSIE browser, if so, it might help to turn off "friendly" error messages so you can see exactly what the servlet returns. Tools ->Internet Options -> advanced - uncheck "friendly error messages."
Bill
Rahul Juneja
Ranch Hand

Joined: Aug 03, 2002
Posts: 425
I think this problem can be resolved by setting the same text value in Session as setAttribute.
And then fetching the attribute value


Rahul Juneja
ThoughtClicks - http://techlabs.thoughtclicks.com
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Can't display large amounts of text - help