File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts with parsers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts with parsers" Watch "Struts with parsers" New topic

Struts with parsers

Edward Durai
Ranch Hand

Joined: Oct 09, 2004
Posts: 223
I am new one for struts.

I want to fetch each and every node of the xml file.
I have done to fetch each and every node

my xml looks like


Using dom parser i get the nodes like
My output like
FIELD_ID---> 0
CREATE-----> 1
SEARCH-----> 1
FIELD_ID---> 1
CREATE-----> 1
SEARCH-----> 0

IN THE ABOVE xml file FIELD_ID is a fields
In jsp page display,if the create=1 means, i want to check the checkbox otherwise checkbox should be not checked.

How can do this.

Thank You<br />Edward
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
One thing to realize is that Struts doen't speak the language of parsers. It speaks the language of JavaBeans. Your first task, then, will be to translate the output of your parser into JavaBeans. I would suggest that you create an ActionForm that has a property ("fields" for example) that contains a List of individual JavaBeans, each one representing one "field" with the three properties you gave in your example.

You could then use the <logic:iterate> tag and "indexed properties" to iterate through the List and create a checkbox for each "Field" bean. This link gives you some good tips on using indexed properties.

Regarding your checkbox question: The <html:checkbox> tag is tied to the JavaBean property you specify using the indexed property name. If the property is of type boolean, the box will show as checked if the boolean value is true, and unchecked if it is false.
[ August 11, 2006: Message edited by: Merrill Higginson ]

Consultant, Sima Solutions
I agree. Here's the link:
subject: Struts with parsers
It's not a secret anymore!