Metadata.java
I originally wrote the searchSql function repeatedly, since the query criteria are different, however, the result set are generally same. So I separated out the different part into several method:Users.java
- search(String keywords); - searches for metadata with title or description like keyword.
- browse(); - searches all metadata exist in the metadata table.
- browse(String category); - searches all metadata with matching category
Originially I had copied quiet a few methods from metadata.java to users.java because I hadn't figure out how to call methods from other classes. Now, I will call a constructor class in the UserServlet.java file:
Metadata md = MetadataServlet.geMetadataClass();
then I'll be able to call the delete method from metadata.java which delete selected game from the database. In addition, I'm able to search for all games submitted by this user from metadata.java by calling md.searchUserID(output, username)


No comments:
Post a Comment