• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

process XML

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I have an XML file, eg.
<cd>
<name>a</name>
<name>b</name>
...
</cd>

my jsp page want to list all the cd names. Before each name, there will be a checkbox to let user select.

After select, user click save button, then modify the XML by adding an attribute to each <name> element to indicate whether selected.

How can I do this? My current thought is to parse the XML, and find out all the names first before come into this page. Then display all the names. After submit, modify the XML accordingly. Is there any other way to do it?

Thanks.
[ January 25, 2005: Message edited by: Howie Jiang ]
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no direct struts benefit to doing what you're trying to do. It may, however, be a little easier if you change your xml into an actual ActionForm class that could provide an easier interface into posting from your form and doing the processing of the XML in the background (before it ever reaches your eventual Action).
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This doesn't seem to have anything to do with Struts. I'm going to move it to the XML and Related Technologies forum.
 
author
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm with Michael. I like to do things as simple as possible. Manipulating it as XML in the JSP sounds hard. The usual way to do things in Struts is to put JavaBean in the request, so why not do that. I recommend you use the Apache Digester to turn your XML into JavaBeans from inside the Struts Action.
reply
    Bookmark Topic Watch Topic
  • New Topic