File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes About search in the user interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "About search in the user interface " Watch "About search in the user interface " New topic
Author

About search in the user interface

Maurizio Nagni
Ranch Hand

Joined: May 29, 2004
Posts: 75
The instrunctions say:
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.


it is enough clear.... but the question is: because it is not possible in the findRecord method of the interface to add parameter to mach exactly or just to mach a substring, this mean if i need to "EXCACTLY MATCH" the values, after the query in the database (asking to match substrings) i should filer again the records in some utility classes?
Romeo Son
Ranch Hand

Joined: Mar 12, 2007
Posts: 92

Yes, I filter the values fetched from the database once again in my local server implementation.

Regards,

Romeo


SCJP 1.4, SCJD, OCE EJBD 6
Vincent Li
Greenhorn

Joined: Jan 12, 2007
Posts: 22
Yes. Filter in the GUI layer.


Vince<br />SCJP(1.4), SCWCD(1.4), SCJD (5.0)
Ken Boyd
Ranch Hand

Joined: Dec 10, 2003
Posts: 329
Yes you have to filter them in controller class sitting between GUI and Data to match exact values of Name and Location field with values coming from find() method.


SCJP, SCWCD, SCBCD, SCJD, BB Java2 and JSP1.1
Binu K Idicula
Ranch Hand

Joined: Jul 11, 2002
Posts: 99
But there is no word in the exam saying only startwith should be supported by your DataAccess class, that means your DataAccess itself can support this kind of an extra mechanism.

Also there is a need identified as "flexible Search Mechanism" should be provided by Data Access. This means you still can add to DataAccessClass, but can have extra functionality added to it.

And there is no restriction that UI will be only using Data interface. Your DataAccess class must support Data Interface. That means extra functionality might be advisable here.
Lucy Hummel
Ranch Hand

Joined: Apr 07, 2005
Posts: 232
Hi,

I do the exactly matching in my local DBFace. So on Server side.

In my opinion there is no restriction where to do as long as tthe client sees exactly matching.


----------------------------------<br />| SCJP, SCWCD, SCBCD, SCEA, SCJD |<br />----------------------------------
Maurizio Nagni
Ranch Hand

Joined: May 29, 2004
Posts: 75
Yes... I have implemented too in the server side this is not a major problem because they require that functionality for the GUI side and because of that you can implement in the layer you preafer....
wow... thank you all! great talk
Mo Negargar
Greenhorn

Joined: Dec 13, 2002
Posts: 6
I find the AND/OR part confusing. What if the name matches but the location does not? If it is AND this equates to false but if it is OR it equates to true. How have you guys approached this?

Also, do you have a single search textfield in the UI as in Andrew's book? Or two textfields- one for Name and one for Location?

Cheers

Mo.
Romeo Son
Ranch Hand

Joined: Mar 12, 2007
Posts: 92

Hi all,

I do not agree with those that did the filtering on the GUI layer. If the application is started in networking mode, why send wrong values over the network? It is a waste of band.

Unfortunately I cannot purchase Andrew's book (being from Eastern Europe), but I have two text fields in search pane, one for name and one for location.

Regards,

Romeo
[ April 18, 2007: Message edited by: Romeo Son ]
Lucy Hummel
Ranch Hand

Joined: Apr 07, 2005
Posts: 232
Hi,

So Romeo made a valid point to put the stuff on server side:
Originally posted by Romeo Son:
I do not agree with those that did the filtering on the GUI layer. If the application is started in networking mode, why send wrong values over the network? It is a waste of band.


I just allow that the user can search for
  • all non-deleted accomodations
  • non-deleted accomodations that matches name
  • non-deleted accomodations that matches location

  • So I do not allow matching of location and name.

    So I am going to see what Sun thinks about.

    Furthermore, I dropped implementations during writing JavaDoc because
  • not required
  • lazy to document all stuff
  • reduce place where a error might be
  • Mo Negargar
    Greenhorn

    Joined: Dec 13, 2002
    Posts: 6
    Originally posted by Romeo Son:
    I have two text fields in search pane, one for name and one for location.
    [ April 18, 2007: Message edited by: Romeo Son ]
    Mo Negargar
    Greenhorn

    Joined: Dec 13, 2002
    Posts: 6
    Hi Romeo,

    Originally posted by Romeo Son:

    I have two text fields in search pane, one for name and one for location.
    [ April 18, 2007: Message edited by: Romeo Son ]


    This is the approach I have taken but now I am having second thoughts. How do you handle the AND/OR condition? What if the location matches and name does not? Hummel's approach seems more appealing mainly for simplicity reason.

    Any thoughts from anyone else?

    Cheers
    Lucy Hummel
    Ranch Hand

    Joined: Apr 07, 2005
    Posts: 232
    Hi,

    I only search for "OR" in my gui.
    Maurizio Nagni
    Ranch Hand

    Joined: May 29, 2004
    Posts: 75
    well.... I agree with the argument of filtering in the server side. If i can add a suggestion for lucy about
    So I do not allow matching of location and name.

    i do not know how do you implement the filtering but in my case when i request a search i just send two parameter (String[] criteria, boolean[] match)
  • the criteria is just the array string about the search
  • match[i] = true mean "please MATCH EXACTLY"


  • so in the server first i search all the records for substrings;

    after, when i do the filter, i just loop over each result item and if


    ok...ok... it include NOT required matches for the other fields but i just initialize to false (the loop is transparent to "false") the array after this i change just the fields for name and location.
    Romeo Son
    Ranch Hand

    Joined: Mar 12, 2007
    Posts: 92

    Hi all,

    I did a small API to simulate and/or conditions and used recursive calls in my filter method on the server to see if the search condition matches the contractor.
    Vincent Li
    Greenhorn

    Joined: Jan 12, 2007
    Posts: 22
    Originally posted by Mo Negargar:
    I find the AND/OR part confusing. What if the name matches but the location does not? If it is AND this equates to false but if it is OR it equates to true. How have you guys approached this?


    I think it's how you read the English. Do you read the "name and/or location" as:

    1) name, or
    2) location, or
    3) name and location

    Or

    1) name, or
    2) location, or
    3) name and location, or
    4) name OR location

    The addition of the 4th item is where you have values for searching name and location but want a inclusive set. My interpretation is the first set with no complicated "name or location". That interpretation is simply you either enter a "name" to search by name OR enter a "location" to search by location, OR both to search for both. Basically, the premise is you don't need to get a combination of the result of name only AND location only. If you have a value, that's is implicit AND. I believe grammatically, that fully satisfies the criteria as stated.

    After all, where would you stop? How may combinations will you support? If you have a combined "name" or "location", why can't you have a set with 2 names? i.e. I want those that start with A and starts with B? or those in Vancouver and Toronto (location OR location)?


    Also, do you have a single search textfield in the UI as in Andrew's book? Or two textfields- one for Name and one for Location?


    I used 2 search fields. But then, I only got 27/40 in my GUI.

    So, may be there is something to this "OR" thing and something to the dialog.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: About search in the user interface
     
    Similar Threads
    Expectation of future functionality enhancements
    NX: Find Requirments
    Urly bird find method: are search criteria "and"- or "or"-composed?
    Search : Exactly match or "begins with" ?
    flexible search and B&S requirement