/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.yuntong.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.yuntong.hibernate.database.po.TAgioInfo;
import com.yuntong.hibernate.database.po.TFactoryInfo;
import com.yuntong.service.M_TAgionInfoManagerService;

/** 
 * MyEclipse Struts
 * Creation date: 04-26-2007
 * 
 * XDoclet definition:
 * @struts.action
 */
public class M_typingAction extends Action {
	private M_TAgionInfoManagerService M_service;
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws IOException {
		// TODO Auto-generated method stub
		
		PrintWriter out= response.getWriter();
		
		
	     String typing = request.getParameter("typing");
	     int fid;
	     try{
	      fid=Integer.parseInt(typing);
	     }catch(Exception e){
	    	 return null;
	     }
		 // .........
	     List list=null;
	    try {
	    	 list=M_service.findtop10(fid);
		} catch (Exception e) {
			return null;
		}
		if(list==null){
			return null;
		}
	    
	    int temp=list.size();
	    
	    
	    if(list.size()>=10){
	    	temp=10;
	    }else{
	    	temp=list.size();
	    }
	    for (int i = 0; i < temp; i++) {
	    	
	    	out.println("<div onselect='this.text.value = "+((TAgioInfo)(list.get(i))).getTRegisterInfo().getRegisterId()+"'><span class=''>"+((TAgioInfo)(list.get(i))).getTRegisterInfo().getRegisterId()+"</span></div>");
	    
	    	        
	    }  
		return null;
	}

	public M_TAgionInfoManagerService getM_service() {
		return M_service;
	}

	public void setM_service(M_TAgionInfoManagerService m_service) {
		M_service = m_service;
	}
}