Write & interface, the background is saved to & amp;

Approach:

Method One: set of objects in an object when the entity handling of special characters

public  void setMerchantName (String MERCHANTNAME) {
         // for processing of special characters do merchant 
        MERCHANTNAME = StringEscapeUtils.unescapeHtml4 (MERCHANTNAME);
         the this .merchantName = MERCHANTNAME; 
    }

Method 2: saved to the database when the object of special character handling

public R the Save (@RequestBody MerchantEntity Merchant) { 
        
        // save the business name when the normalization special character (the escape character) 
        merchant.setMerchantName (StringEscapeUtils.unescapeHtml4 (merchant.getMerchantName ())); 

        merchantService.insert (Merchant); 

        return R.ok () PUT ( "Merchant." , Merchant); 
    }

StringEscapeUtil class is org.apache.commons.lang3.StringEscapeUtils;

<dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>

 

Guess you like

Origin www.cnblogs.com/shan-pj/p/10978231.html