I'll try to upload the lecture notes, tutorial instructions any and supporting files before the lecture to save you time in the tutorial typing in the code from scratch.

Don't forget you'll need a password to open the files.

Good Luck!


ps. some of you have had trouble opening the zip file; you'll probably need a reasonable archive manager like winrar or 7-zip to open it.

Thursday, April 10, 2014

Including images in the archive deployed on Glassfish for ues in HTML

I was asked a question yesterday which stumped me about using images in you webpages for you project.

The correct way to do this, for a real website, would be to have them on a different webserver, not the application server.  We, however, don't want to go to these lengths.  We can add them I discovered, after a few minutes of fiddling with Netbeans, to the website relatively easily, only I couldn't find any documentation on this online--the topic was swamped by descriptions of uploading files and the html img tag--and the help built in to Netbeans is very cryptic.

This is what I did:
  1. Parallel to the NetbeansProjects directory I created a NetbeansProjectRecources directory (in My Documents).
  2. Inside that I created a directory with the same name as the project.
  3. Inside that I created the directory I wanted to add to the deployed website, images in this case but it could be any static content.
  4. Then, back in Netbeans, I right clicked on the project and selected Properties from the context menu.
  5. Selected the Packaging category.
  6. Clicked on (Add, I forget) Folder/Library and selected the directory I made in step 3.
  7. I then changed the second value, on the right--the mount point of the directory--and changed that to /images.  The directory names and mount point names don't have to match but it would be less confusing for us if they do.
Once the application has been deployed, anything in the directory can be found in <name of project>/images.  This of course can be used to store any static content such as: css, javascript plain html files and of course images as discussed here.

No comments:

Post a Comment