JSP Dynamic Web page production must know the basics

Source: Internet
Author: User
Tags format object sql variables variable tostring java web access
js| Dynamic | Web page A common mistake is to take the JSP as a simplified Java. It's not, (in fact, JSP is a simplified servlets.) Programmers usually try to learn JSP directly without the support skills they need to learn. JSP is a cohesive technology that successfully connects to other technologies that you need to understand. If you already know Java, HTML, and JavaScript, this means that the JSP will indeed be simple.

Need to be a successful JSP programmer can refer to this timeline. Please note the following:

* Ignore the steps you already know.
* The time of training is only to represent enough basic time to learn, so as to move to the next step.

1, build and understand your Web Server.
Because Apache is free and works on most platforms, Apache is recommended for training purposes.
Installation time: 2 days.


2, to ensure that you understand html/xhtml.
You will need to understand the HTML basics, especially the use of the table in HTML layout. XHTML will soon replace HTML, and learning the basics of XHTML is a good idea. Many programmers learn HTML through the HTML IDE (integrated development environment). Because most HTML ides produce confusing HTML syntax, it is necessary to take the time to learn to write HTML manually. Because you will be using JSP and HTML mixed programming, it is important to be proficient in HTML syntax. So, you have to be able to write HTML fluently.
Training time: 2 ~ 4 weeks.


3, start learning Java.
It's important to start learning Java 1.3 to understand the Java basics. Don't worry about learning about swing or Java graphics, because you don't use these features in JSPs. Focus on the details of Java work, learn Java logic, and also spend time on Java beans. Learning applets is good, but like swing, most applications of JSP will not use small programs.
Training time: 3 ~ 6 weeks.


3. Learn JavaScript
Learn how to validate the input form elements in HTML with JavaScript. Also learn how JavaScript can modify the elements of a form within an HTML page. Finally, you will be able to trigger JavaScript Function from events within an HTML page.
Training time: one ~ 2 weeks.


4. Learn and understand the finer details of your Web server.
It is important to be familiar with the characteristics of the Web server.
Training time: 2 days.


5, build your JSP Server
I recommend starting with Tomcat. It can run the JSP program very well. When you cannot use Tomcat in production, learn as much knowledge as possible to facilitate better running of the program. In addition, many JSP programmers use Tomcat. So when you encounter a problem, you will find help easily.
Installation time: one ~ 2 days.


6, start learning JSP.
Basic JSP Learning steps 1 through 6 can be done, and then use the JSP object and script write JSP program to contact. Another aspect of learning about JSP is learning how to create a distributed application.
Training time: 4 ~ 6 weeks.


7, learn more JSP server.
There is no more JSP server, of course, you can run the JSP program. However, many JSP servers are characterized by their own special features that allow you to better understand your JSP project. It is necessary to learn more about JSP server How to handle JSP programs. You can also optimize your JSP application and make it run faster without any problems.
Training time: 2 ~ 7 days.


8, learn JDBC.
JSP Most applications will use the database, JDBC is used for database connection. Often overlooked is the fact that each JDBC Driver supports something quite different. It is important to understand and familiarize yourself with the details of the JDBC driver used in JSP engineering.
(sometimes this part of the study is included in the previous Java or JSP learning.) )
Training time: 1~ 2 weeks.

By now, you have become a proficient JSP programmer. There is still a lot to learn, and you can consider expanding your knowledge like DHTML, XML, java certificates, JSP Tag libraries or servlets, to see what type of Web site you want to build and decide.

These training is the core of JSP. You don't have to learn all the above, depending on what tasks you assign to the project and what knowledge you already have. But this is my timetable for successfully training programmers. The key unit is time. On average, 5 months can actually train a person (from start to finish) to become familiar with the JSP programmer. 5 months seems like a long time, but there is much more to be learned by becoming a senior web programmer.

Here is a summary

The techniques that are essential to any web developer are the following.

