Results 1 to 8 of 8
  1. #1
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    396
    Rep Power
    6

    Default How to use request.setAttribute() in JSP?

    Hi,

    I need to pass a string that s too long from JSP to servlet. What i did was I made one hidden variable and assign that sting in that variable. In servlet i use request.getParameter(). It worked perfectly. Since my string have had some special chars I was not able to request.getParameter.So I used session.setArrribute().NOw it works so fine. But instead of that I need to use request.setAttribute(). When I do this , I am getting NullPointerException in my servelt. Hope you understand Where I stuck. CAn we use req.setAttribute() in Jsp? If So, How.?
    Mak
    (Living @ Virtual World)

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default

    Moved from New to Java

    db

  3. #3
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    396
    Rep Power
    6

    Default

    Thanks DarrylBurke. I apologise you for my mistake.
    Mak
    (Living @ Virtual World)

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,445
    Rep Power
    18

    Default

    Can you do us a cutdown version of your problem?
    The JSP, the Servlet, the call map (JSP -> client -> Servlet).
    I'm trying to figure out what you're up to.

  5. #5
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    396
    Rep Power
    6

    Default

    I have to pass a too long string from JSP to servlet. That s the cut down version of my problem.
    Mak
    (Living @ Virtual World)

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,445
    Rep Power
    18

    Default

    What's "too long"?
    Where is the String coming from?
    You aren't giving us much information to go on here.

  7. #7
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    396
    Rep Power
    6

    Default

    that string has 500 chars. It s created in JSP page depends on certain conditions. Did you get enough information.? if not I am ready to explain.
    Mak
    (Living @ Virtual World)

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,445
    Rep Power
    18

    Default

    Now, lots of people get his terminology wrong.
    By "created in JSP page" do you mean it is created on the server?
    Can you show the code?

Similar Threads

  1. Replies: 1
    Last Post: 05-10-2011, 08:10 AM
  2. multipart request
    By nn12 in forum Advanced Java
    Replies: 1
    Last Post: 04-27-2011, 04:47 PM
  3. Replies: 1
    Last Post: 11-30-2010, 05:08 PM
  4. Problem with setAttribute()
    By R O C K Y in forum Advanced Java
    Replies: 7
    Last Post: 02-09-2009, 01:06 PM
  5. Replies: 2
    Last Post: 01-27-2009, 04:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •