Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ZaduzenjeManagedBean {
- private int idKnjige;
- Knjiga knjiga;
- Primerak primerak;
- private int idClana;
- boolean zaduzi;
- List<Primerak> primerci;
- public void ucitajKnjige(){
- knjiga = getKnjigaForId(EntityManager em, idKnjige);
- }
- /// pokusao sam ovaj metod da izvucem slobodne primerke .... aaaa ne znam nadam se da si uspio bolje nesto od mene
- /// i sad kao da ovu postojecu listu da vratim u jsf stranicu i da obaevezno dodaj konsturktor
- public void slobodniPrimerci(){
- for(int i = 0; i<knjiga.primeraks.size(); i++){
- if(isSlobodanPrimerak(EntityManager em, knjiga.primerak.invBroj){
- primerci.add(knjiga.primerak);
- }
- }
- }
- public void zaduziClana(){
- zaduzi = zaduzi(EntityManager em, idClana);
- }
- }
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:p="http://primefaces.org/ui">
- <h:head>
- </h:head>
- <h:body>
- <f:view>
- <h:panelGrid columns="1">
- <h:form>
- <h:panelGrid columns="1">
- <h:outputText value="ID Knjige"/>
- <h:inputText value="#{zaduzenjeManagedBean.idKnjige}"/>
- <h:commandButton value="Ucitaj knjige" action="#{zaduzenjeManagedBean.ucitajKnjige()}" execute="@form" render="clanPanel zaduzenjaPanel"/>
- </h:panelGrid>
- </h:form>
- <h:form>
- <h:panelGrid columns="1">
- <h:selectOneMenu value="#{zaduzenjeManagedBean.primerci}}" >
- </h:selectOneMenu>
- </h:panelGrid>
- </h:form>
- <h:panelGrid columns="1">
- <h:outputText value="ID Korisnika"/>
- <h:inputText value="#{zaduzenjeManagedBean.idClan}"/>
- <h:commandButton value="Zaduzi" action="#{zaduzenjeManagedBean.zaduziClana}" execute="@form"/>
- </h:panelGrid>
- </h:form>
- </h:panelGrid>
- </f:view>
- </h:body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement