|
|
Welcome to the Java Forums.
You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:
- have access to post topics
- communicate privately with other members (PM)
- not see advertisements between posts
- have the possibility to earn one of our surprises if you are an active member
- access many other special features that will be introduced later.
Registration is fast, simple and absolutely free so please, join our community today!
If you have any problems with the registration process or your account login, please contact us.
|
|

07-14-2008, 12:00 PM
|
 |
Member
|
|
Join Date: Apr 2008
Posts: 64
|
|
|
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.
<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
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

07-14-2008, 12:38 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 5,075
|
|
|
I don't think there is such a limitation. Did you try a long character sequence, and if so any errors you get?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Someone helped you? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post. Help: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. Resources: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. Web: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. Tips: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

07-14-2008, 01:43 PM
|
 |
Member
|
|
Join Date: Apr 2008
Posts: 64
|
|
|
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.
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

07-14-2008, 01:58 PM
|
 |
Member
|
|
Join Date: Apr 2008
Posts: 64
|
|
|
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??
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

07-14-2008, 02:21 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 5,075
|
|
|
Before any suggestion, can you find the appended length there. Using that we may able to come across with a suggestion at all.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Someone helped you? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post. Help: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. Resources: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. Web: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. Tips: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

07-14-2008, 02:30 PM
|
 |
Member
|
|
Join Date: Apr 2008
Posts: 64
|
|
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 
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

07-14-2008, 06:25 PM
|
 |
Senior Member
|
|
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,225
|
|
|
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, 09:25 PM
|
 |
Senior Member
|
|
Join Date: Jun 2008
Posts: 533
|
|
|
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, 09:51 PM
|
 |
Senior Member
|
|
Join Date: Jun 2008
Location: Southwest
Posts: 880
|
|
|
bookmarking
Originally Posted by Norm
... 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.
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. .
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
Last edited by Nicholas Jordan : 07-14-2008 at 10:00 PM.
|
|

07-14-2008, 10:08 PM
|
 |
Senior Member
|
|
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,225
|
|
|
|
|

07-15-2008, 04:43 AM
|
 |
Senior Member
|
|
Join Date: Jun 2008
Location: Southwest
Posts: 880
|
|
|
check it out, Norm
Originally Posted by Norm
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 )
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. .
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
|
|

07-15-2008, 06:00 AM
|
 |
Senior Member
|
|
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,225
|
|
|
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, 08:39 AM
|
 |
Member
|
|
Join Date: Apr 2008
Posts: 64
|
|
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,
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> }
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

07-15-2008, 08:43 AM
|
 |
Member
|
|
Join Date: Apr 2008
Posts: 64
|
|
Also one thing i noticed,
If i use the post method, values ll not appear in the url.
<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..
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

07-15-2008, 05:14 PM
|
 |
Senior Member
|
|
Join Date: Jun 2008
Location: Southwest
Posts: 880
|
|
|
setLocation()
Originally Posted by freddieMaize
(... 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.
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. .
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
|
|

07-16-2008, 09:00 AM
|
 |
Member
|
|
Join Date: Apr 2008
Posts: 64
|
|
|
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)..
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

07-17-2008, 01:03 AM
|
 |
Senior Member
|
|
Join Date: Jun 2008
Posts: 533
|
|
Originally Posted by freddieMaize
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
|
|

07-17-2008, 08:45 AM
|
 |
Member
|
|
Join Date: Apr 2008
Posts: 64
|
|
Fine. For this, i tried something like below,
<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,
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???
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

07-17-2008, 08:49 AM
|
 |
Senior Member
|
|
Join Date: Jun 2008
Posts: 533
|
|
|
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
|
|
|