Help with errors urgent please

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • peterkay
    New Member
    • Apr 2007
    • 4

    #1

    Help with errors urgent please

    Code:
    MyBean bean = new MyBean(categoryForm, PriceForm);
    		request.setAttribute("valid", bean);
    		System.out.println(bean);
     
    		List vids =MyBean.getVideos(categoryForm, PriceForm);
    I have a servlet which does this, is should create a new MyBean and pass in the params the bean then uses the params to acess a db and run a queray, the result set then adds the data into an array list , i then want to return the data to the servlet . When compiling it says:

    Code:
    symbol  : class List
    location: class MySite.Valid
                    List vids = MyBean.getVideos(categoryForm, PriceForm);
                    ^
    MySite/Valid.java:56: non-static method getVideo(java.lang.String,java.la
    ng.String) cannot be referenced from a static context
                    List vids = MyBean.getVideos(categoryForm, PriceForm);
                                           ^
    2 errors
    I know this islikely something very simple but i really need to get this to compile quickly can anybody tell me whats wrong with it and how to solve it?
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by peterkay
    Code:
    MyBean bean = new MyBean(categoryForm, PriceForm);
    		request.setAttribute("valid", bean);
    		System.out.println(bean);
     
    		List vids =MyBean.getVideos(categoryForm, PriceForm);
    I have a servlet which does this, is should create a new MyBean and pass in the params the bean then uses the params to acess a db and run a queray, the result set then adds the data into an array list , i then want to return the data to the servlet . When compiling it says:

    Code:
    symbol : class List
    location: class MySite.Valid
    List vids = MyBean.getVideos(categoryForm, PriceForm);
    ^
    MySite/Valid.java:56: non-static method getVideo(java.lang.String,java.la
    ng.String) cannot be referenced from a static context
    List vids = MyBean.getVideos(categoryForm, PriceForm);
    ^
    2 errors
    I know this islikely something very simple but i really need to get this to compile quickly can anybody tell me whats wrong with it and how to solve it?
    List is in the java.util package. Did you import that?
    Which object are you trying to call the getVideos method on?

    Comment

    • peterkay
      New Member
      • Apr 2007
      • 4

      #3
      Originally posted by r035198x
      List is in the java.util package. Did you import that?
      Which object are you trying to call the getVideos method on?
      Thanks i forgot to import that package and the other error was because i was calling the wrong method

      Comment

      Working...