/*
 * 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.TRegisterInfo;
import com.yuntong.service.M_IRegisterManagerService;

/** 
 * MyEclipse Struts
 * Creation date: 04-27-2007
 * 
 * XDoclet definition:
 * @struts.action validate="true"
 */
public class M_googleTHDJAction extends Action {
	private M_IRegisterManagerService managerService;
	public M_IRegisterManagerService getManagerService() {
		return managerService;
	}
	public void setManagerService(M_IRegisterManagerService managerService) {
		this.managerService = managerService;
	}
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws IOException {
		PrintWriter out= response.getWriter();
		String id=request.getParameter("typing");
	
		 List list=null;
		    try {
		    	 list=managerService.findTopTen(Long.parseLong(id));
		    	 
			} 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 = "+((TRegisterInfo)(list.get(i))).getRegisterGlideId()+"'><span class=''>"+((TRegisterInfo)(list.get(i))).getRegisterGlideId()+"</span></div>");		    		    	        
		    }  
		return null;
		
	}
}