3

I have output from a java code in the form of a 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 to use the output from this code as a dropdown menu item. Need help with this. Thank You

1
  • String option = "<option value=\"\">Volvo</option>" + value + "\">" + value + "</option>"; as way... and further in loop ... Commented Jul 16, 2015 at 22:58

1 Answer 1

1
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();
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.