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
In the process of developing website applications, using cookies to record user information is a common method, and the use of cookies is also very simple.1. Cookie is added to the Set-Cookie response header Through the addCookie method of
Jsp jtds connection to SQLServer 2000
How does jsp connect to the SQL server 2000 database? In addition to jdbc, there is also a jtds connection method.
Connect to the SQL Server database through JTDS JDBC Driver, the Driver file name is jtds-1
1. Jsp labels are the logical business functions provided, so you can avoid writing java code in jsp. The main labels are
Other jsp files can be included in double quotation marks.
jump to the tab jump page. You can directly add
You can
Currently, many enterprises use frameworks for project development, and the same is true in Shanghai. Most enterprises use ssh and ssi, which is suitable for development by many people and easy to maintain. The following is the fastest way to
1. directive elements: controls the generated servlet structure.
JSP commands are used in the "conversion phase" to provide information about the entire JSP page, affecting the overall structure of the Servlet generated by the JSP page.
The
Because java web development has not been completed for a long time, I wrote this article to briefly review the knowledge of jsp/java web.
1. server. xml in tomcat, indicates a web application Context path;DocBase: Specifies the name of the
Watching String address = (String) request. getAttribute ("address ");%>CLASSID = "CLSID: 6BF52A52-394A-11d3-B153-00C04F79FAA6">Value = "file/123.mp3"/>From the day of that year and month
LAMP: A golden combination of Linux + Apache + MySql + PHP1. tomcat preliminarySet the environment variable JAVA_HOME: JDK directory -- otherwise, startup. bat cannot be started.ModifyConnectionTimeout = "20000"RedirectPort = "8443" type = "regxph"
Servlet Chinese garbled charactersInsert the following word into Servlet doPost and the jsp that calls Servlet.[Html]Request. setCharacterEncoding ("UTF-8 ");Response. setCharacterEncoding ("UTF-8 ");
[Html]Keep the code on both sides consistent.
To query a database on the JSP page, you can connect to and query the java code section of the database and the html page code section. This page is implemented in three steps
1. Write the database connection code.
2. Write the code used to display
The first file below is pageSupport mainly processing various parameters.
Package net. spring. service;Import java. util. List;Public class pageSupport {Int pagesize = 2; // number of entries per pageInt totalCount; // The total number of items.Int
Deploy the codes and the css and js contained in the attachment to the project to run.
untitled document
label 1 content 1 label 2 content 2
Decompress the attachment and put it under webroot ..
1. Session Save User NameWe often encounter this situation when surfing the Internet:Automatically log on after successful registrationAfter logging on, remember the user status and display the user name on multiple pages.
In fact, these effects use
The interceptor in struts2 can intercept actions, but cannot intercept page requests. However, some pages can be accessed only after they have the permission, but cannot be accessed directly. One solution is to use the Filter
1. To create a Filter
In struts1, how does one redirect a request to a specified Action rather than execute? The Code is as follows: jsp code: User name: password: struts-config.xml code: java code: public class LoginAction extends DispatchAction
Disable cache settings on jsp pages1. The client cache should include the following content in :Or2. Disable caching on the dynamic web page of the server. Add a script similar to the following:Response. setHeader ("Pragma", "No-cache ");Response.
By accident, I learned a piece of code when I first learned Java many years ago. Maybe I can't write it now. If the technology is so popular, it will move back if it is not in progress. It's still good to be young, with clear ideas and ample energy.
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