• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to make a simple XML file using JSP  RSS feed

 
matt sigmore
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. I'm trying to have a JSP page make a simple XML file but I can't figure out how.
I have a html/jsp form that asks a user to pick something. Called form.jsp.
Lets use this as an example.
------------------------------------------
How old are you:? (input box here)
Please choose your favorite fruit:
- Apple
- Orange
- Banana (these are radio buttons)
Please choose your favorite color:
- Red
- Blue
- Green (these are radio buttons)
SUBMIT
------------------------------------------------
This form.jsp then submits/posts to form2.jsp, which grabs the info and stores it in variables. Then I want to take this info and make an xml file called 25.XML (where 25= the persons age they entered.. any 2 dig number. XML must be upper case in the extension).
In this xml I want to just list their favorite color and favorite fruit.

How hard is this to do?
Can anyone give me an example of what i'd put in form2.jsp, and how i specifiy the directory where I want the xml file stored.

THANKS! I've been trying to figure this out but can't find a good tutorial and I'm stuck.
 
danny liu
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
msig:
To make a simple XML file like you said is not very difficult.
But first you must know the JAXP API, it is included in j2ee1.4 API.
Or you could download a separate package from java.sun.com.
Good luck to you.
Dan
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
144
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch "msig"!
You'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
Thanks!
bear
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

"msig msig",
sorry to pressure you, but your display name is still not valid. The 'display name' and the 'be nice' rules are the only ones we're really strict about and otherwise we're a lovely bunch.
Can you change your display name to something that at least looks valid, and then we can get back to talking about Java
thanks,
Dave.
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The demo at the FormattedDataSet takes form data selected by the user and converts it to xml. The source code is also available from the demo. Go to http://www.fdsapi.com and select 'live demo'.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!