Results 1 to 20 of 23
- 07-14-2008, 10:00 AM #1
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.
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.Java Code:<a class=menutd href=simpleSearch.htm?docvector=" + resultant_docvector + "&similarType=" + find + ">Find</a>
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
- 07-14-2008, 10:38 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
I don't think there is such a limitation. Did you try a long character sequence, and if so any errors you get?
- 07-14-2008, 11:43 AM #3
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.
- 07-14-2008, 11:58 AM #4
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??
- 07-14-2008, 12:21 PM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Before any suggestion, can you find the appended length there. Using that we may able to come across with a suggestion at all.
- 07-14-2008, 12:30 PM #6
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 :)
- 07-14-2008, 04:25 PM #7
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.
- 07-14-2008, 07:25 PM #8
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
- 07-14-2008, 07:51 PM #9
bookmarking
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
- 07-14-2008, 08:08 PM #10
Thanks for the new term.nonce
- 07-14-2008, 08:15 PM #11
Yes, your upthread post had the right idea, without the word.
Defined here:
Cryptographic nonce - Wikipedia, the free encyclopedia
- 07-15-2008, 02:43 AM #12
check it out, Norm
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
- 07-15-2008, 04:00 AM #13
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.
- 07-15-2008, 06:39 AM #14
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> }
- 07-15-2008, 06:43 AM #15
Also one thing i noticed,
If i use the post method, values ll not appear in the url.
Now when i submit the page i was unable to see java in the urlXML 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>
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..
- 07-15-2008, 03:14 PM #16
setLocation()
Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
- 07-16-2008, 07:00 AM #17
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)..
- 07-16-2008, 11:03 PM #18
- 07-17-2008, 06:45 AM #19
Fine. For this, i tried something like below,
the javascript code as below,XML Code:<input type="hidden" name="text1" value="" /> <a href=simpleSearch.htm?name=freddie&lastname=maize target="_blank" onclick="call(href);">index</a>
Purpose of the above code,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]); }
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???
- 07-17-2008, 06:49 AM #20
Similar Threads
-
JLabel append?
By Jononomous in forum New To JavaReplies: 0Last Post: 04-07-2008, 07:41 PM -
Simple append question
By Rageagainst20 in forum New To JavaReplies: 0Last Post: 12-20-2007, 11:40 PM -
Append text inputed in the textfield into a TextArea
By romina in forum AWT / SwingReplies: 1Last Post: 08-07-2007, 05:35 AM -
Error: Non-static method append(char) cannot be referenced from a static context
By paul in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 05:05 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks