1

I have two simple interfaces. One accepts sql query the other is popup which display the result. I want to integrate them both. I mean i dont wnat the popup. Instead the result should be displayed on same page. I know it can be done with ajax, but dont know how. I dont want to get into that array stuff(sending data in array form from server). Simply i want the work to be done with the present code with little change..

This is display.jsp

<body>
<form action="show.jsp" method="post" target="show.jsp">
   <textarea rows="4" cols="80" name="qry"></textarea>
   <input type="submit" value="Show"/>


The below is show.jsp

<sql:query var="rs" dataSource="jdbc/production">
    ${param.qry}
</sql:query>
<body>
    <table width="100%" id="dataTable" class="display">
        <thead>
            <tr>
                <c:forEach var="col" items="${rs.columnNames}">
                <th>${col}</th>
                    </c:forEach>
            </tr>
        </thead>
        <tbody>
            <c:forEach var="row" items="${rs.rowsByIndex}">
                <tr>
                    <c:forEach var="column" items="${row}">
                        <td><c:out value="${column}"/></td>
                    </c:forEach>
                </tr>
        </c:forEach>
     </tbody>
</table>
</body>

Anyone please give a solution for this(A simple one).

1 Answer 1

2

What I do is that I add the data I want to display on the web page as an attribute to the request object. After redirecting to the required page, I get the data from the request object and check whether the it is null. If not, I display that data. This way you will be able to dynamically display the data you want to.

Sign up to request clarification or add additional context in comments.

4 Comments

this means the total page is refreshed wright??. I want to update the table at a particular part(suppose a div).
Yes, I use J2EE. So it works like, Servlet -> Display Page (without the query data) -> Servlet -> Display Page (this time with the query data)
Sorry for late reply. My office hours were over. Actuall i dont want the page to flicker or browse from one to other. Want that to be done staying on same page, any ideas? @Expressions_Galore
Yes it stays on the same page. Try it and post back if you have any issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.