Updating A Database Using The Sql Update Tag

 
 
This JSP source code is about Updating a database using the sql:update tag
 
 
  1. //web.xml

  2.  

  3. <?xml version="1.0" encoding="UTF-8"?>

  4. <!DOCTYPE web-app PUBLIC "-//Sun Microsystems,Inc.//DTD Web Application 2.3//EN"

  5.   "http://java.sun.com/dtd/web-app_2_3.dtd">

  6. <web-app>

  7.   <resource-ref>

  8.     <res-ref-name>jdbc/address</res-ref-name>

  9.     <res-type>javax.sql.DataSource</res-type>

  10.     <res-auth>Container</res-auth>

  11.   </resource-ref>

  12. </web-app>

  13.  

  14.  

  15. <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>

  16. <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

  17. <html>

  18. <head>

  19. <title>Updating a database using the sql:update tag</title>

  20. <sql:setDataSource

  21.   var="conn"

  22.   dataSource="jdbc/address"

  23. />

  24. </head>

  25. <body>

  26. <h1>Modify Address List</h1>

  27. <sql:update dataSource="${conn}" var="addresses">

  28.     INSERT INTO AddressList (name,street,city,country,telephone) VALUES (?,?,?,?,?)

  29.     <sql:param value='${param["name"]}'/>

  30.     <sql:param value='${param["street"]}'/>

  31.     <sql:param value='${param["city"]}'/>

  32.     <sql:param value='${param["country"]}'/>

  33.     <sql:param value='${param["tel"]}'/>

  34. </sql:update>

  35. </body>

  36. </html>
 
Copy to Clipboard      Download code as Text Format
 
  Date entered : 24th Jan 2007
  Rating : No Rating
  Accessed  :  1558
  Submitted by :  javabill
 
   Add Comment  Printer friendly
   View All Comments  Email to a friend
   Add to my Favourites Download PDF version
   Rating  
 
                 Click each image to add
this page to each site.
 
 
 
Comments Available

    No comment available at the moment.Be the first one to make a comment

 
Related JSP Source Codes
Database error: Invalid SQL: select FLOOR( AVG(b.rating)) as avg_rating,a.sourcecode_id sourcecode_id ,title,description,author,category_id,skill_level,reference,reference_mail,reference_url,a.user_id user_id,date_entered,source,accessed,dev_id,file_url,total_comments,instruction,registered,authorised,fld_deletemark,fld_code_version,fld_searchkeyword,fld_code_status,category_id from tbl_sourcecode a LEFT JOIN tbl_sourcecodecomment b ON a.sourcecode_id = b.sourcecode_id LEFT JOIN tbl_codecategory c ON a.category_id = c.fld_categoryID where a.fld_deletemark = 'N' AND a.fld_enable_disable= 'Y' AND a.authorised='Y' AND c.fld_groupIDFK='4' AND a.sourcecode_id!='854' GROUP BY a.sourcecode_id order by a.sourcecode_id DESC limit 0, 5
MySQL Error: 1030 (Got error 122 from storage engine)
Session halted.
Warning: Unknown(): write failed: Disk quota exceeded (122) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0