JSP, as the most important technology in Java Web Development, is generally used as a view technology, that is to show the page. Servlets are generally used as controllers (Controller) because they are not suitable for the presentation layer itself, and JavaBean is used as a model layer. This is the classic MVC model.The relationship between
code will not be executed after turningForward transmits parameters to the next page through JSP: Param// Response. sendredirect ("Logon. jsp? B = 1 ");// Response. sendredirect ("http://www.baidu.com ");
%>
Otherwise, the following error occurs:
The above code uploads Parameters
The parameters are retrieved as follows:
Parameters after the address is retrieved: $ {Param. Method} I passed it from inde
Button btn = New button ("test Guide package");Date d = new Date ();SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-mm-dd HH:mm:ss");Out.println (sdf.format (d)); Local variables---in JSP are valid within the underlying function _jspservice ()String str= "hunan City courtyard";Pagecontext.setattribute ("name", "page1111");Request.setattribute ("name", "req22222");Session.setattribute ("name", "session33333");Application.setattribute ("name", "app44
JspFilter Filters
The filters in Servlets and JSPs are Java classes, and they exist for the following purposes:
Intercept the backend resource when it is requested to access it
Manage responses returned to clients from the server
A number of commonly used filter types are listed below:
Authentication Filter
Data compression Filters
Enc
Two mechanisms to save the state of a user (Cookie Session)1.Cookie (Web server saves text messages on the client)1.1 Effects:1. Tracking for a specific object2. Save user's web browsing history and habits3. Simplified login operation1.2 Disadvantages:There is a security risk, easy to disclose user information1.3 Creating/Using Cookies1. Create a Cookie ObjectCookie cookie = new cookie (String key,object obj);2. Write Cookie ObjectResponse.addcookie (cookie);3. Read cookiescookie[] cookies = req
What is a JSP? To interpret the JSP's nine built-in objects, you must first understand what is a JSP? JSP full name Java Service pages Chinese: Java Server page. In fact, see JSP learned. NET can think of ASP, yes, the two really
String Realpath = Request.getrealpath ("web-inf/classes/com/properties/devicetype.properties");The above is the most correct way to get the path, so the properties can be placed under a COM package, or in the SRC directory.Properties props =NewProperties (); ArrayList Al=NewArrayList (); Try{InputStream in=NewBufferedinputstream (NewFileInputStream (Realpath)); Props.load (in); Enumeration en=Props.propertynames (); while(En.hasmoreelements ()) {String key=(String) en.nextelement
classes are used).
Finally, Doget and Dopost are called by the service method, and sometimes you may need to cover the service method directly, such as when the servlet handles get and post two kinds of requests.
3.2 Simple servlet for output plain text
The following is a simple servlet that outputs plain text.
3.2.1 Helloworld.java
Package Hall;
Import java.io.*;Import javax.servlet.*;Import javax.servlet.http.*;
public class HelloWorld extends HttpServlet {public void doget (HttpServletRequ
1. Include actions/ include directivesInclude directive syntax: Include action syntax: The difference between include actions and include directives:
Include directives
Include action
Syntax format
Time to take effect
During page conversion
Request Period
Include content
The actual contents of the file
Output of the page
Convert to Servlet
The main page and the Include pa
JSP TechnologyMastering: JSP syntax + EL + JSTLWhy is Sun launching JSP technology?Servlet generated Web page is more complex, itself does not support HTML syntax, HTML code needs to be output stream through response, JSP support HTML syntax, generate HTML convenience.What is the difference between
Java Web Foundation Summary VIII--jsp FoundationA. What is a JSP? JSP is the abbreviation for Java serverpages, which, like the servlet, is the technology used to develop dynamic Web resources. It is cumbersome to cobble together the output HTML code in a servlet. The bigges
For many years do not engage in Java Web Development, these days is the national Day holiday, relaxation is also interested in looking back to Java Web Development Technology Foundation.As we all know, servlet is an important foundation of Java Web development, but because of the relatively cumbersome servlet development, the code is large and difficult to mainta
();
catch (Exception e) {
strtemp = "0";
}
if (strtemp = = null) strtemp = "0";
m = new Integer (strtemp). Intvalue ();
Xx[i][0]=m;
Totalnum = m;
}
if (totalnum==0) totalnum=1;
for (i=0;iXX[I][1] = Xx[i][0]/totalnum;
}
return xx;
}
}
The establishment of Question.txt and count.txt documents under the INDEX.JSP directory are used to save the cast
The question of the ticket and the number of votes, after the user has voted, modifies the value of the count.txt.
In order to thank the original a
, database, etc.) before you learn Android. And if you want to learn solid and have a good job, the following basic knowledge needs to have all: basic knowledge of the computer (operating system, computer network, data structure, database, design patterns, etc.), C + +, Java, Android, Linux.So, considering the time factor, beginners like me can only learn other knowledge while learning Android. I learned where, my blog will write where , but also hope
-code, which does not check for changes in the included files, and is suitable for including static pages.Like what:%@file="included.htm"%>the difference between the include directive and the include actionThe include directive is a compile-time syntax. That is, at compile time, the content of the target file pointed to by the instruction is copied to the location of the instruction. The replacement instruction finally forms a file that only has one file at run time.The include action is the run
JSP Introduction
The JSP full name is Java Server Pages, and the servlet is a technology defined by sun that is used to develop dynamic Web resources, which solves the problem of complex and difficult to maintain servlet output stream layout. JSP is a perfect blend of HTML template elements and
JS Building Dynamic Web site with JSP Sun-yi Cuckoo
First, what is JSP JSP (JavaServer Pages) is initiated by the Sun Microsystems Company, a number of companies involved in the establishment of a dynamic Web page technology standards, its Web site for the http://www.javasoft.com/products/jsp. Adding
Java Study Notes-JSP 1 (32), java Study Notes
Servlet as a dynamic web page development technology is too unreliable. In particular, when writing a page, you need to specify the template tag of the page and process a lot of business logic. Therefore, it is complicated.
Think: Why is it so hard for Servlet to write a page?
The main reason is that Servlet actually
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.