• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Why two places to define link in servlet class and url-pattern

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I noticed that sun people have not normalized web.xml structure.

for servlet mapping and servlet class declaration there are two sections



I think same can be refactored to



In case of jsp file mapping one can drop servlet-class and user jsp-file tag.

Why sun is using two sctions to describe class location and url-pattern.
Please explain.
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's easier to organize the mappings with it separated and it also makes it easier to see the prioritizing of the URLs mappings.
 
Chetan Sahasrabudhe
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No so convincing response.
Any technical need or something based on scalability of J2EE thing
 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually what we have now is the normalised structure. We have a primary(key)-foreign(key) relation between <servlet> and <servlet-mapping> through the <servlet-name> tag. Am I right?

Instead of having all the details in one place, we have split it into modules and made it cohesive. By cohesive I mean ... the work of the developer and deployer (or administrator) is now separated.

The developer just need to think about the <servlet> tag and the admin need to think about the <servlet-mapping> tag as to which url pattern will use this <servlet>.

Though there are pros and cons in all approaches, I find the current approach ok. What say experts?

Regards,
Mani
 
Marc Peabody
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Chetan Sahasrabudhe:
No so convincing response.
Any technical need or something based on scalability of J2EE thing



Manikandan is right that the way it is now is more "normalized." My original response was mostly to this effect, stating a servlet can have multiple mappings creating one-to-many relationships. I removed that and shortened my response because the way I worded my explanation didn't sound very friendly.

Manikandan very well might also be correct that the sole motivation for the separation was to keep the roles of deployer and developer separate. This role separation in deployment descriptors is made much more obvious for EJBs (SCBCD) but that's mainly because EJBs were intended to be used as reusable, pluggable components that could be deployed in multiple ways.

But to explain my earlier point: it is also easier the way it currently stands. For example, it is possible for a requested URL to match more than one mapping. Which one mapping then will pick up the request? It's easier for the developer (or whoever) to determine which mapping gets the request with all the mappings together.
 
Chetan Sahasrabudhe
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is cool stuff dude.
I now understand why ithttp://www.javaranch.com
Professional Certification is normalized to this level
developer and deployer thing is a important point.
Good help guys.
get ready for more quetions
 
You guys haven't done this much, have ya? I suggest you study this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic