Solved

Pass xml file as string to jsp file

Posted on 2006-06-12
2
299 Views
Last Modified: 2006-11-18
HI,

I have a client based javascript ap, that parses an xml file.

It is something simple, but will grow... xml file

<type>
  <default>test1</default>
  <next>testing</next>
  <next>tests</next>
  </type>
- <type>
  <default>test2</next>
  <next>tested</next>
  <next>tester</next>
  </type>

I put this in a string but how do i send it to my simple jsp file so that it will then be saved on the server machine? The file will grow... so also thinking wont be able to go on the url after a few months.

My jsp file.

<%@ page language="java" %>
<%@ page import="java.io.*" %>
<%

try {
              String xmlparam= request.getParameter( "xmlparam" ); //tried various ways of passing and did not work.... this was one option
              
              BufferedWriter output = new BufferedWriter(new FileWriter("c:\\gbdafda.xml"));
              output .write(xmlparam); //can't get this to work...
              output .close();
          } catch (IOException e) {
          }
 
 
 
  %>

thanks
0
Comment
Question by:wilflife
2 Comments
 
LVL 4

Expert Comment

by:pablomorales
ID: 16889339
How are you posting the data to the server?
0
 
LVL 27

Accepted Solution

by:
rrz earned 500 total points
ID: 16890038
pablomorales, has brought up a good point. You should change to post method for your form.  Or you could change to  enctype='multipart/form-data'  and FileUpload  see  http://jakarta.apache.org/commons/fileupload/  if you are really starting with a file at the client.  
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jAVA SERVLETS CODE FOR ONLINE SUPERMARKE 2 196
tomcat users xml 7 105
nested if has else if 13 92
lessBy10  challenge 15 92
Note: This is the third blog post in a series on email clearinghouses (https://www.xmatters.com/alert-management/blog-email-has-failed-us?utm_campaign=70138000000ydLoAAI&utm_source=exex&utm_medium=article&utm_content=blog-post).   We’ve been talki…
A customer recently asked me about anti-malware and the different deployment options available for his business. Daily news about cyberattacks, zero-day vulnerabilities, and companies that suffered a security breach made him wonder if the endpoint a…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now