Regardin SQL SERVER

Hi,

when i try to set a a href for the value retrieved from my database im getting error NO DATA FOUND. is there anyway to set link to the value retrieved from database.

<td width="40"><a href="Edit.jsp?sno=<%= rs.getString("sno")%>"><%= rs.getString("sno")%></a></td>

Is there any thing wrong in that... If so please help me out thanks in advance

[410 byte] By [i.abdula] at [2007-11-27 1:59:29]
# 1

Why are you writing JDBC code directly inside a JSP, it belongs to the Java Classes.

Also, after obtaining the result set store it in an ArrayList and then close the resultset, the statement and the connection and return the ArrayList.

Then inside the JSP access the ArrayList with the jsp:useBean tag and then iterate over the ArrayList with JSTL's c:forEach tag.

HTH

appy77a at 2007-7-12 1:37:18 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Hi appy,Thanks for your suggestion... It worked for me
i.abdula at 2007-7-12 1:37:18 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Hi abdul,

Great!

You could take a look at DAO Pattern also:

http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html

it will help you with the data access layer.

Also, use MVC for the front UI part, to use Servlets as a Controller of JSPs and to interact with the application layer, in addition to using jsp:useBean tag and JSTL tags.

http://java.sun.com/blueprints/corej2eepatterns/Patterns/FrontController.html

Nice to see someone who is proactive :-)

appy77a at 2007-7-12 1:37:18 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
[offtopic]Appy77, how did you get rid of this annoying duke star next to your nickname? I can't find an option in the Forum settings or so.[/offtopic]
BalusCa at 2007-7-12 1:37:18 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

> [offtopic]Appy77, how did you get rid of this

> annoying duke star next to your nickname? I can't

> find an option in the Forum settings or so.[/offtopic]

It's funny, I didn't do anything.

Also I'm still Bronze but when I click on my profile I see Platinum, even though I have only 135 dukes as of now.

I'm sure it's a glitch somewhere, but I didn't bother to check with tech support so far :-) , may be I should report it because it is unfair that I'm Platinum when I'm supposed to be Bronze.

appy77a at 2007-7-12 1:37:18 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...