Call MethodIn servlet, a 4-digit 1000-9999 is randomly generated.Then write the number to the session.Output an image containing the four numbersThe number andCompare the values in the session.Package com. schoolwx. util;Import java. io .*;Import
When using POST:// If the transfer parameter is directly assigned, garbled characters are generated!Http_request.open ("POST", url, true );Http_request.setRequestHeader ('content-type', 'application/x-www-form-urlencoded; charset = gb2312
Servlet Page code: @ each request generates a token (usually a timestamp), which is stored in the session and submitted with hidden, in the servlet, check whether the received tokens are consistent with those in the session to determine whether
The command must be used to format tags on the JSP page, A tag can store variables in a JSP range or a JavaBean attribute. Five formats are available: 1, // specify the variable name and value. 2, Save the value to the variable whose range is
Attribute description Path Action the relative Path Name of the Action class is associated with the ActionFormbean Name Type of this operation connected to the full Name of this mapped Action class (can have package Name) Scope ActionFormbean Scope (
A: judge the string: 1. Judge A single character: in this way, the username value is retrieved from the session and determined whether it is c. However, this is incorrect, it cannot be determined at all. It should be changed to the following: in
Page: transfer business card cash centralized payment www.2cto.com jquery: $ (document ). ready (function () {var yms_name =_name ("# selectjob> option"); var nameselect =$ ("# selectstate "). val (); for (var I = 0; I
Annotations for earlier versions:
The struts2-core-2.0.11.jar is used to start using annotations
At this time, the filter is org. apache. struts2.dispatcher. FilterDispatcher.
You can specify the action's parent package actionPackages in web.
Page componentization can bring many advantages. When multiple pages reference the same page, we only need to maintain the code of one page, greatly reducing the workload of developers.
Assume that the root directory of the website is jsfApp and the
Note: When learning to use the selvert filter to process Chinese garbled characters, UTF-8 is used to process Chinese garbled Characters During filter configuration initialization, while gbk is used in the submitted jsp page. Although the two types
Package action; Import com. opensymphony. xwork2.ActionSupport; Public class FirstAction extends ActionSupport{/****/Private static final long serialVersionUID = 1L;Private int operand1;Private int operand2; Public String execute () throws Exception{
When I made a project today, garbled characters appeared. I submitted the form to the background to receive the garbled data and checked the configuration items.
Solution:
1. Configure In struts. xml
Result: The error is still garbled. It seems
JSP custom tag. The part between the start and end tags of a custom tag is the Body ).
Tag handler class: defines the behavior of a tag and calls and executes it when the JSP Engine encounters a custom tag.
Tag library Descriptor (TLD) file:
Some struts2 labels were used in the previous demo, using struts2.2.1.1.
Struts2 labels are often used with OGNL (Graphic object Navigation language. The following is a summary:
1. Required jar packages for struts2 labelsThe struts2 tag can be
Today, I reviewed the JSP script elements and comments, and wrote the case. After debugging, the overall summary is as follows,
1. JSP statement:
The variable in the declarative statement is a global variable. When multiple users execute this JSP
Because the application object is used to complete the accumulative functions, when (1) the current Wen application is redeployed (2) the Tomcat server restarts the counter and starts counting again. The jsp code is as follows:
Insert title
Struts. xml configuration:
Class = "com. rd. common. util. MyInterceptor">
/show_login.jsp
Note: After the interceptor in struts. xml is configured, if you want to use the interceptor, you can let that folder inherit the
1. cocould not load class Interceptor2/Myinterceptor. Perhaps it exists but certain dependencies are not available? -Interceptor
Solution: log4j. jar is missing.
2. When your action processing class inherits ActionSupport
Public class Reg extends
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service