Convert List from java to a dropdown menu in html -
i have output java code in form of list
public class getprojectlist { final string username = "username"; final string password = "password"; final string projectnames = null; public getprojectlist() throws urisyntaxexception, interruptedexception, executionexception { final uri jiraserveruri = new uri("https://jira.xxxx.com"); final jirarestclientfactory restclientfactory = new asynchronousjirarestclientfactory(); final jirarestclient restclient = restclientfactory.createwithbasichttpauthentication(jiraserveruri,username,password); final iterable<basicproject> allproject = restclient.getprojectclient().getallprojects().get(); final string projectnames = allproject.tostring(); system.out.println(projectnames); } }
i want use output code dropdown menu item. need this. thank you
string projectstohtmloptions(string projectnames,string separator){ stringbuilder sb = new stringbuilder(); sb.append("<select>"); for(string project:projectnames.split(separator) sb.append("<option value=\""+project+"\">"+project+"</option>"); sb.append("</select>"); return sb.tostring(); }
Comments
Post a Comment