Design pattern of servlet context

hi all
can u please tell me what design pattern is used in servlet context.
thanks

http://www.google.com/search?hl=en&client=netscape-pp&rls=com.netscape%3Aen-US&q=design+pattern+for+servlet+&btnG=Search

Similar Messages

  • Design Pattern for Servlets

    Hello,
    I am about to organize my huge servlet code. I have a web application which is currently running as a single servlet (I know bad bad design) and I want to filter out from there to a more manageable and appropriate design. I researched the internet and did not find a compelling design pattern or library that I can use to do the same. I would really appreciate if experienced folks could share what design patterns they use for the entry servlet to their web-app. Thanks in advance.
    Ravi.

    Check out the famous Struts.
    Regards,
    Reflex

  • Connecting - JavaFX + Servlets(??) + design patterns

    Hello
    I'm a total noob in JEE world so I'm sorry if I'm asking for sth really basic.
    I would like to connect my JavaFX application with a simplest there is JEE-server. My guess is - Servlets (a good guess?). But before I start, here are some obstructions I need to face. The general goal of this whole project is to test few (around 5) JEE design patterns. It's because of my science project: "The use/usage of JEE design patterns in creating web applications". So what's the JavaFX for? My promotor asked for an application that would be handy for my College. So again what is going to be done :
    - connect the JFX app with JEE server
    - test the whole project with Cobertura, Checkstyle, Apache JMeter, Findbug, Cobertura, PMD/CMd and so on
    - refactor the project with 5 design patterns. I think I'll try to use: DAO, Intercepting Filter, any suggestions what more?
    - test again
    - compair test results. Make conclusion on the thesis.
    As for now I've found JFX class that could be used to communicate:
    http://java.sun.com/javafx/1.2/docs/api/javafx.io.http/javafx.io.http.HttpRequest.html and other from javafx.io.http
    I'm looking for the simplest way because I don't have a lot of time! :(((( So, is there a book, tool or a tutorial explaining how to quickly and simply do the stuff above?
    What I have installed:
    - winXP SP3 (linux and Eclipse still are crappy with JFX)
    - Netbeans 6.7.1 with JavaFX and now I've installed additionally:
         - Java Web Applications
         - Sun Java System Web Server 7.0
         - EJB and EAR
    Anything else I need?

    Why don't using ejb for remote client?
    It can be simpliest, you avoid web tier dev in the server and http on the fx side.
    Any version requieried for the JEE? With the sixth one, few annotations and just concentrate on your job, very nice.

  • SERVICE LOCATOR ?? Is it really an interesting Design pattern??

    Hi everybody,
    i've a problem with the J2EE Design Pattern "Services locator" (it's a singleton).
    It is said that by making use of a Service Locator we can :
    - hide to the client the complexities of initial context creation, EJB home object lookup,and EJB objectre-creation.
    - multiple clients can reuse the Service Locator object to reduce code complexity, provide a single point of control, and improve performance by providing a caching facility.
    But i would like to understand at which side should that service locator object reside??!!??
    If it is at server side then the clients need well an initial context in order to make a lookup on that object.
    Conclusion :
    the service locator doesn't hide the complexities of initial context!!
    Furthermore the client has to perform a look-up on that service locator object!! The only advantage left is caching facility.
    If it is at client side, each client needs his own services locator object
    Conclusion :
    multiple client don't reuse the same service locator. What's the advantage to be a singleton ???
    There is certainly something that i don't understand so help me please!! Thanks.

    Hi Yves,
    But i would like to understand at which side should
    that service locator object reside??!!??
    If it is at client side, each client needs his own
    services locator object
    Conclusion :
    multiple client don't reuse the same service locator.
    What's the advantage to be a singleton ???The service locator resides on the client side and is implemented as
    a singleton. Since it is possible that there could be multiple
    class loaders/JVMs on the client side, and therefore, multiple
    instances of the "singleton" service locator. This is typical
    in a distributed environment (e.g. servlets/JSPs in a web-tier
    cluster using service locator). Thus service locator is not
    a truly "distributed singleton" object. But, the empahsis
    is to design the service locator such that it does not hold
    any state that needs to be replicated across multiple
    instances across different JVMs as mentioned. Thus, there
    is no need for multiple clients to use the "same" service locator,
    but still the benefits of implementing this pattern is realized.
    By making it a singleton, and keeping it from holding state
    that needs to be replicated, we realize the benefits of this pattern.
    You may also want to visit the J2EE Pattern interest list
    and see these relevant discussions :
    Topic: Service Locator and passivation
    http://archives.java.sun.com/cgi-bin/wa?A2=ind0106&L=j2eepatterns-interest&F=&S=&P=1026
    Topic: Caching EJBHome interfaces
    http://archives.java.sun.com/cgi-bin/wa?A2=ind0106&L=j2eepatterns-interest&F=&S=&P=9226
    Topic: Using Service Locator for Data Source caching
    http://archives.java.sun.com/cgi-bin/wa?A1=ind0106&L=j2eepatterns-interest#31
    hope this helps,
    thanks,
    -deepak

  • Design pattern

    Hi all
    I am developing a enterprise application using Struts 1.2,Spring 2.0 and Hibernate 3.0.Now i am concentrating in design pattern of my application. I read many article, there I Could find many pattern like session facade, business delegate, service locator, layered pattern ,etc. I came to know that business delegate and session facade are useful for EJB based application with distributed environment. My application does not need distributed environment. I have a plan to implement design pattern as follows
    Presentation layer -Struts
    Data Transfer object or Value object -with support from Struts form Bean
    Business layer - Spring ,Transaction management with spring AOP ,
    Persistence layer -Hibernate with spring support.
    Service locator - implemented by Spring application context file.
    IN the above, layers orders may change, pls ignore that.
    Please suggest ,it is a correct design or any enhancement can be given to this pattern.
    Any with relevant examples are really appreciated
    Thanks in advance

    For Data Access layer you will be having a Query or stored procedure defined which will be in Sync with your Orchestration . So whenever there is request coming from UI you need to call this Orchestration through schema or Orchestration exposed as web service.
    So there are two pointers.
    1) consume your Query or Stored procedure inside your Orchestration (with WCF SQL or WCF Oracle adapter). various articles exist to implement it
    http://msdn.microsoft.com/en-us/library/dd787968.aspx
    http://btsguru.blogspot.in/2011/08/wcf-sql-adapter-stored-procedure.html
    2) Once done you can expose your request response schema as web service
    http://msdn.microsoft.com/en-us/library/bb246047.aspx
    Thanks
    Abhishek

  • A beginner to design pattern(Struct,Spring & Hibernate framework)

    Actually I am beginner to MVC2 Approach of complex application incorporated by design pattern as Struct,Spring & Hibernate framework.
    Currently I am learning JSP Concepts,I have one doubt.
    (1)What are the things I should grasp even before taking off to Design pattern?
    Help me anyone plz?
    With Regards,
    Stalin.G

    [email protected] wrote:
    Actually I am beginner to MVC2 Approach of complex application incorporated by design pattern as Struct,Spring & Hibernate framework.
    Currently I am learning JSP Concepts,I have one doubt.Just one?
    >
    (1)What are the things I should grasp even before taking off to Design pattern?You should understand core Java very, very well.
    You should know JSPs using JSTL without scriptlets.
    You should understand relational databases and SQL.
    You should understand HTML and HTTP.
    Personally I think Struts, Spring, and Hibernate all at once are well beyond any beginner.
    It's hard to advise you on what to do without knowing your capabilities and the problem you're trying to solve, but I think you should try it first using just JSPs, servlets, and JDBC. Get that to work and then refactor it to use the frameworks. You'll understand and appreciate them more that way.
    %

  • What is a design pattern?

    Howdy,
    I hear a lot of talk of deasign patterns in ABAP...
    My question is what on earth is a design pattern and why/how would it be useful?
    Any ideas anyone

    Hi Steve.
    The good point to start with design patterns is to read book "Design Patterns - Elements of Reusable Object-Oriented Software" by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides. It gives strong, consistent understanding of patterns basis with real life examples.
    Short introduction extract:
    "Christopher Alexander says, "Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice". Even though Alexander was talking about patterns in buildings and towns, what he says is true about object-oriented design patterns. Our solutions are expressed in terms of objects and interfaces instead of walls and doors, but at the core of both kinds of patterns is a solution to a problem in a context.
    In general, a pattern has four essential elements:
    The pattern name is a handle we can use to describe a design problem, its solutions, and consequences in a word or two. Naming a pattern immediately increases our design vocabulary. It lets us design at a higher level of abstraction. Having a vocabulary for patterns lets us talk about them with our colleagues, in our documentation, and even to ourselves. It makes it easier to think about designs and to communicate them and their trade-offs to others. Finding good names has been one of the hardest parts of developing our catalog.
    The problem describes when to apply the pattern. It explains the problem and its context. It might describe specific design problems such as how to represent algorithms as objects. It might describe class or object structures that are symptomatic of an inflexible design. Sometimes the problem will include a list of conditions that must be met before it makes sense to apply the pattern.
    The solution describes the elements that make up the design, their relationships, responsibilities, and collaborations. The solution doesn't describe a particular concrete design or implementation, because a pattern is like a template that can be applied in many different situations. Instead, the pattern provides an abstract description of a design problem and how a general arrangement of elements (classes and objects in our case) solves it.
    The consequences are the results and trade-offs of applying the pattern. Though consequences are often unvoiced when we describe design decisions, they are critical for evaluating design alternatives and for understanding the costs and benefits of applying the pattern. The consequences for software often concern space and time trade-offs. They may address language and implementation issues as well. Since reuse is often a factor in object-oriented design, the consequences of a pattern include its impact on a system's flexibility, extensibility, or portability. Listing these consequences explicitly helps you understand and evaluate them."
    Regards,
    Maxim.

  • Design Patterns: Do you have a good STRATEGY?

    1. Context: Create a XML file. And since there
    are many ways: DOM, WAY1, OTHERWAYS, ETC...
    2. Question: As a Design Patterns application purpose,
    can we use the Strategy Pattern? Is it appropriate one?
    If not, what are the alternatives?
    CLIENT
    --CREATEXML (CONTEXT)
    ----CREATEXMLSTRATEGY (STRATEGY)
    ------CREATEXMLSTRATEGY_DOM (CONCRETE STRATEGY)
    ------CREATEXMLSTRATEGY_WAY1 (CONCRETE STRATEGY)
    ------CREATEXMLSTRATEGY_OTHERWAYS (CONCRETE STRATEGY)

    Hi Paul,
    I have myself recently started doing the Design Patterns and believe me after understanding the Patterns OOD have become more clear. >>1. Context: Create a XML file. And since there are many ways: DOM, >>WAY1, OTHERWAYS, ETC...
    My understanding regarding the Strategy and Tempelate method Pattern has become stronger after reading the "Thinking in Patterns in Java" , the author is mentioning there these Behavioural Patterns are used for Framework development , infact there he has used example of Framework development.
    Now regarding your question it seems to me that your entire applicaiotn can use the Creational Pattern , like Abstract Factory.You can use the DOM,WAY1,OTHERWAYS as the concrete Prodcuts and all will be extracted from the Factory XMLGeneratorFactory.
    Strategy Pattern is changing the algorthims at the run time , the temlate can work for your applicaiton but then what you are trying to achieve.Currently this much I can say ..
    Let us see for more opinions
    Regards
    Vicky

  • "State" Design Pattern Issues

    I am implementing a class that requires state information. I decided to follow the design pattern, and I found a great site for reference (which provided the code below) but I need to implement substates. It would be impractical to store all of the states in the fashion below. I am trying to find a way to somehow store another substate in the class below without creating so many classes. I am thinking about creating the substates the classic way with just constants, but I cant store the current substate in the static final States. In short, either using the code below or not, how do I implement a system with states and substates following the State Design Pattern?
    abstract class State {
        static State initialState;
        static final State state1 = new State1();
        static final State state2 = new State2();
        protected State() {
          if (initialState == null) initialState = this;
        abstract void stateExit(StateOwner owner);
        abstract void stateEnter(StateOwner owner);
      class State1 extends State {
        void stateExit(StateOwner owner) {
        void stateEnter(StateOwner owner) {
      class State2 extends State {
        void stateExit(StateOwner owner) {
        void stateEnter(StateOwner owner) {
      }

    This isn't exactly an implementation of the state pattern.
    I suggest that you check out the GOF book for details but here are some suggestions:
    1) Your abstract State should not contain State objects but should provide the interface for your State behavior.
    2) Each substate that you describe is actually an individual State and should be a concrete implementation of the State class or interface.
    3) There are several ways to handle state transitions but one that I like is to have the concrete States know about when to make state transitions and provide a call back mechanism to the context that has the handle to the state to allow the state to set the new state in the context when a state transition occurs.
    For example
    abstract class State
        abstract void stateExit(StateOwner owner);
        abstract void stateEnter(StateOwner owner);
    class State1 extends State {   
        void stateExit(StateOwner owner) {
            owner.setState(new State2().stateEnter(owner));
        void stateEnter(StateOwner owner) {
    class State2 extends State {
       void stateExit(StateOwner owner) {
        void stateEnter(StateOwner owner) {
    public class StateOwner
        State s;
        public StateOwner()
            s = new State1(this);
            s.stateEnter(this);
        public void setState(State s)
            this.s = s;
    }This is how I've implemented it and in general how it is done in GOF.
    Hope this helps.
    Charles

  • EJB Design Patterns Book Question

    I have been recently reading the EJB Design Patterns book by Floyd Marinesu.
    In one of the earlier chapters he says that 'entity beans are transactional creatures, each method call on an entity will require a separate transaction ..'.
    Surely this is wrong, if you are using CMT and mark your method transaction attribute as Required then if the calling bean has a transaction the called bean will use that transaction, rather then requiring a separate transaction.
    Someone please explain.

    Quoted out of context, the statement seems to be incorrect in some cases. IMO, the fact stressed is the "synchronization of the remote entity", which might have been loosely associated with a separate transaction.
    Here's the original quote.
    Furthermore, since entity beans are transactional creatures, each method call on an entity will require a separate transaction on the server side, requiring synchronization of the remote entity with its underlying data store and maintenance on behalf of the application server.
    Maybe Marinescu would answer that better :-)

  • What kind of design pattern is this?

    Hi ,
    I am just learning the designpattern. So when I went through different kinds of design pattern, I got some doubts as it looks same some design patterns. could anybody please tell what kind of design pattern is the following one?
    public interface IExporter{
         void export();
    public class ExcelExporter implements IExporter{
    public void export(){
    //TODO implementation
    public class CVSExporter implements IExporter{
    public void export(){
    //TODO implementation
    }thanks in advance..

    Well - in structure, it is nearest to the Command pattern as far as I can tellOr Strategy. Or Builder. Several design pattenrs may share the same class structure, the difference is in the context, forces, and the parts one want to be flexible. And if someone wants to make it explicit which pattern is applied, they should name things accordingly.
    As Saish said this example shows little more that inheritance at work. Not a pattern in itself, but a core element of the language. Trying to "identify" a pattern that is not obvious from the context is either:
    - a sign that the original coder completely missed the point of using a pattern (which is, as Saish said too, assentially about communication)
    - a sign that the maintenance coder is looking for patterns where there aren't
    - an exercise question
    but it differs in so much as its motivation is to polymorphically allow the use of different exporters rather than provide a set of action commands.That shouldn't count as a difference, merely as an "application" (it's perfectly valid to have a hierarchy of commands all devoted to exporting, although, as stated, if the original coder applied the Command pattern, he should have made it explicit, by renaming the interface, e.g. to ExportCommand).

  • Servlet Context

    Could anyone please clarify me the meaning of the following line:
    "if the app is distributed, there's one ServletContext per JVM!"
    The above line I've quoted from head first book page no. 159. One thing has been cleared that, there's one ServletContext per web app, but still not able to grab the above quoted part specifically.
    Thanks in advance.

    For example, in online stores UI(view) might be designed in Java and gateway might be in some other language, this is called distributed.No doubt this is an example of distributed application, but in current context you are going out of track.
    In core there will be only one ServletContextWhy and how? If different parts of an application developed using different languages (assuming technology) are deployed in different platforms using different run times, then how they can have same servlet context?
    Here is the explanation:
    Usually any web application will have only one servlet context. However, in case of large applications to handle high number of concurrent users, typically web application is deployed in clustered environment. It means, same web application is deployed (and cloned) in multiple application server nodes. Each application server node has its own JVM (run time). In this scenario each application server will have different servlet context. That is why in your book it is written - If web application is distributed, there is one servlet context per JVM.
    Thanks,
    Mrityunjoy

  • Difference between n-layer software architecture and MVVM design pattern?

    hello everyone,
    I am not clear with this concepts of Software architecture pattern and design pattern.
    I am developing an wpf application using MVVM. Now, my question is, does MVVM come under n-layered architecture? 
    or n-layer architecture and MVVM both are different? 
    Regards,
    Rakesh.N
    Rakesh murthy

    "
    Now my question is, i want to process the data which i get from database. where should i write that processing logic after getting the data from database? in model classes? or in view model classes?
    The model is however the data comes from wherever it comes from.
    If there is any processing after you get it then that would be in the viewmodel.
    The viewmodel adapts your data to the view.
    If it needs any adapting then the viewmodel does that, not the model.
    EG here
    protected async override void GetData()
    ThrobberVisible = Visibility.Visible;
    ObservableCollection<CustomerVM> _customers = new ObservableCollection<CustomerVM>();
    var customers = await (from c in db.Customers
    orderby c.CustomerName
    select c).ToListAsync();
    foreach (Customer cust in customers)
    _customers.Add(new CustomerVM { IsNew = false, TheEntity = cust });
    Customers = _customers;
    RaisePropertyChanged("Customers");
    ThrobberVisible = Visibility.Collapsed;
    That logic is in a viewmodel.
    in this context , in which layer the viewmodel and model classes are put under in n-tier architecture?
    They're in two of the n layers/tiers.
    Or they're in one.
    Depending on how someone decides to classify a layer or a tier.
    There is no absolute definition.
    Why would you care?
    Hope that helps.
    Technet articles: Uneventful MVVM;
    All my Technet Articles

  • Design Pattern for low cohesion & coupling

    Hi there!
    I�m about to make a applictation in swing and don�t have so much experince in this API. Normally I program for the web using J2EE tech like Servlets, JSP, custom tag libs and EJB�s. Therefore my biggest challenge for the moment is to find (/ find out) a good framework for coding in swing and minimize coupling between the participants.
    I have good knowledge about the MVC paradigm (in web programming) but finds it difficult to apply my knowledge in the Swing area. Do you have links or can recomend some litterature that handles my little but very frustrating problem?
    In advance thank�s
    Best regards
    Niclas Rothman

    Check out Java Design Patterns A Tutorial by James W. Cooper.
    I am sure there are many other publications out there, but I am not quite sure what your frustration is related to swing.
    Design patters are applicable in many aspects and are mostly language independent. In fact swing uses some of the design patters such at the command pattern in using Actions.
    Hope this helps
    Neelesh

  • Design pattern for a stand alone J2SE app

    What are the different options available for designing an interface type of stand alone application ? Can we use a scaled down version of MVC ? This is purely J2SE.
    Any info will be highly appreciated. Thanks in advance.

    Hope this is going to clear it .. Say for simple example I need to write an application to extract data out of a database and send it over to another application . That is going to be a standalone application probably very simple ( sometimes it could be complex ). What design pattern can be used in that context ? Remember this is not a web or GUI type of application. Hope this makes it more clear .... Thanks

Maybe you are looking for

  • Can't Even Open After Upgrading to iTunes 7.6!

    I upgraded two days ago to 7.6 (which, on a side note, when looking about "About iTunes" it still listed it as 7.5) and all of the sudden today it says "The file "iTunes Library" cannot be read because it was created with a newer version of iTunes."

  • Single-click on a Tree not cancelable

    Hi, I have a component that includes a Tree, and the Tree uses a custom TreeItemRenderer. The render extends the default one, and adds a small graphic next to each Tree node's label. If users click the graphic, I'd like to prevent the default single-

  • Export from itunes to SD card with files info(album, name, artist)

    Hello, Yesterday, i copy music from my computer to my SD card, because i want to listen music in my car. When i plg my SD card in my car, the music play but there are no information about the files that is playing like artiste, album, ....ert How can

  • Unable to verify my information

    I'm getting really frusterated with my orders constantly getting canceled with the reason "we were unable to verify your information".  Customer service has no clue why either.  I'd like to get to the bottom of it before I decide to spend my money el

  • ExecuteQueryForObject returned too many results jdbc error

    Hi All, I am getting the following error on running the tomcat 6.0 and I have Oracle 11g installed. 08 Dec 2010 16:23:41 ERROR [QUARTZ_Worker-5] org.quartz.core.JobRunShell - Job DCTM.DCTMServerPipe threw an unhandled Exception: org.springframework.j