Expand my Community achievements bar.

SOLVED

Retrieve Dynamic Table Content data in the Servlet using the post method

Avatar

Level 3

Hi,

 

I am looking for the correct syntax on how to retrieve the dynamic table's content in the Adaptive form.

That is when the Adaptive Form is submitted to the Servlet using the Post action, how can I get the table content.

 

For example, if there is a TextBox component, I can retrieve its value using the  

request.getParameter("TextBoxName");

 

In the same way, I would like to know how to the get the table component data.

I can get the number of Rows of the table, like move the instance Length to a textbox and gets it's value and loop through in the iteration to get each column of the row.

 

But not sure how to pass the table or Rows to request object.   May be a List Object or Map to retrieve the table content in the servlet. But Not sure what is the request object to be used here in the servlet. 

 

If any one has any suggestions, kindly let me know.

 

Thanks

 

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

In the servlet, you can access the entire data and parse the XML to get hold of the element that you want to access

For example, in the following code, we write the request parameters and their values to the log file. 

System.out.println("form was submitted");
Part attachment = request.getPart("attachments");
if(attachment!=null)
{
System.out.println("The content type of the attachment added is "+attachment.getContentType());
}
Enumeration<String> params = request.getParameterNames();
while(params.hasMoreElements())
{
String paramName = params.nextElement();
System.out.println("The param Name is "+paramName);
String data = request.getParameter(paramName);System.out.println("The data is "+data);
}

 

View solution in original post

4 Replies

Avatar

Correct answer by
Employee Advisor

In the servlet, you can access the entire data and parse the XML to get hold of the element that you want to access

For example, in the following code, we write the request parameters and their values to the log file. 

System.out.println("form was submitted");
Part attachment = request.getPart("attachments");
if(attachment!=null)
{
System.out.println("The content type of the attachment added is "+attachment.getContentType());
}
Enumeration<String> params = request.getParameterNames();
while(params.hasMoreElements())
{
String paramName = params.nextElement();
System.out.println("The param Name is "+paramName);
String data = request.getParameter(paramName);System.out.println("The data is "+data);
}

 

Avatar

Level 3

Tried this Enumeration. But it is not listing the Table or its Row as one of the parameter.