tags:

views:

8

answers:

1

I am reteriving the set of values inside a table from database in a jsp page then it is in the form of link. Now I want to click that value and move to another jsp page. How to code the program so that it can recognise that value and it can move to the next desired page. But I unable to do that. please help me....

+1  A: 

Well, the steps are something like:

  1. Query the database (with JDBC for example)
  2. Iterate the ResultSet and add each link to a java.util.List
  3. Use an object Link that has two fields - the href, and the text value.
  4. This all is invoked from the doGet() method of a servlet - when you have the List, place it in the request using request.setAttribute("links", linksList)
  5. forward to the JSP (request.getRequestDispatcher("yourPage.jsp").forward();
  6. On the page use JSTL to do the following:

    <c:forEach items="${links}" var="link">
       <a href="${link.href}">${link.text}</a>
    </c:forEach>
    
Bozho