Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. public class ZaduzenjeManagedBean {
  2.  
  3. private int idKnjige;
  4. Knjiga knjiga;
  5. Primerak primerak;
  6. private int idClana;
  7. boolean zaduzi;
  8. List<Primerak> primerci;
  9.  
  10.  
  11. public void ucitajKnjige(){
  12. knjiga = getKnjigaForId(EntityManager em, idKnjige);
  13. }
  14.  
  15. /// pokusao sam ovaj metod da izvucem slobodne primerke .... aaaa ne znam nadam se da si uspio bolje nesto od mene
  16. /// i sad kao da ovu postojecu listu da vratim u jsf stranicu i da obaevezno dodaj konsturktor
  17. public void slobodniPrimerci(){
  18. for(int i = 0; i<knjiga.primeraks.size(); i++){
  19. if(isSlobodanPrimerak(EntityManager em, knjiga.primerak.invBroj){
  20. primerci.add(knjiga.primerak);
  21. }
  22. }
  23. }
  24.  
  25. public void zaduziClana(){
  26. zaduzi = zaduzi(EntityManager em, idClana);
  27. }
  28. }
  29.  
  30. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  31. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  32.  
  33. <html xmlns="http://www.w3.org/1999/xhtml"
  34. xmlns:ui="http://java.sun.com/jsf/facelets"
  35. xmlns:h="http://java.sun.com/jsf/html"
  36. xmlns:f="http://java.sun.com/jsf/core"
  37. xmlns:p="http://primefaces.org/ui">
  38.  
  39. <h:head>
  40. </h:head>
  41. <h:body>
  42. <f:view>
  43. <h:panelGrid columns="1">
  44. <h:form>
  45. <h:panelGrid columns="1">
  46. <h:outputText value="ID Knjige"/>
  47. <h:inputText value="#{zaduzenjeManagedBean.idKnjige}"/>
  48. <h:commandButton value="Ucitaj knjige" action="#{zaduzenjeManagedBean.ucitajKnjige()}" execute="@form" render="clanPanel zaduzenjaPanel"/>
  49. </h:panelGrid>
  50. </h:form>
  51.  
  52. <h:form>
  53. <h:panelGrid columns="1">
  54. <h:selectOneMenu value="#{zaduzenjeManagedBean.primerci}}" >
  55.  
  56. </h:selectOneMenu>
  57. </h:panelGrid>
  58. </h:form>
  59. <h:panelGrid columns="1">
  60. <h:outputText value="ID Korisnika"/>
  61. <h:inputText value="#{zaduzenjeManagedBean.idClan}"/>
  62. <h:commandButton value="Zaduzi" action="#{zaduzenjeManagedBean.zaduziClana}" execute="@form"/>
  63. </h:panelGrid>
  64. </h:form>
  65. </h:panelGrid>
  66. </f:view>
  67.  
  68. </h:body>
  69. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement