I’m
working on interfacing with a web service that performs search capabilities for
our client.
The search
functionality is very interactive where a user types in a command and waits for
a return. There is a whole list of commands that they could enter such as
search, remove duplicates, sort, etc. (This would work similar to a UNIX/DOS
prompt)
My task is
to put a front end web interface and pass the commands to the web service and
display the results.
I have a
working prototype but I’m not happy with the way I evaluate each command.
At the
moment I’m simply doing this:
if(“search”.equalsIgnoreCase(command))
{
//do something here
}
If(“dup”.equalsIgnoreCase(command))
{
//do something here
}
//etc
– for the next 20 commands.
I have
looked at the command pattern but from I’ve read so far this doesn’t
seem like a great fit.
Is there a
better way to encapsulate each “command” so they can be evaluated
and passed on to the correct service?
BTW, this is
a pure Struts app. (no Spring %-) )
--
Bill Taylor