The technology for developing Web applications has become more mature and more complex. Now, building a Web application requires more than just simple HTML technology. Database access, scripting language, and management are all technologies that a web programmer needs to have. Let's see what skills are needed to become a popular web developer on the market.

Since CERN (European Particle Physics Institute), near Geneva, the High Energy Physics Research Center, published the Web in 1991, Web technology has been from static content and common Gateway Interface (CGI) developed into servlet technology and JavaServer pages. However, in this more competitive society, a web programmer needs more knowledge. For example, if you mention in an interview that you are familiar with XML and have some experience with jndi (these two techniques seem to have no close relationship to Web programming at first glance), you will give your future boss a deeper impression. Imagine that you already know the Java programming language and object-oriented programming, and there are two sets of technologies that are needed for a web developer's day-to-day work. The first group includes the technologies that each Web programmer must have. The second group contains the techniques that you should master in order to be a senior programmer.

Basic Skills
If you want to call yourself a Web developer, the following are the technologies you must have.

HTML (hypertext Markup Language)
HTML is almost the language of all content displayed on the browser. No wonder HTML is like a Web programmer's survival instinct. If you still need to find <tr> or <b&gt in your HTML, then you really need to improve your HTML technology. The current version of HTML is 4.01, and you can learn more about it from http://www.w3.org/TR/1999/REC-html401-19991224/.

Servlets and JSP
Java servlet Technology is the primary technology for developing Java Web applications. It was developed by Sun Microsystems in 1996 and the current version is 2.3, but people are preparing for version 2.4.

JSP is the extension of the servlet technology, now the version is 1.2 (2.0 version will soon be set up). Some people think that JSP is the substitution of servlets, but the reality is not the case. Servlets and JSPs are used together for complex web applications.

A good starting point for Web programming in Java is learning about servlet technology. Even if you plan to use only JSP pages in your Web application, you still need to learn the servlet technology. In more complex Web applications, JSP pages are used only for display, while JavaBeans and custom tag libraries are used to embed business logic. That is: You must also be proficient in JavaBeans and custom tag libraries.


Javascript
JavaScript is the scripting language that runs in all the major browsers. You use JavaScript for client programming. The most important task in client programming is to confirm user input. The benefit of using client input validation is to reduce server workload and increase response time. In addition, JavaScript can be used for redirection (redirection), cookie processing, controlling applets, creating a navigation tree, opening a new instance of a browser, and so on.

SQL (strutured Query Language) and JDBC (Java Database connectivity)
Today, most Web applications include accessing data in a relational database. As a web programmer, you need to know how to store, get, and manipulate data in a database. Sometimes, you also need to design databases, build tables and other structures in your database. SQL is the language used to manipulate the data in the database. You usually need to write SQL statements (often dynamic), pass them to the database server, and get the returned data (if any).

Using the Java language, you need to use JDBC to help the Web application and the database server communicate. JDBC has two parts: the JDBC Core API (Application programming Interface) and the JDBC Optional Package API. The first group is used to perform basic data operations, such as creating a connection or reading, updating, and deleting records from a table. The second group provides more advanced database connectivity features, such as connection pooling, transactions, and rowset. The current version of JDBC is 3.0,API contained in J2SE v. 1.4.

WEB container Management and application deployment
Your servlets and JSP pages run in an engine called servlet/jsp container or Web container. You need to know at least how to deploy your Web resources for testing and production operations. For example, if you use Tomcat, one of the things you need to know is how to map the application in the configuration file (Server.xml) so that Tomcat knows how to call your JSP page. In addition, you need to know where to save your library and how to create an application deployment descriptor.

XML (extensible Markup Language)
XML is a successful Up-and-comer in the computer field. Developed by the World Wide Web Consortium in the 1996, XML is now a broad, recognized standard for data interchange and extensible structure. XML plays an important role in Java Web development. For example, the deployment descriptor for each application is in XML format. And, if you're developing Web servies, you'll use soap (simple Object Access Protocol), which is primarily based on HTTP and XML.

In addition, in Web applications, XML can also be used to store hierarchical data.

