Send email in JSP
We can send mail through any JSP engine (such as JSWDK) that supports the SUN.NET.SMTP package in the Sun specification.
(Warning: Use the built-in internal Sun specification package, which will affect the portability of your JSP
JSP Other related resources:
Servlets and JavaServer Pages (JSP) 1.0:a Tutorial
http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/
JavaServer pagestm:a Developer ' s
The last component associated with the JSP syntax is called an internal object. Within the JSP small instruction file, you can access these internal objects to interact with the servlet environment that performs JSP Web pages. Many of the access to
1. You can use:
Response.sendredirect ("http://www.foo.com/path/error.html");
2. You can manually modify the Location property of the HTTP header as follows:
Response.setstatus (httpservletresponse.sc_moved_
In JSP, Chinese garbled often makes people utterly confused.
For the common countermeasures of Chinese processing, the following 2 kinds are often visible on the Internet:
Contenttype= "text/html;charset=gb2312"%>
Or:
String hi=
Vishal_donth gave this response on 10/18/2000:
These are are imported from
Java Mail
The Java Mail PAckage either be dowloaded
seperately
Or else is Available in the j2sdkee1.2
(Java Enterprise Edition)
Import javax.mail.*;
Import
In the previous tutorial, we have used the java.util.Date. One can ask: Why not use import java.util.*? In fact, the import statement can also be used in JSPs, but its syntax is somewhat different from that of normal Java. An example is given below:
Today, in the project encountered a problem, two JS page to share a JS object. JS global variables and static variables are not good, other hard to force the small farmers do not have to insist. And LZ do not want to use cookies to store, one is
Now the JSP you are writing to becomes the definition of a class. All the scriptlets you write will be placed into one of the methods of this class. Again, you can add variables and methods to declare them in this class. Of course, you can also use
1, do the message board, encountered in the database for the loop, to determine the click of which button is the case?
2, click into the JS method
Copy Code code as follows:
Copy Code code as follows:
"')%>
1.request.getrequestdispatcher () is a request forwarding, front and back page sharing a request;Response.sendredirect () is redirected, and the front and back pages are not a request.
2.requestdispatcher.forward () is running on the server
If you have used VB to write the components of the file upload, then the Java file Upload JavaBean is very easy.
The following example is just a simple version
Package yuanyifileup;
Import java.io.*;
Import java.util.*;
Import
JSP gets the session value problem from the action there are several ways:
For example, I have a session in action ("SessionID", "Sessionvalue")
First, use the struts tag to obtain:
Second, session is also one of the built-in objects, you can
Words not much to say, directly on the example
Insert
Copy Code code as follows:
String sql= "INSERT into allorder values (' + orderid +" ', ' + BookID + "', ' + Amount +" ', ' "+ Username +") ";
int result=stmt.executeupdate (SQL);
1, what is static import?
Static import refers to the embedding of an external file in the current JSP file, parsing the JSP statement of the page, and including other compilation instructions on the target page.The static import directives for
Look at the time, see the book on the use of cookies to save information, see the book cited examples are English key value pairs, I think Chinese is not the same? A try is not the same. Nonsense not much to say, directly on the code:
For example,
When a URL comes along, such as: Http://localhost:8080/pro/demo/hello.jsp?name=john, on the hello.jsp page, we can get the value of name:
Copy Code code as follows:
String path = Request.getcontextpath ();
String basepath =
1. JSP instruction
Category: 1). Page 2). Include 3). Taglib
Syntax:
2. Page compilation Instructions:
• Function: You can set the page properties of a JSP using page compilation directives. Usually at the top of a JSP page, you can have
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.