Implement file download in JSP
A
The easiest way is to do hyperlinks on the Web page, such as: click Download .
However, the directory resources on the server will be exposed directly to the end user, which will bring some unsafe factors to the
Design page, head, navigation bar, foot, all the pages are basically consistent, do not repeat the design on each page, and the use of the general part of the stored as one of the JSP page, using the page only need to refer to the pattern
There are 2
The following two JSP files can be a good illustration of the problem
Brother parameter file:
String errmsg= "Chinese delivered";
Response.sendredirect ("test1.jsp?errmsg=" +java.net.urlencoder.encode (errmsg));
%>
Receive parameter file
String
Today encountered a time format conversion of Dongdong, depressed half of the afternoon, but fortunately finally finished.
Originally wanted to take YYYY-MM-DD format, but how the whole is Greenwich mean.
Our project is to use the Struts framework,
Way1: Embed Java code inside
The JSP page embeds the following code:
Test Cases:
Way2: via El expression
An explanation of the syntax for El expressions see: http://blog.csdn.net/qwerasdf123/article/details/4189889
Add the following code
The concept of JSP and servlet is not clear to JSP beginners, the following summarizes some personal views:
(1). In simple terms, JSP is HTML with Java code, and the servlet is Java code containing HTML;
(2). JSP is eventually interpreted as a
One, Page object
The Page object represents the JSP itself, or rather, it represents the JSP-translated servlet, which can invoke the method defined by the Servlet class.
Two, config object
The Config object holds some of the servlet's initial data
Look at the contents of the form:
ABCD
--------------------------------------------------------------------------------------------------------------- ---
The main code for SHOW.JSP is:
Your choice is: ${param.select}
-------------------------------
To learn the Java-ee so far, the project has only done two, midway encountered some problems, the most likely to be a number of Chinese display and insert the database of Chinese problems. The summary is as follows:
(a) Define the Chinese conversion
This format control and editing coordination FCKeditor is used, is perfect, fckeditor use in my other posts have a simple introduction.
When you read data from a textarea, and then read the data from the database, the simplest way to control how it
1. Home (fill in the name) (optional, form post to time.jsp can):
Slightly
2. Judging time forward to different pages:
TIME.JSP:
Document:indexCreated on:2009-10-3, 15:48:00Author:lucifer--%>"Http://www.w3.org/TR/html4/loose.dtd" >jsp pageDate dat =
In X:\Program files\myeclipse 6.0\myeclipse\eclipse\plugins\com.genuitec.eclipse.wizards_6.0.1.zmyeclipse601200710 \templates\jsp directory to find JSP.VTL, duplicate a copy, renamed to JSP2.VTL, and then change the contents of the inside to their
OUT.PRINTLN () output to the client.
In Out.println (), out is an instance of response, which is output by response as an object, outputting content to the client. If you use SYSTEM.OUT.PRINTLN () in a JSP page, only one space is printed on the
This article describes the filter to set the problem of character encoding, by writing a servlet and configuration web.xml to achieveThis eliminates the need for the code of Pride characters in each JSP page, and the value needs to be encoded in the
Dtree tree-shaped structure, very convenient, very suitable.
Download Dtree.zip Package Please go to the address below to download
http://jinchun1223.javaeye.com/admin/blogs/421817
String path = Request.getcontextpath ();String basepath =
The effect of this example is that the selected value will pop up when any one of the radio boxes is chosen, and then jump to others.do;When you do not select any of the radio boxes only pop-up prompts, do not jump, but stay on this page.
Left
What we're talking about here is the modification of the absolute path. If you need the relative path, you just need to change the value of UserFiles/.
FCKeditor JSP support in general, to configure a large pile, online are similar articles, it is
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