Model 2 Structure
This technology is the most advanced in this category. This structure is recommended for building rather complex Java Web applications. Model 2 structure is based on the Model-view-controller design paradigm.

Advanced Technology
Here are some techniques you can use to differentiate yourself from beginners.

JSTL (JSP Standard Tag libraries), Jakarta Taglibs project, and other libraries
To speed up application development, you should always reuse code. Simply put, code reuse is that if someone has written code to perform some function, you'd better use that code instead of writing it yourself. Therefore, JSP allows you to use custom tags. You can use a few libraries, most popular is the Apache Jakarta taglibs project in the library. You can download this package from http://jakarta.apache.org/taglibs/index.html, and you can use whatever is available in this package before you start creating new classes.

Jstl has recently become a standard. Other tag libraries can be obtained free of charge or in a commercial manner.

The Apache Struts Project
Struts is an Apache-sponsored public resource project that provides a framework for building Model 2 Java Web applications. Struts provides its own controller components for the MVC structure, uses EJBS, JDBC, and Jndi for model, and uses JSP and other technologies for view. You can find more detailed information about this project from its website: http://jakarta.apache.org/struts/index.html.

XHTML (extensible hypertext Markup Language)
XHTML is a technology that strives to combine HTML and XML. You can think of XHTML as the next generation of HTML. Its current version is 1.0 (the second edition was released on August 1, 2002), and XHTML is not as popular as HTML, but it will play a more important role in the future. According to Molly Holzschlag, a web design expert, the main reason for moving companies to XHTML is the U.S. Law on Public Access (accessibility). For more information on XHTML, refer to the Holzschlag interview.

DHTML (Dynamic HTML)
DHTML allows people to have more interaction on your site. For example, using DHTML, when a user moves the mouse over a link, you can easily create and display submenus. The biggest challenge in using DHTML is to create a Cross-browser Web page. Indeed, in theory, page design should be handled by the artist, where dynamic HTML is generated by using a tool. However, a web programmer is usually responsible for integrating all the parts, and if the generated code in the page is corrupted, you need to understand DHTML to fix it.

Applet programming
Applets was once important in providing interactivity, especially before the advent of DHTML. Now, applets's role has been cut, and more programmers are not applets. Microsoft's decision not to provide default support for applets in its new browser greatly reduces the role of applets in Web applications. However, applets did not die. For some tasks, such as displaying news headlines, applets is still irreplaceable, and applets does not create a cross browser compatibility problem with another headache.

HTTP protocol
Java Web programmers typically use protocols that are higher than HTTP, such as using servlet and JSP APIs. These APIs hide the complexity of the HTTP protocol. As a result, you can still build important applications without having to know much about the HTTP protocol. You need more knowledge of the protocol only if you need to process raw data, such as uploading or transferring files as attachments.

EJB (Enterprise JavaBeans)
EJB is part of Java EE, and EJB is important when scalability and power are the main requirements of your Web application. There are three types of EJBs in the current specification (EJB 2.0): Session EJBs, Entity (entity) EJBs, and message-driven driven. The new specification, version 2.1, is in the process of being designed.

JNDI (Java naming and Directory Interface)
Jndi is important when you are developing enterprise beans, because access to an EJB is done through the Jndi naming service. Use a naming service to find an object that is related to a particular name. In the EJB context, a naming service finds an enterprise bean, given the name of the bean. Therefore, understanding Jndi is critical in developing an EJB application. In addition, JDBC can use Jndi to access a relational database.

Other tools
Learn where you can find specific support tools that usually contribute to your career development. For example, if you happen to be assigned to work on benchmarks, you'll be happy if you know you can download jmeter from Apache's Jakarta project. In addition, if you need to send the output in PDF format, it is recommended that you use the Java-pdf library which is free to download from http://www.lowagie.com/iText/. Internet technology is wide and fast. That is to say, as a web programmer, you should always be mindful of what new technologies are emerging in the industry and what is happening. In this respect, there is no greater resource than the Internet itself.


