STORED PROCEDURES in JSP

Can you give me some sample code in using a certain SP on my JSP? a simple one is preferred. thx!
[111 byte] By [tata-yanga] at [2007-10-3 0:32:40]
# 1

try {

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

conn = DriverManager.getConnection("jdbc:odbc:cart");

cartStmt=conn.prepareCall("{ call TotalProduct(?,?)}");

cartStmt.setString(1,cardId);

cartStmt.setString(2,(String)productName);

ResultSet rs = cartStmt.executeQuery();

while( rs.next()){

}

}

vinu@sun.sdna at 2007-7-14 17:26:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

spToExecute=<%=URLEncoder.encode(spToExecute)%>">

use above one for passing stored procedure from one jsp to other[jsp /b]

String spToExecute = "ATS_proc_rptBrokerageCharge "+tid+","+cid+","+strategyid+","+moddatefrom+","+moddateto+" " ;

<a class="PrintFonts" href="PrintPreview.jsp?dd_trade=<%=tid%>&dd_cities=<%=cid%>&reportName=<%=reportName%>&reportId=<%=reportId%>

&spToExecute=<%=URLEncoder.encode(spToExecute)%>">Print Preview</a>

kucharlapatia at 2007-7-14 17:26:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

I have called this SPs to display the message from my MAILBOX and this is my code:

String strSQL = "EXECUTE spGetNewMessage @IDMsg = 12345";

rs = stmt.executeQuery(strSQL); //where IDMsg in my DB is = 12345

the message in DB withIDMsg 12345 is displayed calling this SP using JSON: (im using JSON for this module)

String strSQLx = "EXECUTE spGetOneMsgWRecipient @IDMsg=" + IDMsgJSON;

rsx = stmtx.executeQuery(strSQLx);

while (rsx.next())

{

String body = rsx.getString("strBody"); // the message body is here

main.put("Message:", body);

}

rsx.close();

i need your help if i want to display a certain msg. under certain category. i also have SP for my categories.

how will i display the message for each category in my mailbox?

pls. help.

thank you.

tata-yanga at 2007-7-14 17:26:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...