Write Excel file in JSP
Excel is one of the most common office software. In a Java application, a subset of the data generated in Excel format is an important means of seamlessly connecting with other systems. POI is a sub project of Apache
Config object represents the current JSP configuration information, but the JSP page usually does not need to be configured, so there is no configuration information. This object is less used on JSP pages, but is larger in the servlet because the
Today, I encountered a puzzling problem, that is, when using MyEclipse5.5 or 6.0, encountered the problem of resolving the El expression. After several hours of pondering finally found, to give everyone a share
The problem is the Web.xml statement
Color getrandcolor (int fc,int BC) {//random color for a given range
Random Random = new Random ();
if (fc>255) fc=255;
if (bc>255) bc=255;
int R=fc+random.nextint (BC-FC);
int G=fc+random.nextint (BC-FC);
int B=fc+random.nextint (BC-FC);
return new
The include instruction is introduced statically;
The include action is introduced dynamically.Static and dynamic include is independent of the content of the page.
Unlike the , Jsp:include can pass parameters to the included page.
However, if the
The most recent project encountered the problem of importing Excel files and saving the data in the file to a database, so I practiced the file upload.
One, page upload.jsp file
Import standard XML relational schema
Second, servlet file
Download excel in JSP
The open () function of JavaScript is used here, and the background uses JXL to dynamically generate an Excel file stream.
Front Desk: Window.opne ("downexcelaction");
Background:
public void Downexcelaction () throws
Format the string type in the JSP page to the specified type
The javabean corresponding to the database table is stored in string type. Because the JSP page is displayed in the form of "2017-07-3 00:00:00.0", I want to display it as "2017-07-3"
Session Object
The session object is an instance of the Javax.servlet.http.HttpSession class. Has the same behavior as the session object in the Java servlets.
The session object is used to track sessions between individual client requests.
Main
" pattern= "yyyy mm month dd Day hh dot mm minute ss seconds"/>
My application scenario:
Springmvc
1. Add before file
2. Output time
Reference:
http://learnmore.iteye.com/blog/1075664
JSP page format number or time
var cellcount = 0; function Addtr () {cellcount++;//getting the table var table = document.getElementById ("T1") to be manipulated;//dynamic add row var NewRow = Document.creat Eelement ("tr"); Dynamically Create column var newCell0 =
Struts2 can automatically convert the information format from the JSP foreground
Front JSP
name
date
ages
color 1
Color 2
size 1
size 2
Background action
Package action;
Import Java.util.Date;
Import
To implement a small function of the interface, the dropdown box reads the database information, displays it in the streets, clicks the selected value, and stores it in the database.
below look at the interface effect:
first, introduce the
In the development of JSP, iterations are the operations that are often used. For example, the results of a query are displayed on a line-by-row basis. In earlier JSPs, scriptlets was often used to implement iterative output of iterator or
1. Through the background query, find the corresponding number of pictures back to the foreground, as follows for the background returned images array
">
pro/table1/${ite} ">
2 Pass the parameters (picture path) of
The introduction of the jquery plugin in the JSP page is mainly the path problem introduced below, there are three ways:
1 . Create the JSP file directly under the Wetroot, put the jquery-1.7.js into a new folder: as shown:
The code to introduce
Commodity entity class design
Examples of commodities here are books. We will build it as a JavaBean class to improve the reuse of code and the maintainability of the program. Here's a little trick to quickly add a lot of setters and getter:
1: Use Jstl tags (can be used with custom tags)
First refer to Jstl label
Then use the foreach label
${user. Pid}
${user. Ploginname}
${user. Pusername}
${user. Pemail}
You can use and to
Comments in the JSP are divided into two types of comments:
• Explicit Annotations: There are comments in HTML ""
• Implicit annotations: You can use the "//", "/*....*/" in Java, and your own annotations in the JSP: " "What
is called explicit
Today with SPRINGBOOTJPA paged query, using the Entitymanager + query way to inquirePrivateList Getqueryresult (StringBuilder basejpql, mapParas, pageable pageable) { //Be sure to add the following policy.class, otherwise it will not
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