-------------------------------------------------------------
The concept of client and server-side (server-based)
Server: Broadly speaking, servers are divided into two types (hardware servers, software servers)
Hardware server: Refers to the relative PC, the performance and stability of the better, the use of special hardware computer.
Software server: Colloquially, refers to the installation of some kind of service software, and can provide the corresponding service machine, we call it the server.
There are many kinds of service software, which are common:
WWW service software: PWS, IIS, APACHE
Java EE Middleware Application server: WebSphere, Silverstream
JSP engine (Weak WWW service function): Tomcat,resin,weblogic,jrun
SMTP, Pop3:iis's Smtp,exchange,lotus Domino
Ftp:iis with
Client: Relative to the server, is to enjoy a certain kind of service side, is called the client. However, to enjoy a service you must also install the appropriate software, such as (Ie/netscape, Outlook/foxmail, CuteFTP)
Data Type
The basic types have the following four kinds:
int length data types are: Byte (8bits), short (16bits), int (32bits), Long (64bits)
Float length data types are: Single precision (32bits float), double precision (64bits double)
Boolean-type variables have the values: Ture, False
Char data types are: Unicode characters, 16-bit
Corresponding class type: Integer, Float, Boolean, Character, Double, short, Byte, Long
Conversion principles:
Converts byte, short, int, long, float, double, char from low precision to high precision
Note: Two char operations, automatically converted to int, when char and other types of operations, will be automatically converted to int type, and then do other types of automatic conversion
1, the base type converts to the class type
Forward Conversion:
To create a new class-type variable by using the class wrapper
Integer a= new Integer (2);
Reverse Conversion:
Converting by class Wrapper
int B=a.intvalue ();
2, class type to string conversion
Forward Conversion:
Because each class is a subclass of the object class, and all object classes have a ToString () function, you can convert it by using the ToString () function.
Reverse Conversion:
To create a new class-type variable from the class wrapper
Eg1:int i=integer.valueof ("123"). Intvalue ()
Description: The above example converts a string into an integer object, and then calls the object's Intvalue () method to return its corresponding int value.
Eg2:float f=float.valueof ("123"). Floatvalue ()
Description: The above example converts a string into a float object, and then calls the object's Floatvalue () method to return its float value.
Eg3:boolean b=boolean.valueof ("123"). Booleanvalue ()
Description: The above example converts a string into a Boolean object, and then calls the object's Booleanvalue () method to return its corresponding Boolean value.
Eg4:double d=double.valueof ("123"). Doublevalue ()
Description: The above example converts a string into a double, and then calls the object's Doublevalue () method to return its double value.
Eg5:long l=long.valueof ("123"). Longvalue ()
Description: The above example converts a string to a long object, and then calls the object's Longvalue () method to return its long value.
Eg6:char=character.valueof ("123"). Charvalue ()
Description: The above example converts a string into a character object, and then calls the object's Charvalue () method to return its corresponding char value.
3, conversion of basic type to string
Forward Conversion:
such as: int a=12;
String b;
B=a+ "";
Reverse Conversion:
Through the class wrapper
Eg1:int I=integer.parseint ("123")
Note: This method can only be applied to strings converted to integer variables
Eg2:float f=float.valueof ("123"). Floatvalue ()
Description: The above example converts a string into a float object, and then calls the object's Floatvalue () method to return its float value.
Eg3:boolean b=boolean.valueof ("123"). Booleanvalue ()
Description: The above example converts a string into a Boolean object, and then calls the object's Booleanvalue () method to return its corresponding Boolean value.
Eg4:double d=double.valueof ("123"). Doublevalue ()
Description: The above example converts a string into a double, and then calls the object's Doublevalue () method to return its double value.
Eg5:long l=long.valueof ("123"). Longvalue ()
Description: The above example converts a string to a long object, and then calls the object's Longvalue () method to return its long value.
Eg6:char=character.valueof ("123"). Charvalue ()
Description: The above example converts a string into a character object, and then calls the object's Charvalue () method to return its corresponding char value.

Related Article

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.