Category:JSP

  • Basic syntax of JSP learning notes

    Time:2020-6-4

    JSP page element composition JSP page components are: instructions, comments, static content, expressions, small scripts, declarations. JSP instruction Page instruction: usually at the top of a JSP page, the same page can have multiple page instructions Include instruction: embed an external file into the current JSP file, and parse the JSP statement in the page […]

  • How to get the real IP address of client by JSP

    Time:2020-6-3

    In JSP, the method to obtain the client IP is: request.getRemoteAddr ()。 This method is effective in most cases, but it can’t get the real IP address of the client through Apache, squid and other reverse proxy software. If the reverse agent software is used, the http://192.168.1.110 The URL reverse proxy for: 3306 / http://www.8888.com/ […]

  • How to make JSP random verification picture

    Time:2020-6-2

    Xiaobian arranges an article about imitating Tencent random verification pictures. Now go straight to the code! A Java class and a JSP page. Java class code: The following is a JSP imitating Tencent random verification picture reference fragment: package icewee.image; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.geom.Line2D; import java.awt.image.BufferedImage; import […]

  • A method to solve the missing format of JSP saved to database

    Time:2020-5-31

    What is the storage of articles on the website? There are many ways to use Oracle to store CLOB and Java to operate CLOB on the Internet. However, it is found that the format displayed on the web page after reading is totally different from that when entering, and some paragraphs no longer exist. Because […]

  • Four methods of JSP file download function

    Time:2020-5-30

    For the website, the website itself often needs to provide some resources or materials for downloading. When it comes to downloading, the most original method is to provide the downloaded website on the webpage. Today, there are several other ways to download files. Which one is better depends on your own needs. 1. The most […]

  • Summary of common methods of JSP + MySQL database operation

    Time:2020-5-29

    This paper describes the common methods of JSP + MySQL database operation. Share with you for your reference. The details are as follows: 1. View: <%@ page contentType=”text/html;charset=GB2312″ %> <%@ page import=”java.sql.*” %> <HTML><style type=”text/css”> <!– body { background-color: #99CCFF; } –> </style> <BODY> <font color=”#FFFFFF”> <center> <% Connection con; Class.forName(“com.mysql.jdbc.Driver”); con = DriverManager.getConnection(“jdbc:mysql://localhost:3306/student”,”root”,”123456″); Statement […]

  • The method of quick upload file by JSP

    Time:2020-5-28

    In this paper, JSP is used to upload files quickly. Share with you for your reference. The details are as follows: Here we demonstrate that JSP does not use the third-party library to realize the function of fast file upload 1. FileUpload.java: package FileUpload; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import javax.servlet.ServletInputStream; /** * */ […]

  • The method of JSP uploading excel and inserting excel into database

    Time:2020-5-27

    In this paper, the method of JSP uploading excel and inserting excel into database is introduced. Share with you for your reference. The details are as follows: This import excel is bound with POJO, (disadvantage) the excle header must be the field value of POJO 1. HTML page: <form method=”post” enctype=”multipart/form-data”> <table> <tr> <td></td> <td> […]

  • Simple web voting program code implemented by JSP

    Time:2020-5-26

    This paper introduces a simple web voting program implemented by JSP. Share with you for your reference. The details are as follows: Text file is used as the voting system of data storage. 1. vote.java: package vote; import java.io.*; import java.util.*; public class vote { public String filePath = “”; public int n; private File […]

  • Simple generation method of JSP verification code

    Time:2020-5-25

    In this paper, a simple generation method of JSP verification code is introduced. Share with you for your reference. The details are as follows: <%@ page contentType=”image/jpeg” import=”java.awt.*,java.awt.image.*,java.util.*,javax.imageio.*” %> <%! Color getrandcolor (int FC, int BC) {// get random color for given range Random random = new Random(); if(fc>255) fc=255; if(bc>255) bc=255; int r=fc+random.nextInt(bc-fc); int […]

  • Using JSTL in JSP to output content according to different conditions

    Time:2020-5-23

    The example of this article describes how to use JSTL in JSP to output content according to different conditions. Share with you for your reference. The details are as follows: Co nditionalContentJSTL.jsp Page: <%@ page language=”java” contentType=”text/html;charset=UTF-8″ %> <%@ taglib uri=”/WEB-INF/tld/c-rt.tld” prefix=”c-rt” %> <html> <head> <title>Java Code Geeks Snippets – Conditional Content with JSTL in […]

  • JSP implementation of custom form tag for automatically generating HTML code of form tag

    Time:2020-5-22

    In this paper, JSP is used to generate HTML code of form tag automatically. Share with you for your reference. The details are as follows: This is a simple JSP form tag written by myself, which is used to automatically generate checkbox, select, radio and other tags, pass in the menu set to generate HTML […]