findByCriteria takes an array of String. While some data are not String, they may be numeric, like size or money, so the search result may not be what we want. For example, client want a room low that $30, what we return are anything begining with "$30" such as $300, $302..
So I can just show the String field and hide numeric and other fields in search panel? Or be complex, introduce two-stage criteria search: return all matches that meet string criteria, and then in business layer, filter out those not meet numeric criteria?
SCJP 6 with 93%
Oracle Database SQL Expert with 98%
I didn't search for rooms but for contrators, and for me I was required to provide search by name and location. Do you need to search by price? If not, you can omit that problem altogether (I also noticed the same thing, but learned to live with it and ignored it).
Your find method in Data class should adopt a startsWith search, but you should only show the exact matches in the JTable. So you have to do some extra filtering in the client or the business layer
Joined: May 29, 2010
That's a safe and accurate way!!!
Joined: Aug 21, 2008
Jianping Wang wrote:So I only include name and location in search section of client GUI.
It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.
The "exactly match" seems more restrict than "start with". Should I ignore "exactly match" and adopt "start with" instead?
I understood this differently - my GUI must allow searching by this, but it never says it is the only way, so I concluded I might provide something additional, a superset of this must. As a result, I implemented a case-insensitive search using String.contains(), which will work for the mentioned requirement (if someone puts an exact location, it will be found), will work for the example in the DB interface (for "Fred" find "Fred" and "Freddy"), but also is more user-friendly.
Generally, I see now that in y assignment I did a lot of things may way, a lot of decisions is made based on how I understood the requirements, not how this forum interprets them. For example, my assignment never says that I cannot use java.nio classes, so I used java.nio.Charset. We will see ;d
The following APIs and facilities may not be used:
* Enterprise JavaBeans
* Servlets, JSP technology, or any other web-oriented APIs
* NIO, the New IO facilities
* Java DataBase Connectivity (JDBC) and SQL
* Java IDL API and CORBA
* Third party software libraries or tools (such as browsers)
Well, now I know it, I never looked at that page. But, I understand it that the instructions.html is the alpha and omega, and it is the document that states the requirement, overriding anything else. After all, it's called "instructions.html", right? If I fail for that reason, this will be really stupid (both on my and Suns part) and will try to take actions ;d But let's wait.