java - Populating dropdown in Play framework -
i fetching list of client names database , need populate list drop down in play framework. when do, getting error: not found type name
. doing wrong?
my application.java code is:
package controllers; import java.awt.list; import java.sql.connection; import java.sql.drivermanager; import java.sql.resultset; import java.sql.sqlexception; import java.sql.statement; import play.mvc.*; import play.twirl.api.content; public class application extends controller { static list l = new list(); public static <list> result index() throws instantiationexception, illegalaccessexception, classnotfoundexception, sqlexception{ class.forname("com.microsoft.sqlserver.jdbc.sqlserverdriver").newinstance(); connection conn = drivermanager.getconnection("jdbc:sqlserver://localhost:1433","sumeet","sumeet"); system.out.println(conn); statement sta = conn.createstatement(); string sql = "select * client"; resultset rs = sta.executequery(sql); while (((resultset) rs).next()) { string id= rs.getstring("clientname"); l.add(id); } return ok((content) l); } }
`
and index.scala.html
file
@import helper._ @main { @select( options(@message), '_label -> "company", '_default -> "-- choose company --", '_showconstraints -> false ) }
@(consultantlist:java.util.list[string]) @import helper._ @main("adams") { --------- --------- @for(element <- consultantlist){ <option value="@element">@element</option> }
Comments
Post a Comment