Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Best way to display news from DB in jsp

Best way to display news from DB in jsp

Scheduled Pinned Locked Moved Java
javadatabasehelptutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aljaz111
    wrote on last edited by
    #1

    Hello, what is best way to display news in jsp webpage. With asp i was using repeater, but in jsp i don't know how to. I also want to add buttons to each news so i could edit and delete it. For any kind of help i would be thankful. Best regards

    T 1 Reply Last reply
    0
    • A Aljaz111

      Hello, what is best way to display news in jsp webpage. With asp i was using repeater, but in jsp i don't know how to. I also want to add buttons to each news so i could edit and delete it. For any kind of help i would be thankful. Best regards

      T Offline
      T Offline
      TorstenH
      wrote on last edited by
      #2

      Reading the data from the DB is one part. Displaying the data another. To add some button shouldn't be that difficult. so which part is the problem? regards Torsten

      I never finish anyth...

      A 1 Reply Last reply
      0
      • T TorstenH

        Reading the data from the DB is one part. Displaying the data another. To add some button shouldn't be that difficult. so which part is the problem? regards Torsten

        I never finish anyth...

        A Offline
        A Offline
        Aljaz111
        wrote on last edited by
        #3

        Using div and dynamically creating it with for loop would be the way i will do it. If you have any better idea with displaying it i would be thankful. Reading and adding buttons is not problems. I was just looking for display. How to put id in session via javascript or using jsp code block? function for getting div id:

        function getParent(el, parentTagName){
        var obj = el;
        while(obj.tagName !== parentTagName){
        obj = obj.parentNode;
        }

        alert(obj.id);
        

        }

        html code looks like this:

        Thanks

        modified on Friday, April 29, 2011 11:35 AM

        A 1 Reply Last reply
        0
        • A Aljaz111

          Using div and dynamically creating it with for loop would be the way i will do it. If you have any better idea with displaying it i would be thankful. Reading and adding buttons is not problems. I was just looking for display. How to put id in session via javascript or using jsp code block? function for getting div id:

          function getParent(el, parentTagName){
          var obj = el;
          while(obj.tagName !== parentTagName){
          obj = obj.parentNode;
          }

          alert(obj.id);
          

          }

          html code looks like this:

          Thanks

          modified on Friday, April 29, 2011 11:35 AM

          A Offline
          A Offline
          all_in_flames
          wrote on last edited by
          #4

          I would go about this differently with your javascript. Since you know the iterations you've done (using your for loop), there would be no reason to loop through the page elements testing for equality. You should change the onclick function summary to include the ID you created for your div, e.g.:

          <div id="0">
          <form>
          <input type="submit" target="pr" value="Go" onclick="getParent(this, 0)">
          </form>
          </div>

          (although I have to admit, I don't understand the purpose of your getParent function. It would make more sense to have the onclick of that button post a form up for processing, or kick off an AJAX request to add/remove a news item). Hope this helps, feel free to ask some targeted follow-up questions! Cheers!

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups