how get attribute relation from another entity class Java Persistance API and show to JSP through servlet?

Posted by user1787209 on Stack Overflow See other posts from Stack Overflow or by user1787209
Published on 2012-12-13T04:42:14Z Indexed on 2012/12/13 5:03 UTC
Read the original article Hit count: 114

Filed under:
|
|
|

I have 2 entities are entities meeting and meetingAgenda.

I write code entity class (EJB) from database like this.

public class Meeting implements Serializable {
......
 @XmlTransient
    public Collection<MeetingAgenda> getMeetingAgendaCollection() {
        return meetingAgendaCollection;
    }

    public void setMeetingAgendaCollection(Collection<MeetingAgenda> meetingAgendaCollection) {
        this.meetingAgendaCollection = meetingAgendaCollection;
    }
.......
}

and entity class meeting agenda like this. .....

public class MeetingAgenda implements Serializable {
....
    public String getAgenda() {
        return agenda;
    }
    public void setAgenda(String agenda) {
        this.agenda = agenda;
    }
....
}

method getMeetingAgendaCollection is a relation from meeting entity . then, in my controller servlet i call EJB like this.

public class ControllerServlet extends HttpServlet {
    @EJB
    private RapatFacadeLocal rapatFacade;

public void init() throws ServletException { 
        // store category list in servlet context      
   getServletContext().setAttribute("meetings", rapatFacade.findAll());
}
......

i want to show data from table entities meeting and meetingAgenda...but i can't.. please help..

i write code in JSP page.. like this..

 <c:forEach var="meeting" items="${meetings}">
<td> MeetingCode :  ${meeting.meetingCode} </td>
<td> Meeting :  ${meeting.meeting} </td>
<td> Agenda :  ${meeting.getMeetingAgendaCollection} </td> 
</c:forEach>

how do I display data Agenda using getMeetingAgendaCollection ????

thanks for your help.

© Stack Overflow or respective owner

Related posts about class

Related posts about jpa