#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2001
    Posts
    94
    Rep Power
    13

    Can't display large amounts of text - help


    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
    Coach
    A gentle push and a mild arc -
    And the cowhide globe hit home

    Hot Rod Hundley
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Posts
    68
    Rep Power
    14
    if you are passing it in a form and your METHOD=POST, it shouldnt be truncating... if you arent specifying, or METHOD=GET, there is a max value allowed in the URL... are you using POST and it is still getting truncated?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2001
    Posts
    94
    Rep Power
    13
    using POST in the method -
    I think it has to do with chars that get passed when you cut or paste.

    Dunno - still stumped.

    Coach
    A gentle push and a mild arc -
    And the cowhide globe hit home

    Hot Rod Hundley
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Posts
    45
    Rep Power
    14
    try throwing it in the session. If you have size issues still, put it in a vector and then in the session.

    Just a thought.....
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2001
    Posts
    94
    Rep Power
    13

    How would a vector help?


    All the information that is posted by the form is already passed to a session. You recommend a vector first and then a session?

    How would a vector help in this situation? I think the issue is that when special chars are included in a submitted form - JSP doesn't like it. I've seen this before with another application. Funny thing is it only occurs with rather large amounts of text.

    But I can't even get the text into a session var because the form crashes first before I declare a session var.

    Any example code?

    Thanks

    Mark
    A gentle push and a mild arc -
    And the cowhide globe hit home

    Hot Rod Hundley
  10. #6
  11. No Profile Picture
    Java Developer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Posts
    5
    Rep Power
    0
    For clarification you need your serlvet to generate some HTML like:

    <HTML>
    <FORM METHOD=POST>
    <TEXTAREA NAME=TEST></TEXTAREA>
    <INPUT TYPE=SUBMIT>
    </FORM>
    </HTML>

    Then you need to override the doPost method of HttpServlet, and not worry about the doGet. Your doPost could be like this

    public void doGet(HttpServletRequest rq, HttpServletResponse rs)
    throws IOException, ServletException{
    String testString=req.getParameter("TEST");
    }

    And now testString contains to contents of your text area. I haven't tested this, but I'm sure I've done this plently of times in the past. Coach...If your having still having trouble, re-post (maybe with some of your code) and I'll have a look. But it sounds to me like either
    1) you are not putting in the Method=post
    OR
    2) you are servicing the requests with the doGet

    Hope this was of some help

IMN logo majestic logo threadwatch logo seochat tools logo