MySQL, JavaBeans and File Upload
Download war file dbjavabean.war from the http://douap.uap.asia
Required Libraries in WEB-INF/lib folder
Digesting the JSP files.
File index.jsp
Eclipse path for the upload Note that the upload code is included Change \ to / Replace the Eclipse path with the actual deployment path in Tomcat
Using the MyDB.java class
File MyDB.java Get only one record Store the values in a HashMap Values are of type String
public HashMap<?,?> getMap() Reading HashMap in index.jsp Set record id in MyDB bean From public HashMap<?,?> getMap()
Code of HashMap and ArrayList
Flow
Get more than one record HashMap in an ArrayList Refresh content
Reading ArrayList in index.jsp The Hashmap ArrayList
File upload.jsp Includes image resize, database, and upload.
Value of path is from index. jsp. Set it right before uploading Value of path is from index.jsp. Set it right before uploading. Check for file permissions.
Understanding what is passed by the form name and value pairs of the form
Retrieve the file and store it in the hard drive based on the path
For thumbnails, resizing the file based on the size Store in the database
Update database
File slideshow.jsp Variable start dictates what the next image to show Get all images,
Get one image
Test Upload using Eclipse Tomcat
Refresh Project Explorer to show the uploaded file. Refresh page to reflect the uploaded image
Study the code. Recode the your menu using JavaBean.