English 中文(简体)
服务模式2 误解
原标题:Servlet Model 2 misunderstanding

Good day. Having read about Model 2 architecture I got confused about some points. For example my controller servlet url-pattern is *.perform .

  1. How do I access the database and put the bean into the session if my jsp url does not correspond the servlet url-pattern?
  2. If I ve done the action, why do I use forward? The url remains the same actionName.perform
  3. How should be the app designed for the servlet to process every page and forward to the corresponding JSP without processing it again?
最佳回答
  1. The point of a front controller is that it intercepts all requests. You should never send a request to a JSP directly. Always to some *.perform URL. All your links and forms must poiunt to an *.perform URL.
  2. The forward gives the control, at server-side to another resource. Once the controller servlet has finished its job, it gives the control to the JSP, which generates the markup. This all happens at server-side, and the browser knows nothing about this. It s absolutely normal for the URL to remain the same.
  3. See 1. I don t understand what you mean by "without processing it again", though.
问题回答

暂无回答




相关问题
Choosing the right subclass to instantiate programmatically

Ok, the context is some serialization / deserialization code that will parse a byte stream into an object representation that s easier to work with (and vice-versa). Here s a simplified example ...

Design pattern for managing queues and stacks?

Is there a design pattern for managing a queue or a stack? For example, we are looking to manage a list of tasks. These tasks will be added to a group queue, users will then be able to pull off the ...

Organizing classes using the repository design pattern

I have started upgrading one of our internal software applications, written in ASP.NET Web Forms, and moving to ASP.NET MVC. I am trying to leverage the Repository design pattern for my classes, ...

Misuse of Observer Pattern?

I have a Car object which contains a latitude field and a longitude field. I use the observer pattern so that any time either of these fields change in my application, my car object is notified. I ...

How are Models (in MVC) and DAOs supposed to interact?

How are models and DAOs supposed to interact? I m in the process of putting together a simple login module and I m unsure where to put the "business logic." If I put the logic with the data in the ...

热门标签