• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

gui not updating performing crud operations

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I m using boostrap cards to show notes when I add note it shows on screen but whenever I update it it is updated and deleted from db but changes are not relected in frontend


 
Marshal
Posts: 79978
397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is that an empty catch (...) in line 95? An empty catch might be causing you to ignore an exception.
 
obaid abbassi
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
one more thing when I use boostrap cards it perfectly align horizontally but when It comes under the loop whole cards shown vertically why

<%


 for (int i=0;i<6;i++)
 {
     %>

<div class="row">


 <div class="col-md-4">


   <div class="card" style="width: 18rem;">
     <img src="..." class="card-img-top" alt="...">
     <div class="card-body">
       <h5 class="card-title">Card title</h5>
       <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
       <a href="#" class="btn btn-primary">Go somewhere</a>
     </div>
   </div>





 </div>






</div>


     <%}



%>
 
Sheriff
Posts: 4646
582
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you would print the exceptions (or let them bubble-up) rather than hiding them, you would probably get some clues as to what it going wrong.
 
obaid abbassi
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because "notes" is null

I got the exception
 
Ron McLeod
Sheriff
Posts: 4646
582
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

obaid abbassi wrote:java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because "notes" is null


Then, I guess request.getSession().getAttribute("list") is returning null.  Check your code where you think you are setting a value for list and make sure that it is not null at that point.
 
obaid abbassi
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
  try {
 List<notes> notes = (List<model.notes>) request.getSession().getAttribute("list");

out.print(notes);}catch...

I checked it shows items in it
 
obaid abbassi
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
whenever I login.jsp to notes.jsp first time I got this exception notes are null but in db notes are there
 
Ron McLeod
Sheriff
Posts: 4646
582
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know if this is part of your problem, but is seems like bad idea to use the same name for a local variable and a class.
Follow the common Java coding standards and rename  your class to Notes
 
obaid abbassi
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<%
   try {
 List<Notes> notes = (List<Notes>) request.getSession().getAttribute("list");

out.print(notes);
 for (Notes n : notes) {






                                             %>



<div class="outer text-center d-flex flex-row ">
 <div class="row mt-5 mb-3 flex-row" style="margin:auto;">

   <div class="col-md-4 col-12">

     <div class="card" style="width: 18rem;" id="card">
       <section class="d-flex justify-content-end icon">
         <a href="edit.jsp?Id= <%=n.getNoteID()%> &Id2= <%=n.getNoteDescription()%>&Id3=<%=n.getNoteName()%> " ><i class="fa-solid fa-pencil"></i></a>
<a href="del.jsp?Id=<%=n.getNoteID()%>"> <i class="fa-solid fa-trash" onclick="trash()"></i></a>



       </section>




       <div class="card-body">
         <h5 class="card-title"><%=n.getNoteName()%></h5>
         <h6 class="card-subtitle mb-2 text-muted"><hr></h6>
         <p class="card-text"><%=n.getNoteDescription()%></p>
         <small style="color:green">Date is :<%=n.getNoteDate()%> </small>
         <small style="color:green">Id is :<%=n.getNoteID()%> </small>
       </div>
     </div>
   </div>




 </div>



</div>

 <%





 }





     }catch (Exception e){

     e.printStackTrace();
 } %>
 
obaid abbassi
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


this the code where i m reading my nots
 
obaid abbassi
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


this is the servelt receiving and performing dao
 
There were millions of the little blood suckers. But thanks to this tiny ad, I wasn't bitten once.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic