473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how to pass the xml file from servlet to client side

After serialization has been done on XML file, i got a string "XMlstr" now how will transform the string to clientside where i am using Ajax to handle the response.

Here i am paste the code of servlet part :

/public class controllerservlet extends HttpServlet {

String con_name;
ArrayList conc_list = new ArrayList();
QueryPopulate qp = new QueryPopulate();
Document doc=null;

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/xml;charset=UTF-8");
PrintWriter out = response.getWriter();
// System.out.println("HaiHello");

request.getParameterValues("slt_concept");
doc = qp.PopulateConcept();

if(doc!=null){
[response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
String Xmlstr = RstoXml.serialize(doc);
System.out.println(Xmlstr);
response.getWriter().write(Xmlstr);

}
else
response.setStatus(HttpServletResponse.SC_NO_CONTE NT);
}











--------------------------------------------------------------------------------
Jul 10 '07 #1
1 1765
acoder
16,027 Expert Mod 8TB
Use responseXML to deal with the XML content. As long as it's valid XML, it should work. You may have to set the content-type (override the mime type) on the client-side.
Jul 10 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: kaiwing18 | last post by:
Hi, I have a following jsp file called "showAsset.jsp" : <form action="showAsset.jsp" method="post"> <tr BGCOLOR=YELLOW> <td><input name="sort" type="submit" value="Asset_Number" > </td>...
2
by: Steve | last post by:
Does anyone know what is wrong with this code or why I might be experiencing this behavior? I have a Java application that submits HTTP POST requests to a servlet (with content in the body of...
3
by: mydirac | last post by:
hello, I'm thinking about javascript's producing another file. Can I do it?
3
by: Sirix42 | last post by:
Hi there, when I use Firefox to run my application (this involves sending an IFRAME request to the servlet and handling the response), there is no delay in displaying the data after each response....
1
by: rajarya | last post by:
Hi , I need to read a file(xml file) froma location in server by my client side HTML+Javascript code ,I did this using JSP,but now my requirement has been changed and I donot want any server side...
0
by: gopikrishnan | last post by:
Hi to all, In Linux, I can able to open a odt file through JSP and Servlet coding. But there creates a problem.. When a client opens a odt file from his machine, the file opens in server side...
7
madhoriya22
by: madhoriya22 | last post by:
Hi, I am trying to read a file sent from client to server. Here is how I am trying it .... String filePath = request.getParameter("SelectCSVFile"); System.out.println("path:::---> "+filePath);...
2
by: praveenkumarvpk | last post by:
Hi friends Please help me! Following is my servlet-code import java.util.Enumeration; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import...
3
by: vijaykumardahiya | last post by:
Hello To Every One, I want to know that when I upload the File like a image from html page Its not show on servlet page using appropriate logic. I read the FileUpload Home page.But I am still...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.