0

Hi

Im a newbie of jsp and Im developing a project in jsp. I want a text box that display data from database in the same place when i click a link.all the links are available in a table.
Any help appreciated...

Thanks in advance,
Indu.

2
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by indu_ss4
0

There are tutorials here: http://www.w3schools.com/default.asp on how to create tables and links.
You can also place a link inside a table:

<td>
<a href="some_link.jsp">some text</a>
</td>

Now if you don't know how to read data from the database, that is an entirely different thing, and you need to be more specific with your question.
As far as writing java code inside a jsp, there are a lot of things that cannot be mentioned here so you'd better read a book or something and come back with some specific questions

0

Thanks a lot...
I have a link in the table data, if i click that link i want to display the corresponding data from database in a text box in the same place itself and not to display in a new page.


Regards,
Indu

0

then have that link point to the same page and pass through the link your parameters.

<a href="samePage.jsp?param1=aaaa&param2=bbbbb">
</a>

Get those parameters at the beginning of the code and check if they are not null. If they are null means that the pages has just been load and you shouldn't search the DB. I they are not null it means that the page was loaded by clicking the link and you should use those parameters:

String param1 = request.getParameter("param1");
String param2 = request.getParameter("param2");

String dataToDisplay="";

if ((param1!=null)&&(param2!=null)) {
    // read from DB
    // DON'T OPEN THE CONNECTION HERE OR PERFORM ANY OPERATION REGARDING THE DB.
   // CREATE SEPARATE METHODS IN ANOTHER CLASS THAT DO THAT AND CALL THEM
    dataToDisplay = DBClass.readData(....);
}
0

Thanks a lot for your great help..
I have solved that issue with your help.

Regards,
Indu

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.