aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes how to send & by appending the URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to send & by appending the URL " Watch "how to send & by appending the URL " New topic
Author

how to send & by appending the URL

Abdul Kader
Ranch Hand

Joined: Apr 11, 2007
Posts: 115
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

Joined: Nov 29, 2005
Posts: 2308
How are you sending the xml file.As query string or POST ?


Rahul Bhattacharjee
LinkedIn - Blog
Abdul Kader
Ranch Hand

Joined: Apr 11, 2007
Posts: 115
As a Query String . i am using AJAX to that
jayalal jayarathna
Greenhorn

Joined: May 17, 2007
Posts: 4
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

Joined: Apr 11, 2007
Posts: 115
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

Joined: Nov 29, 2005
Posts: 2308
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

Joined: Apr 11, 2007
Posts: 115


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

Joined: Nov 29, 2005
Posts: 2308
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

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1164
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


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to send & by appending the URL
 
Similar Threads
XML file on fly
want to call a java class object from xml and send the xml output to view
Transforming a flat file to XML file
Problem with JSTL "X:Transform" Tag
Writing xml data to file from TCP port