Configuration-based custom simple struts (understand struts Principles)
Struts's configuration-based action jump method is very convenient to use. I also mimic struts's action to implement a simple operation defined by myself through the configuration file:
First, we can know that sturts intercepts the requests sent by the browser through the filter, and then operates in the filter to implement this process
Struts of WebMVC framework and struts of webmvc framework
In the previous blog, we introduced the main functions implemented by the WebMVC framework. It provides us with basic services, making it simple, flexible, and configurable for MVC-based development. This article mainly introduces the main content of Struts in the WebMVC framework.
Development Process
Show
1. Get the Struts jar package1.1 First download the struts package here at http://struts.apache.org/download.cgi#struts23163 (select Struts-2.3.16.3-all)1.2 Unzip to get directories such as the followingSome official examples of struts under the apps directoryDocs has long been the official API documentationLIB package
The Struts framework is an MVC framework based on the control layer. Therefore, the core of the Struts framework is control. In this graduation thesis, the teacher asked "What is control ". At that time, it sounds a bit thunderous. But afterwards, Struts is the control. My graduation thesis is implemented using the Struts
I believe that many cainiao who are new to struts will admire the broad and profound Struts framework. I am also a member of the large team, the first to use the struts built-in struts-config.xml data sources to connect to MySQL, there is always a problem: Error 404 action is not available ...... this is a problem. as
The configuration-based action jump mode of struts is particularly handy, and I also mimic struts ' action to implement a self-defined configuration file to configure the action for simple operations:First, it can be known that the sturts is a filter to intercept requests sent by the browser, and then operate in the filter to implement this process.So, we also define a filter in our program:public class Str
Error scenarios:
Condition 1: The struts2 core filter filters url-pattern to *. action.
Condition 2: The struts tag is used in the JSP page.
Condition 3: Access the JSP page directly through a urlError message:
The Struts dispatcher cannot be found. this is usually caused by using Struts tags without the associated filter.
nonsenseIn struts learning process, many tutorials are used strut-2.3.31, and now the latest is struts-2.5.10, after the upgrade STRUT2 skills will always be a bit of a change. Also thought that as long as the tutorial on the line, did not expect to keep the error, simply can not let people enjoy the fun of knocking code. struts-2.3.31 1. Introducing Jars
Asm-3.3
event handler for the HTTP request. once the request is met, the action returns the result back to the front controller, which then uses it to choose where to navigate next. the interaction is demonstrated in Figure 1.JSF uses the page controller pattern. although there is a single servlet every faces request goes through, the job of the servlet is to receive a faces page with components. it will then fire off events for each component and render the components using a render toolkit. the compo
In general, the action of struts1 is a singleton mode, so developers must ensure that it is thread-safe or synchronous, because in struts 1, each action has only one instance to process all requests.
However, the thread security issue is not taken into account when struts 1 is used for development. This is because we basically use local variables in actions, while "local variables are thread-safe. Each t
ArticleDirectory
Why use struts
Framework concepts
Struts concept and architecture
Why use struts
Based on the well-recognized MVC model, Struts is involved in both M, V, and C, but it mainly provides a good controller and a set of custom tag libraries, that is to say, it focuses on C and V, and has a seri
Struts-Brief Introduction to initial experience and configuration and struts
Learning version: struts-2.3.15.3
I,Import jar packageFor more information, see the official blank project.
II,Add configuration file: Web. xml struts. xmlWeb. xml:Struts. xml:Refer to official projects3. Create an Action classPublic class Hel
Java framework --- struts file upload and download, java framework --- strutsStruts2 File Upload
The Struts 2 Framework provides built-in support for processing file uploads using HTML form-based file uploads. When uploading a file, it is usually stored in a temporary directory. They should be processed by the Action class or moved to a permanent directory to ensure that data is not lost.
Note that a securi
Just beginning to learn struts, it realizes the application framework of MVC design pattern based on Java eeweb application by using javaservlet/jsp technology, and it is a classic product in MVC Classic design pattern.
To use struts, we'll learn how to configure struts and I'll show you how to configure the struts en
Because of the needs of the project, I need to configure the eclipse3.1+tomcat5.5+lomboz3.1+struts1.2 development environment. Thanks to the previous use of MyEclipse, all of which were previously integrated in the MyEclipse, I could automatically add struts support to the project without any brains. This time, with Lomboz, I need to download the struts plugin to install it separately. OK, I downloaded the
The Struts dispatcher cannot be found. This are usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the struts Dispatche R needed for this tag. -[Unknown Location]At Org.apache.struts2.views.jsp.TagUtils
The procedure is as follows:
Use Struts-blank to generate an empty struts project and introduce Struts-menu to the project:
Introduce the struts-menu2.3.jar file to the lib directory, introduce the struts-menu.tld to the WEB-INF directory, copy the images, scripts and styles
Struts controller components mainly complete the following tasks:
1. Accept user requests
2. Based on user requests, call appropriate model components to execute the corresponding business logic.
3. Obtain the business logic execution result.
4. select an appropriate view component based on the current status and business logic execution results and return it to the user.
Note: From the process above, we can see that the control components m
Introduction
Our daily life is well organized, and our daily life is quite regular. For example, when we get up, we have formed a "biological clock ".
In the factory, the workers work hard on the assembly line, and each link constitutes the entire workflow. to do one thing well, a complete workflow is required, beginning and end.
Struts has designed a standard workflow for the web layer of our project for us to follow. That is, if yo
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.