0

I am reading an XML document to dynamically populate select boxes. The first select box is populated with all the activity names which i have done already in jsp.

DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse("C:\\Projects\\RegressionTester\\src\\main\\resources\\TestActivitiesXML.xml");
NodeList activityNodes = doc.getElementsByTagName("activity");

Upon selecting an activity the next select box should be populated with the activity's functions. I am trying to accomplish through a javascript method using the onchange eventhandler. But I have trouble passing the doc object as an argument. Any help would be appreciated.

onchange="return testMethodChange(this,<%=doc%>)"
Tim Down
  • 318,141
  • 75
  • 454
  • 536
user858697
  • 133
  • 1
  • 1
  • 8

1 Answers1

0
  • If you pass like this testMethodChange(this,<%=doc%>). It will not work because testMethodChange will only get some text.

  • Instead read and parse TestActivitiesXML.xml in javascript function itself.

  • After parsing the XML populate it in drop down according to your requirement.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Srikanth Venkatesh
  • 2,812
  • 1
  • 20
  • 13