s******e 发帖数: 493 | 1 requirements: read only data. Database scheme is a little complicated(maybe
not necessary, but I have no control). several similar products, each have
some subsets. The front looks similar(the data is shown in a table with
different headers) but the results come from different tables.
Technology chosen: jsp/javascript as the front, spring mvc with dao and
ibatis sql map as middle tier.
One thing that i am not quite comfortable with my design is that i tightly
couple url pattern with my POJO logi |
m******t 发帖数: 2416 | 2 What kind of "coupling" are we talking about here? The part-of-the-url-is-
the-POJO-method-name kind of coupling would be very bad. |
s******e 发帖数: 493 | 3 Yeah. It is just like waht u said. This makes me very uneasy. Any suggetion
for improvement. I would show the flow in details as follows:
A controller <---(inject) Helper interface (with one single method of
service(Object) I pass the httpServletRequest for further processing. An
abstract helper class containing the method invokation code after analyzing
url. For example, ../Home.do(almost all products have this url) will cause
serviceHome method to be called. In the serviceHome, the appropriate |
h******a 发帖数: 46 | 4 I would first do more bussiness requirement rearch, something like what's
the relationship of the 7 products? any business similarities? how is client
going to use them? who is going to maintain this project? etc. then you
might have better ideas of how to implement it. btw, you can always refactor
it in the future.
suggetion
analyzing
products
【在 s******e 的大作中提到】 : Yeah. It is just like waht u said. This makes me very uneasy. Any suggetion : for improvement. I would show the flow in details as follows: : A controller <---(inject) Helper interface (with one single method of : service(Object) I pass the httpServletRequest for further processing. An : abstract helper class containing the method invokation code after analyzing : url. For example, ../Home.do(almost all products have this url) will cause : serviceHome method to be called. In the serviceHome, the appropriate
|
m******t 发帖数: 2416 | 5 Did you look at Spring's MultiActionController and one of the
AbstractMethodNameResolver subclasses?
suggetion
analyzing
products
【在 s******e 的大作中提到】 : Yeah. It is just like waht u said. This makes me very uneasy. Any suggetion : for improvement. I would show the flow in details as follows: : A controller <---(inject) Helper interface (with one single method of : service(Object) I pass the httpServletRequest for further processing. An : abstract helper class containing the method invokation code after analyzing : url. For example, ../Home.do(almost all products have this url) will cause : serviceHome method to be called. In the serviceHome, the appropriate
|
s******e 发帖数: 493 | 6 Yeah I did. Actually I believe that finally we reach my real problem.
I thought to use mutilActionController and PropertiesMethodNameResolver. But
the problem is that I need to define a method name resolver for each
product even the url patterns are similar and the method names are the same.
for example, i have urls: ../df/home.do and ../ma/home.do(I use the prefix
to distinguish url patterns, so I do not want too many url pattern names,
which is also bad for maintainence), I need to define two |
m******t 发帖数: 2416 | 7
will
Well finding the controller and method resolving are two separate steps in
standard Spring MVC anyway, isn't it? I don't see why it can't be done with
any UrlMapping plus a MethodNameResolver. I guess I'm still not getting
your whole picture.
Or just write your own MethodNameResolver maybe? It's just one method to
implement, really. 8-)
【在 s******e 的大作中提到】 : Yeah I did. Actually I believe that finally we reach my real problem. : I thought to use mutilActionController and PropertiesMethodNameResolver. But : the problem is that I need to define a method name resolver for each : product even the url patterns are similar and the method names are the same. : for example, i have urls: ../df/home.do and ../ma/home.do(I use the prefix : to distinguish url patterns, so I do not want too many url pattern names, : which is also bad for maintainence), I need to define two
|
g*****g 发帖数: 34805 | 8 Spring doesn't provide you everything. But it does provide
a flexibile framework that you can extend and implement your own.
For his design need, I think writing his own MethodNameResolver
would be the best approach.
In our Webmail project, every user belongs to some enterprise,
and every enterprise will have its own branding files. A
home grown LocaleResolver and MessageSource will work like a charm.
with
【在 m******t 的大作中提到】 : : will : Well finding the controller and method resolving are two separate steps in : standard Spring MVC anyway, isn't it? I don't see why it can't be done with : any UrlMapping plus a MethodNameResolver. I guess I'm still not getting : your whole picture. : Or just write your own MethodNameResolver maybe? It's just one method to : implement, really. 8-)
|
s******e 发帖数: 493 | 9 Sorry for late response. I guess that might be my best solution. thx for
both of u to discuss with me. |