Question

Below is the method that returns the Set of String as follows sang1,sang2,sang3,sang4,

@SuppressWarnings("unchecked")
public String getMissedAndDelayReasonList(String missedReasonValue)
{
    if(missedReasonValue == null) return null;
    List<RCADrpDwn> drpValues = adminDAO.getDropDownValues();
    if(drpDwn.getReasonValue()!=null && missedReasonValue.equalsIgnoreCase(drpDwn.getReasonValue()) &&                         drpDwn.getDelayCategory()!=null)
    {
        uniqueMVs.add(drpDwn.getDelayCategory());
    }
}

for(String dcVal:uniqueMVs){  
    delayValue.append(dcVal).append(","); 
    return delayValue.toString();
}

and in the controller layer i am fetching the values returned from this method and adding to the object as follows

modelAndView.addObject("delayValue",  adminService.getMissedAndDelayReasonList(missedValue));

delayValue is fetched in the jsp page and displays the value in the UI Screen i am using the split function and stringutils.split() nothing is returning the appropriate value , as i need to seperate these values and make the entry in the new line as follows:

sang1
sang2
sang3
sang4
Was it helpful?

Solution

You can try this:

 var newString = "sang1,sang2,sang3,sang4,".replace(",","<br/>"); 

OTHER TIPS

You can use :

 var newString = "sang1,sang2,sang3,sang4,".split(",").join("<br/>"); 
    for(String dcVal:uniqueMVs){  
        delayValue.append(dcVal).append(","); 
    }
    return delayValue.toString();

Try to move return from for{}, because you might probably return just 'sang1,' from method and than you cannot parse it with split().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top