'Get the option value row Id from a display tag table on a jsp, into a struts 1

I am using display tag to display data in a table on a JSP. I want to display a dropdown within display table tag.

My jsp structure and what I am currently trying is :

In property suggestedValueList data is coming in the list form in dropdown How can I separate the values in dropdown

enter image description here

this is my action class code to get the Suggestedvalue list

@SuppressWarnings("unchecked")
    public void createErrText(int m, String superType, HCP hcp2, ArrayList<String> HCPsuggestedValueList) {
    superType = superType.trim();
    if (superType.equals("PROF")) {
            HCPsuggestedValueList.add(superType + " HCP ID: " + hcp2.getHcp_id() + ", " + hcp2.getFirst_name() + " "
                    + hcp2.getLast_name() + ", " + hcp2.getAddress1() + " " + ", " + hcp2
          
                            .getCity()
                    + ", " + hcp2.getState_provence() + ", " + hcp2.getCountry());
            HCPsuggestedValueList = (ArrayList<String>) HCPsuggestedValueList.stream()
                    .distinct()
                    .collect(Collectors.toList());
            Collections.sort(HCPsuggestedValueList);
            
    } else {
            HCPsuggestedValueList.add(superType + " HCP ID: " + hcp2.getHcp_id() + ", " + hcp2.getName() + ", "
                    + hcp2.getAddress1() + " " + ", " + hcp2
          
                            .getCity()
                    + ", " + hcp2.getState_provence() + ", " + hcp2.getCountry());
            HCPsuggestedValueList = (ArrayList<String>) HCPsuggestedValueList.stream().distinct()
                     .collect(Collectors.toList());
            Collections.sort(HCPsuggestedValueList);

    } 
    
    /*
     * Enumeration<String> e = Collections.enumeration(HCPsuggestedValueList); //
     * Enumerate through the ArrayList elements while(e.hasMoreElements())
     * System.out.println("createErrText suggestions value"+e.nextElement());
     */
     
  }
  
    public void addError(ArrayList<TemplateErrorsBean> inner, int recordNo, String field, String errCategory,
            String errText, String errValue, String suggestedValue, ArrayList<String> HCPsuggestedValueList1) {
    //TemplateErrorsBean t = new TemplateErrorsBean(String.valueOf(recordNo), suggestedValue);
    TemplateErrorsBean t = new TemplateErrorsBean();
    System.out.println("Inside adderror..."+recordNo);
    String myString=null,selectedHcp = null;
    t.setRecNo(Integer.toString(recordNo));
    t.setFileId(field);
    t.setErrCategory(errCategory);
    t.setErrMsg(errText);
    t.setErrValue(errValue);
    t.setSuggestedValue(suggestedValue);
    t.setSuggestedValueList(HCPsuggestedValueList1);
    /*
     * for(int i=0;i<HCPsuggestedValueList.size();i++) { myString = (String)
     * HCPsuggestedValueList.get(i); selectedHcp=String.valueOf(i);
     * TemplateErrorsBean tt = new TemplateErrorsBean(selectedHcp,myString);
     * t.setSuggestedId(selectedHcp); t.setSuggestedDescription(myString); }
     */
    
    inner.add(t);
  }
  
    @SuppressWarnings("unchecked")
    public void addHashError(ArrayList inner, int recordNo, Hashtable<String, List<HCP>> hcpScmHash, String key,
            HCP hcp, String hcpType) {
        
        ArrayList HCPsuggestedValueList = new ArrayList();
    List<HCP> matched = hcpScmHash.get(key);
    boolean found = false;
    int highMatchCount = 0;
        HCP hcp2 = new HCP();
    HCP highMatchedHcp = matched.get(0);
    for (int m = 0; m < matched.size(); m++) {
            hcp2 = matched.get(m);
            //System.out.println("HCP2" + hcp2);
      if (hcp.isEqualsHCP(hcp2)) {
                System.out.println("Inside addHash error equals" + hcp2);
        found = true;
        break;
      } 
      int matchcount = hcp.FuzzySearch(hcp2);
      if (matchcount > highMatchCount) {
        highMatchCount = matchcount;
        highMatchedHcp = hcp2;
      } 
    } 
    if (found)
      return; 
        for (int m = 0; m < matched.size(); m++) {
            hcp2 = matched.get(m);
            createErrText(m,hcp.getSuper_type(), hcp2, HCPsuggestedValueList);
        }
    System.out.println("***inside add hash error :: recordno is****"+recordNo);
        addError(inner, recordNo, hcpType, "Incorrect ID and Name/Address Combination",
                "Incorrect " + hcpType + "ID and Name/Address Combination",hcp.toString(),"", HCPsuggestedValueList);
  }

This is the my Bean class

enter image description here

after uploading the excel file we fetching the data in action class and generating the error after validation.

How can I display dropdown values for selected record number?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source