Tag:java

  • Using java to realize guessing games

    Time:2021-10-17

    This example shares the specific code of Java guessing game for your reference. The specific contents are as follows Achieve the following requirements public class User { private String u_name; private int u_score; public User() { super(); } public User(String name, int score) { super(); this.u_name = name; this.u_score = score; } public String getName() […]

  • Hasor 1.0.0, a lightweight java development framework, was officially released

    Time:2021-10-8

    Hasor  Is an open source lightweight Java application development framework. Its core goal is to provide a simple and necessary development environment for developers. Developers can build more perfect applications on this basis. Online API address:http://www.hasor.net/apis/1.0.0/index.html design idea “Microkernel+plug-in unit”It is the main design idea of hasor. Hasor extends by providing a unified interface, which […]

  • Using Oracle stored procedures under Java (detailed explanation) page 1 of 3

    Time:2021-9-26

    Any reprint, please respect the copyright. (by iihero on CSDN)1、 How to create a Java stored procedure?There are usually three ways to create Java stored procedures.1. Use Oracle SQL statement to create:e. G. use create or replace and compile java source named “< name >” asFollow the Java source program. It is required that the […]

  • Java implementation converts object type to int type

    Time:2021-9-25

    How to convert object type to int type Object object = null; try { Integer.parseInt(object.toString()); } catch (NumberFormatException e) {} You can also determine whether it is an integer first //You can determine whether it is an integer first Object object = “111”; if (object instanceof Integer) { Integer.parseInt(object.toString()); } String converts the pit encountered […]

  • Java Ajax implementation cascade drop-down box

    Time:2021-9-25

    Copy codeThe code is as follows: package com.ajaxlab.ajax; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import org.jdom.Document; import org.jdom.Element; import org.jdom.input.SAXBuilder; import com.ajaxlab.ajax.ProductClass; public class ClassService …{ private Document dom; public ClassService()…{ try…{ SAXBuilder builder=new SAXBuilder(); this.dom=builder.build(ClassService.class.getResource(“product.xml”)); }catch(Exception e)…{ e.printStackTrace(); } } public ProductClass[] getAllClass1()…{ Collection products=new ArrayList(); Iterator iterator=this.dom.getRootElement().getChildren().iterator(); do…{ Element element=(Element)iterator.next(); ProductClass product=new ProductClass(element.getAttributeValue(“id”), […]

  • To remove HTML tags from Java, you must first remove the regular double quotation marks

    Time:2021-9-24

    Copy codeThe code is as follows: public static String htmlToStr(String htmlStr){ String result = “”; boolean flag = true; if(htmlStr==null){ return null; } Htmlstr = htmlstr.replace (“\” “,”); / / remove quotation marks char[] a = htmlStr.toCharArray(); int length=a.length; for(int i=0;i<length;i++){ if(a[i]=='<‘){ flag=false; continue; } if(a[i]==’>’){ flag=true; continue; } if(flag==true){ result+=a[i]; } } return result.toString(); […]

  • A simple java character set filter implementation

    Time:2021-9-16

    Copy codeThe code is as follows: package dw05prj.util.filter; import javax.servlet.Filter; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.FilterChain; import java.io.IOException; /*Page character set filter stream*/ /* Examples of configuration in web.xml<filter> <filter-name>CharEncodingFilter</filter-name> <filter-class>dw05prj.util.filter.CharEncodingFilter</filter-class> <init-param> <param-name>charset</param-name> <param-value>GBK</param-value> </init-param> </filter> <filter-mapping> <filter-name>CharEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> */ public class CharEncodingFilter implements Filter { private String charSet ; […]

  • A thorough study of Java regular expressions

    Time:2021-9-3

     package testreg; import java.util.regex.Matcher; import java.util.regex.Pattern; /** *  < p>Title:   Research on regular expressions</p>* <p>Description: *   Recently, I often use some regular expressions in my work. When I go to the Internet to find an introduction, it is mostly a little. It’s better to beg than to ask*   Please. A cruel heart, see for yourself! In […]

  • [J2SE] 3DES encryption and decryption call example in Java

    Time:2021-8-28

    jce.jar security/US_export_policy.jar security/local_policy.jar ext/sunjce_provider.jar The Java runtime will automatically load these packages, so the application with main function does not need to be set in the classpath environment variable. For web applications, you do not need to add these packages to the WEB-INF / lib directory.The following is the sample code of 3DES encryption and […]

  • Java regular expression validation function

    Time:2021-8-28

    Copy codeThe code is as follows: /** *Validate regular expressions* *@ author Zhujie regex string to which the regular expression value belongs* @return boolean */ public static boolean regex(String regex, String value) { Pattern p = Pattern.compile(regex); Matcher m = p.matcher(value); return m.find(); }

  • Java string matching function

    Time:2021-8-27

    Remove the matching string from the string Copy codeThe code is as follows: /** *Remove the matching string from the string* * @author zhujie *@ return string regex what to replace value string state what to replace*/ public static String toRegex(String regex, String value, String state) { Pattern p = Pattern.compile(regex); Matcher m = p.matcher(value); […]

  • Java easy to understand and use MD5 encryption (can be run directly) (1) page 1 / 2

    Time:2021-8-26

    1. MD5 encryption, the encryption algorithm is one-way encryption, that is, the encrypted data can no longer be restored through decryption. The related classes are contained in the Java. Security. Messagedigest package.2. 3-DES encryption, the encryption algorithm is reversible, and the decrypting party can decrypt through the secret key agreed with the encrypting party. Related […]