Greetings to all,

I am making my way through Appfuse 2.0, outstanding stuff! I am using Spring
/ Hibernate / Spring MVC Basic.

While going through the tutorials I decided to do the 'extra' work for the
Person POJO, creating a Dao and Manager with tests, et al. I noticed that
although the PersonDAO and PersonManager both have findByLastName
functionality, at the web level there is no mention of this method in the
Controller or its tests. So I took it upon myself to implement it and I have
some doubts.

First of all, to even be able to call the findByLastName() method you must
change its personManager from GenericManager to your
org.appfuse.tutorial.service.PersonManager. Correct?

My other question is about the best way to implement this functionality at
the web level. Granted, it seems like a simple enough thing to do but I am
not sure if I should:

1. Make a new Controller for search capabilities
2. Use the PersonController and just add an 'if' to the handleRequest()
method 
3. Use the PersonFormController and add an 'if' to the onSubmit() method

The problem with (1) is it seems like overkill.

The problem with (2) is that if I add something like:

if (request.getParameter("search") != null) 
{
  String search = (String)request.getParameter("search");
  return businessManager.findByName(search);
}
else return businessManager.getAll()

... it craps out. It seems the request object is null. Not sure why this
would be. But even so, it doesn't seem correct to send a value to the
PersonController. It doesn't have a form associated with it because its job
is to spit out a list. So sending it a form value seems like bad practice
...

And the problem with (3) is that I'd have to have two forms in the jsp, one
for creating and modifying a Person and another for searching. Otherwise I
would have to add a 'search' field to the Person POJO so the form field
populates correctly using the <form:form> tag, which isn't a good idea. 

Regardless, validation still fails. If I use one form and a plain-old input
text field (instead of a <form:form> tag) validation fails on the
client-side. If I use two forms validation fails on the server side because
in the end I am still calling the same Controller, PersonFormController,
which expects a Person POJO and validates it ...

Perhaps I am making too much of something simple. But my questions are
really generic, they don't only concern searching functionality. Going
forward I'll be adding a bunch of non-CRUD functionality to the web app and
I am interested in best practices as to how/where to do it.

Many thanks!
Bob
-- 
View this message in context: 
http://www.nabble.com/The-simple-things-tf4034922s2369.html#a11462461
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to