Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to send & by appending the URL

 
Abdul Kader
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I want to send a XML file to the Server (which may have ampersand symbol in the XML file), when I trying to get that I am able to get only the half of that XML file. Is there any way to get the complete XML STRING (with & inside it?)
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you sending the xml file.As query string or POST ?
 
Abdul Kader
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As a Query String . i am using AJAX to that
 
jayalal jayarathna
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can replace & with another charactor(which is not used in the xml file) like "@" or "#" and post then, in the servelet U can easily replace that with &

or

convert whole xml to unicode and send unicode as a string, then convert back in the servelet
 
Abdul Kader
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't believe replace things will not be a good solution.is there any other solution other than that. thanks for your time
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Query string always have character limitation , why donot you use POST instead , With AJAX also you can make POST method call.
 
Abdul Kader
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


See this code i am using to send the DATA to the Server the both XML file may have &. And i am using POST method .please let me know if you have any inputs on this
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Yousuff Mohammed:

See this code i am using to send the DATA to the Server the both XML file may have &. And i am using POST method .please let me know if you have any inputs on this


Is this working ?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Yousuff Mohammed:
I don't believe replace things will not be a good solution.is there any other solution other than that. thanks for your time


Why don't you believe it will be a good idea?

If your text has querystring control characters, then they will need to be replaced before sending them as part of a querystring.
There is no way around that.
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yousuff,

The ampersand character is obviously a url reserved character and you need to encode it as %26 when it's part of the url.

Regards,
Dan
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see there are two things in the question:
a> You want to have ampersand in the query string.

b> You are not getting the complete xml file in the servlet.

For a) as many have mentioned that you have URLEncode the stuff.

For b) as you are not getting the complete xml file may be because of the character restriction of URL.Try using POST instead.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic