Page 1 of 2 12 LastLast
Results 1 to 20 of 23
  1. #1
    Join Date
    Apr 2008
    Posts
    64
    Rep Power
    0

    Default Can we append more than 255 chars to <a href>??

    Hello Everybody,

    I've a small doubt for a big purpose

    Can i append more than 255 chars in href. I mean in the below code can resultant_docvector be more than 255 chars.

    Java Code:
    <a class=menutd href=simpleSearch.htm?docvector=" + resultant_docvector + "&similarType=" + find + ">Find</a>
    I tried. If resultant_docvector is not so lengthy its getting appended. However if its exceed a limit (really dont know the limt, but if its too lenghty comparing to other resultant_decvector) its not getting appended.

    CORRECT ME IF I'M WRONG: Also if its (resultant_docvector) too lenght, then atleast 255 chars must get appended cutting off the rest.

    Regards

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    I don't think there is such a limitation. Did you try a long character sequence, and if so any errors you get?

  3. #3
    Join Date
    Apr 2008
    Posts
    64
    Rep Power
    0

    Default

    Nope. I'm not getting error messages. But if we hover over the link we can see the address in the status bar rite. But my status bar is blank..
    The reason why i thought of those limitation is that, few of the links whose appended values are not so length are working fine, however if the appended values is lenght my status bar is null and the link is also not working.

  4. #4
    Join Date
    Apr 2008
    Posts
    64
    Rep Power
    0

    Default

    Yes Eranga. There is a limitation. But i dont know what exactly is the limit.

    I tried appending a values. Worked fine. But when i increased the lengh of the value the link was not working fine.
    Any suggestions??

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Before any suggestion, can you find the appended length there. Using that we may able to come across with a suggestion at all.

  6. #6
    Join Date
    Apr 2008
    Posts
    64
    Rep Power
    0

    Default

    For example, in the application that i'm building, an appended value was 4089 bytes which was not appended successfully.
    Few other appended values where 1022 bytes and 2083 bytes which where successfully appended.
    But i coouldnt count the lenth of it since it was very big :)

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    How about changing the app to keep the long string on the server and only pass an index to it in the HTML. When the server gets the HTTP GET, it would use the index to retrieve the full string.

  8. #8
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Its bad form to have long parameters in a GET even if it seems to work. There are fewer restrictions on a POST and its better for security to use POST over GET in most cases.

    Since no human is generating this long paramter, why not shorten it? If its coming from a form, just write out a nonce into a hidden field, or as the only parameter to the GET and use the nonce to index into a HashMap to get all the complicated stuff.

    Plus a nice 16 character nonce is faster to send, and has lower bandwidth charges, than your 255+ character argument block

  9. #9
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Post bookmarking

    Quote Originally Posted by Norm View Post
    ... and index to it in the HTML. ...
    This can be used in bookmarking by placing an abbreviated name / value pair in the url and doing the real work in POST method as suggested by fishtoprecords.
    Last edited by Nicholas Jordan; 07-14-2008 at 08:00 PM.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  10. #10
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    nonce
    Thanks for the new term.

  11. #11
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by Norm View Post
    Thanks for the new term.
    Yes, your upthread post had the right idea, without the word.

    Defined here:
    Cryptographic nonce - Wikipedia, the free encyclopedia

  12. #12
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Exclamation check it out, Norm

    Quote Originally Posted by Norm View Post
    Thanks for the new term.
    Norm,
    You should go look at his base64 converter. It is linked somewhere on his site and is masterwork level coding in Java. Given your skills in the matter, I thought it correct to point you towards this as the caliber of work is rare and above what we often see in Java discussions.

    ( not trying to suck-up, Pat ~ that's just the way it is )
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  13. #13
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    That's interesting. That was one of my projects. I wrote a program to encode/decode any file with the idea that I could send an image in an email message to someone that wasn't allowed to download attachments. The person could copy the base64 text from the email and recreate the file using my program. Sort of the way a browser does it.
    Pat's/Carl's code is very nicely documented and laid out. As an aid to user's I often add some comments or an example of how to use it and what the output will be for the given input. It helps me figure out to use the dozens of little utilities I've written.

  14. #14
    Join Date
    Apr 2008
    Posts
    64
    Rep Power
    0

    Default

    In my case, (lots of link would be created)every link that i create has to be shown in the browser and every link has to do an action which in turn needs a value (which am sending as parameter). Since every link's value (which am sending as parameter) is unique i cannot use sessions. There is no other option other than appending the value.

    Using session would be a good idea. However in my case, like i mentioned earlier, every link has different value. So if the user clicks a link, appropraite value has to be passed in the query time.

    My link creation is something like below,
    Java Code:
    for(int i=0; i<intMaxResultsPerPage;i++){ result_list.add("<font class='fastLocationLabel'><strong>Similar: </strong></font>    <a class=menutd href=simpleSearch.htm?docvector=" + resultant_docvector + "&similarType=" + find + ">Find Similar</a> }

  15. #15
    Join Date
    Apr 2008
    Posts
    64
    Rep Power
    0

    Default

    Also one thing i noticed,

    If i use the post method, values ll not appear in the url.

    XML Code:
    <form method="post" action='simpleSearch.htm'> <input type='text' value='java'/> <a href=simpleSearch.htm?value=freddie>who am i</a> <!--then am submitting the form--> </form>
    Now when i submit the page i was unable to see java in the url
    However
    when i click "whom am i" the value freddie was in the url....

    Any idea why.. I have given post.. but then too values where visible in the url..

  16. #16
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Post setLocation()

    Quote Originally Posted by freddieMaize View Post
    (... snip ...)Any idea why.. I have given post.. but then too values where visible in the url..
    Probably response.setLocation();

    I've hit a pdf and have to go down for a re-boot to regain control of my machine. Sorry, be back in a moment.

    16-bit single threaded dlls are the root of all evil.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  17. #17
    Join Date
    Apr 2008
    Posts
    64
    Rep Power
    0

    Default

    One thing i recently came to know was that, all links work in Get () though the href code reside in the Post (). So we have some kind of restricition to lenght of the value that we are appending (to a link)..

  18. #18
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by freddieMaize View Post
    If i use the post method, values ll not appear in the url.
    That is a feature. With a GET, the parameters are appended to the URL. With a post, you have to either pull them by hand, or setup your Bean to have the JSP automatically call your setters

  19. #19
    Join Date
    Apr 2008
    Posts
    64
    Rep Power
    0

    Default

    Fine. For this, i tried something like below,

    XML Code:
     
    <input type="hidden" name="text1" value="" />
    <a href=simpleSearch.htm?name=freddie&lastname=maize target="_blank" onclick="call(href);">index</a>
    the javascript code as below,

    Java Code:
     
    function call(a){
                    alert(a);
                    var first = new Array();
                    var second = new Array();
                    var third = new Array();
                    first=a.split(".htm?");
                    alert(first[0]);
                    alert(first[1]);
                    second= first[1].split("&last");
                    alert(second[0]);
                    third=second[0].split("name=");
                    alert(third[1]);
                }
    Purpose of the above code,
    the get the values of 'name' parameter and put it in the hidden field, so that i can set it in my form bean.

    Working fine.

    So, I changed the vaule of name from "freddie" to some lenghty value (size of the values is 4kB) and tried. Got invalidpointer error in javascript..

    Any thing striking for you ppl???

  20. #20
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    I can't follow you.

    The GET or POST is to the HTTP server that runs the servlet. It normally is programmed in Java.

    Any javescript runs on the browser and has nothing to do with the GET or POST

Page 1 of 2 12 LastLast

Similar Threads

  1. JLabel append?
    By Jononomous in forum New To Java
    Replies: 0
    Last Post: 04-07-2008, 07:41 PM
  2. Simple append question
    By Rageagainst20 in forum New To Java
    Replies: 0
    Last Post: 12-20-2007, 11:40 PM
  3. Replies: 1
    Last Post: 08-07-2007, 05:35 AM
  4. Replies: 1
    Last Post: 08-07-2007, 05:05 AM

Posting Permissions

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