java - fill select in struts2 -


I'm trying to fill my struts 2 with this method, but I have all these empty dropdowns. This is my verb method

  private list & lt; String & gt; District List = New Array's & lt; String & gt; (); Public string get_DistrictList () {try {currentCon = ConnectionManager.getConnection ()); Statement stmt = (Statement) Present Con.createStatement (); Rs = stmt.executeQuery ("Select District_ID, district_name from district"); Whereas (rsnext ()) district list.ed (rsgetstring ("district_name")); DistrictList.add (rs.getString ("district_id")); } Hold (exception e) {System.out.println ("error from DAO:" + E); } Return Success; }   

My JSP

  & lt; S: Select label = "select district" id = "district_list" headerKey = "- 1" headerValue = "select district" list = "district list" list = "district_id" value = "district_name" tooltip = "select district" Name = "notarpos area" />   

When I only add one district list & amp; & Amp; deleted list & amp; The list was working properly, but I want both keys and value in my selection. Is there any way?

Thank you in advance :)

You can do this Map Private map & lt; String, string & gt; DistrictMap; / ** Sets and gates / public string for mapping get_DistrictList () {districtMap = new Hashmop & lt; String, string & gt; (); try{ . . . While (rsnext ()) District map.put (rsgetstring ("district_name"), rsgetstring ("district_id")); . . } Hold (exception e) {System.out.println ("error from DAO:" + E); } Return Success; }

and Generate Setter and Gates for the above map . And

in JSP

  & lt; S: Select label = "select district" id = "district_list" HeaderKey = "- 1" headerValue = "select the district" list = "districtmap" list = "key" list value = "value" tooltip = "select district" name = "Notepoos Distinct" />    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -