Java written test question 002

Source: Internet
Author: User

Java written test question 002


1, in Struts2, how does action get the data that the user enters from the page, and in what way does it pass its own data to the view?

Answer:

1) You can obtain page form data directly from a data member that has the same name as the form element, which needs to exist in accordance with the naming convention set and get methods.

2) will put the processed data members into the value stack, to the page can use the STRUTS2 tag to take the value on it.


2. What are the common design patterns? Describes the Factory mode.

Answer: 23 Design Patterns in Java:

Factory (Factory mode), builder (build mode), Factory method (factory approach mode),

Prototype (original model mode), Singleton (singleton mode), facade (façade mode),

Adapter (adapter mode), Bridge (bridge mode), Composite (synthetic mode),

Decorator (decorative mode), Flyweight (enjoy meta mode), proxy (proxy mode),

Command (order mode), interpreter (interpreter mode), Visitor (visitor mode),

Iterator (iterative sub-mode), Mediator (mediator mode), Memento (Memo mode),

Observer (Viewer mode), State (status mode), strategy (policy mode),

Template method (pattern mode), Chain of responsibleity (responsibility chain mode)

Factory mode: Factory mode is a frequently used pattern, and classes implemented according to the factory pattern can generate an instance of a class in a set of classes based on the data provided, usually this group of classes have a common abstract parent class and implement the same method, but these methods have different operations for different data. First, you need to define a base class in which subclasses implement methods in the base class in different ways. Then you need to define a factory class where the factory class can generate different subclass instances based on the criteria. When an instance of a subclass is obtained, the developer can call a method in the base class without having to consider which instance of the subclass is returned.


3, what is the referential integrity of the database?

Answer: The referential integrity of a database refers to a relationship between a table and a table, usually by setting a primary key, a foreign key relationship between two tables, or by writing a two-table trigger. There are two tables corresponding to the referential integrity, in the process of inserting, updating and deleting data, the system will compare the modified table with another corresponding table to prevent the operation of some incorrect data.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Java written test question 002

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.