|
From: Jean-Pierre <jp...@jp...> - 2003-08-29 22:07:39
|
In both cases (Internal and RessourceBundle), you are not forced to = "hardcode" as the Controller can easily take properties defined in its = configuration like formView, successView, searchView, etc . My general approach is to hardcode a default value for the view(s), but = defining (a) setter(s) to be able to redefine the view(s) without code = change. As long as the default value can be used, the configuration can = omit to set the property and be less verbose. But it's always possible = to change the view name either in the configuration file either its = default value in the code. Jean-Pierre -----Message d'origine----- De : spr...@li... = [mailto:spr...@li...] De la = part de j=C3=BCrgen h=C3=B6ller [werk3AT] Envoy=C3=A9 : vendredi 29 ao=C3=BBt 2003 23:35 =C3=80 : Lars Fischer Cc : kk...@kk...; spr...@li...; = spr...@li... Objet : Re: [Springframework-developer] Petclinic, skeletons, and sample = apps The controller must specify the name of the view somehow, so you must at = least give some kind of symbolic name... That's the difference between = the default InternalResourceViewResolver and the = ResourceBundleViewResolver: The former interprets the view names as full = JSP paths (not really symbolic, but easy for prototyping), while the = latter maps symbolic view names to any kind of view instances = (introducing a level of indirection). =20 I prefer to give the name of a view instead of a constant like SUCCESS = in WebWork style. You can always name views after controllers, e.g. = "productSearchSuccess" for a "productSearch" controller, if you'd like = to imitate that style. =20 Juergen =20 =20 -----Urspr=C3=BCngliche Nachricht-----=20 Von: Lars Fischer [mailto:lar...@gm...]=20 Gesendet: Fr 29.08.2003 22:34=20 An: j=C3=BCrgen h=C3=B6ller [werk3AT]=20 Cc: kk...@kk...; spr...@li...; = spr...@li...=20 Betreff: Re: [Springframework-developer] Petclinic, skeletons, and = sample apps =09 =09 I must admit, that I didn't ... Looked at hibernate, typical, Petclinic and Countries, maybe I should take a look at the minimal configuration too. =09 Now let's assume that I use all the configuration stuff like viewResolver, urlMapping, xxxMethodNameResolver and even a views.properties file. Is it really necessary to hardcode the name of the view in the controller ? =09 If this ist not the case please just tell me because I didn't check if it is really necessary :-) =09 Thanks, Lars =09 =09 =09 =09 > > One thing I'd like to be improved in Spring (not Petcli > nic) is the configuration of the MVC part. It seems just > too much to configure. > > Have you had a look at the weba > pp-minimal skeleton? If you rely on the default handler m > apping and default view resolution, you don't need to def > ine anything but your controllers. No need for framework > beans, no need for views.properties. Just give your contr > oller beans their URLs as alias names, and return paths t > o your JSPs as view names. Have a look at example-servlet > .xml in the samples/skeletons/webapp-minimal/WEB-INF dire > ctory. > > I agree that there are a lot of configuration o > ptions in the web framework. I've tried to hard to provid > e sensible defaults, though. > > Juergen > > =09 =09 N=18 =E9=9A=8AX'u=DE=BC)=19 Y\g=E9=A2=AD =17 =7F b=D8=9EH=1EzG(J=20 jg=EB=B0=A2=1Dz=ED=BD=96=ED=B2=97x%R=CB=A6 (G^=EC=AE=BDh lq=20 zm=D8=B6?X (=1E~zw X b=CB=9D?=20 jg=EB=B0=A2=1Dz=ED=BD=96=ED=B2=97 |