Results 1 to 2 of 2
  1. #1
    peace76 is offline Member
    Join Date
    Apr 2010
    Posts
    18
    Rep Power
    0

    Default How to get / setAttribute from a List with many sql id.

    Hi. Thankś for taking the time.

    Im gonna try my best to explain this. This is still new to me, and my english is as it is.

    Java Code:
    Customer customer = (Customer) customerFacade.find(1);
    session.setAttribute("customer",customer);
    Will find/set one Customer with id 1, But what do I do if I want many? Not findAll(). Just the one's that match the sql search. Like below.

    Java Code:
    Customer customer = (Customer) customerFacade.find(1 and 3 and 5);
    This is the best I can explain my needs without having to write a book. Hope it makes sense to you.

    Regards / peace. Thanks again.

  2. #2
    peace76 is offline Member
    Join Date
    Apr 2010
    Posts
    18
    Rep Power
    0

    Default Ooo I think I got it.

    Java Code:
    else if (!userPath.isEmpty() && userPath.equals("/listevents")) {
    
                String head = (String) request.getParameter("head");
                String city = (String) request.getParameter("city");
                String month = (String) request.getParameter("month");
                String day = (String) request.getParameter("day");
    
                List list = managerFacade.listEvents(head, city, Integer.parseInt(month), Integer.parseInt(day));
                ArrayList test = new ArrayList();
    
                Iterator it = list.iterator();
                while(it.hasNext()) {
                    test.add(eventFacade.find( it.next()));
                }
    
                request.setAttribute("profile", "listem");
                request.setAttribute("events",test);
    
    
                userPath = "/profile";
            }

Similar Threads

  1. Replies: 2
    Last Post: 11-22-2009, 06:24 PM
  2. Replies: 3
    Last Post: 11-21-2009, 06:48 PM
  3. Problem with setAttribute()
    By R O C K Y in forum Advanced Java
    Replies: 7
    Last Post: 02-09-2009, 02:06 PM
  4. Replies: 2
    Last Post: 01-27-2009, 05:11 PM
  5. How to access ArrayList in List of List?
    By alvations in forum New To Java
    Replies: 5
    Last Post: 10-08-2008, 01:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •