[jboss-user] [EJB 3.0] - Re: Help on java.lang.ClassCastException: java.lang.String

scout1lacno do-not-reply at jboss.com
Thu Oct 19 06:29:45 EDT 2006



Line 46 is this:

String country = (String) myList.get(i);	

My full code is:

  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
  |     throws ServletException, IOException {
  |         response.setContentType("text/html;charset=UTF-8");
  |         PrintWriter out = response.getWriter();
  |         
  |         TblCountryFacadeLocal myCountryBean = lookupTblCountryFacade();        
  |         List myList = myCountryBean.findAllCat(); 
  |         int length = myList.size();
  |         
  |         out.println("<html>");
  |         out.println("<head>");
  |         out.println("<title>Servlet CountryBean</title>");
  |         out.println("</head>");
  |         out.println("<body>");        
  |         
  |         for (int i = 0; i < length; i++) {            
  | 		//TblCountry region = (TblCountry) myList.get(i) ;                
  |                 String country = (String) myList.get(i);	
  |                 System.out.println(country);                
  | 	}
  |          /*for (Iterator iter = myList.iterator(); iter.hasNext();) {            
  |             //String cityName = ( String )new String( iter.next().toString() );                        
  |             String cityName = ( String ) new String( iter.next().toString() );                        
  |             out.println("<p>"+ cityName +"</p>");      
  |             
  |         }*/
  |         
  |         
  |         out.println("</body>");
  |         out.println("</html>");
  |         
  |         out.close();
  |     }

Any suggestions? :)

Thankz :)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3979313#3979313

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3979313



More information about the jboss-user mailing list