when we need some global defined parameters in servlet, a good choice is to use ServletConfig init parameter or ServletContext init parameter. But to know which one is the better choice, we need to know the detailed differences between these two parameters:
how to define:
In the DD file:
//In between <servlet> tag pair
<param-name> paramName </param-name>
<param-value> paramValue </param-value>
In the servlet code
* Servlet Init Parameter Can't be used until the Servlet is initialized!!
* Config parameter is read only once!!
* Init Parameter is only for Servlet!! Each Servlet has it's own parameter
I heard this song when I was studying the Design Pattern.
That's really interesting to make those try contents to be a song.
Model, View, Controller Lyrics and music by James Dempsey. MVC’s a paradigm for factoring your code into functional segments, so your brain does not explode. To achieve reusability, you gotta keep those boundaries clean Model on the one side, View on the other, the Controller’s in between. Model View, it’s got three layers like Oreos do Model View Controller Model View, Model View, Model View Controller Model objects represent your application’s raison d’être Custom objects that contain data, logic, and et cetera You create custom classes, in your app’s problem domain you can choose to reuse them with all the views but the model objects stay the same.
You can model a throttle and a manifold Model the toddle of a two year old Model a bottle of fine Chardonnay Model all the glottal stops people say Model the coddling of boiling eggs You can model the waddle in Hexley’s legs
Model View, you can model all the models that pose for GQ Model View Controller
View objects tend to be controls used to display and edit Cocoa’s got a lot of those, well written to its credit. Take an NSTextView, hand it any old Unicode string The user can interact with it, it can hold most anything But the view don’t know about the Model That string could be a phone number or the works of Aristotle Keep the coupling loose and so achieve a massive level of reuse
Model View, all rendered very nicely in Aqua blue Model View Controller
You’re probably wondering now You’re probably wondering how Data flows between Model and View The Controller has to mediate Between each layer’s changing state To synchronize the data of the two
It pulls and pushes every changed value
Model View, mad props to the smalltalk crew! Model View Controller
Model View, it’s pronounced Oh Oh not Ooo Ooo Model View Controller There’s a little left to this story A few more miles upon this road Nobody seems to get much glory From writing the controller code Well the model’s mission critical And gorgeous is the view I might be lazy, but sometimes it’s just crazy How much code I write is just glue And it wouldn’t be so tragic But the code ain’t doing magic It’s just moving values through And I don’t mean to be vicious But it gets repetitious Doing all the things controllers do And I wish I had a dime For every single time
I sent a TextField StringValue
Model View How we gonna deep six all that glue Model View Controller
Controllers know the Model and View very intimately They often use hardcoding which can be foreboding forreusability But now you can connect each model key that you selectto any view property
And once you start binding I think you’ll be finding less code in your source tree
Yeah I know I was elated by the stuff they’ve automated and the things you get for free
And I think it bears repeating all the code you won’t be needing when you hook it up in IB.
Model View, even handles multiple selections too Model View Controller
Model View, bet I ship my application before you Model View Controller