# ServletExeption in Filter



## siba (10. Mrz 2005)

Ich habe folgende Fehlermeldung und komme nicht weiter: Was habe ich falsch gemacht?

javax.servlet.ServletException: The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List or array, but that value cannot be converted to an integer.

Der zugehörige Eintrag in der Datenbank lautet:

CREATE TABLE ORDER_TITLE(ORDER_TITLE_ID BIGINT NOT NULL PRIMARY KEY,ORDER_NAME VARCHAR(2) NOT NULL)


Derzugehörige Filter lautet:



```
public class EingabeFilter implements Filter {


        private FilterConfig filterConfig = null;


        public void init(FilterConfig filterConfig) throws ServletException {
                this.filterConfig = filterConfig;


        }


        public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
                throws IOException, ServletException {

                if ( request instanceof HttpServletRequest) {
                        HttpServletRequest req = (HttpServletRequest) request;


                        Collection orderTitle = (Collection) req.getSession().getAttribute("orderTitle");

                        if (orderTitle != null) {
                                System.out.println("list of OrderTitles");
                        }
                        else {
                                OrderTitleDAO dao = new OrderTitleDAO();
                                orderTitle = dao.select();
                                ((HttpServletRequest) request).getSession().setAttribute("orderTitle", orderTitle);
                                System.out.println("get new list of OrderTitles ...");
                        }

                               }
                chain.doFilter(request, response);

        }


        public void destroy() {

        }

}
```

die zugehörige select-Methode in der OrderTitleDAO lautet:



```
public Collection select() {

                Collection orderTitles = new ArrayList();
                Connection con = DBConnect.getConnection();
                Statement pstmt = null;
                ResultSet rs = null;
                try {



                        pstmt = con.createStatement();
                        rs = pstmt.executeQuery(SELECT);



                        while(rs.next()) {
                                OrderTitle orderTitle = new OrderTitle();
                                orderTitle.setId(new Long(rs.getLong("ORDER_TITLE_ID")));
                                orderTitle.setName(rs.getString("ORDER_NAME"));
                                orderTitles.add(orderTitle);
                        }

                } catch (SQLException e) {
                        e.printStackTrace();
                } finally {
                        try {
                                pstmt.close();
                                con.close();
                        } catch (Exception e) {
                                e.printStackTrace();
                        }
                }
                return orderTitles;
        }
```


----------



## bambi (10. Mrz 2005)

Wo genau bekommst Du denn den Fehler (welche Zeile)? 

THX


----------



## siba (10. Mrz 2005)

Ich habe inzwischen den Fehler gefunden! Der Fehler lag gar nicht im Filter sondern im JSP.


----------

