<%@ page import="ro.emid.common.utils.ObjectUtils" %>
<%@ page import="java.util.Enumeration" %>
<%@ page import="ro.emid.common.types.DataObj" %>
<%@ page import="ro.emid.common.db.DataDB" %>
<%@ page import="ro.emid.common.utils.BrowseData" %>
<%
    final String q = ObjectUtils.getStringValue(request.getParameter("q"));
    final int tipLF = ObjectUtils.getIntValue( request.getParameter( BrowseData.TIP_LF), 0);
    final int sugestBeginIndex = ObjectUtils.getIntValue( request.getParameter("sugestBeginIndex"), 0);
    final int sugestMaxCount = ObjectUtils.getIntValue( request.getParameter("sugestMaxCount"), 0);

    final DataObj[] items = DataDB.searchLF(q, tipLF, sugestBeginIndex, sugestMaxCount);
    final long totalCount = DataDB.searchLFTotalCount( q, tipLF);
%>

<respmesg>
{
  totalCount: <%=totalCount%>,
  list :[
    <% for ( int i = 0; i < items.length; i++) { %>
    <%      final DataObj item = items[i];             %>
            {
                key : "<%=item.getId()%>",
                value : "<%=ro.emid.common.utils.Util.escapeToJs(item.getCod() + " - " + item.getNume())%>"
            }
    <%  if( i < items.length -1 ){%>,<%}%>
    <% }%>
	]
}
</respmesg>
