再做接口开发时,遇到一个问题 Could not resolve view with name 'xxx' in servlet with name 'dispatcherServlet'

用的springboot框架

在控制器上加了 两个注解

@Controller
@RequestMapping("/kingowSSO")

我写了一个方法,
刚开始我的方法没有这个注解,当请求过来时方法可以正常执行,但是方法执行完毕后,程序会报错,挺奇怪的,我的方法没有返回值用的 void ,理论上是不需要加 @ResponseBody 注解的才对啊

@ResponseBody

但是不加 @ResponseBody 注解 程序会报错

Could not resolve view with name 'xxx' in servlet with name 'dispatcherServlet'

java计算百分比

/**
     * 使用java.text.DecimalFormat实现
     *
     * @param x
     * @param y
     * @return
     */
    public static String getPercent(int x, int y) {
        if (x == 0) return "0.00%";
        double d1 = x * 1.0;
        double d2 = y * 1.0;
        // 设置保留几位小数, “.”后面几个零就保留几位小数,这里设置保留两位小数
        DecimalFormat decimalFormat = new DecimalFormat("##.00%");
        return decimalFormat.format(d1 / d2);
    }
 /**
     * 方式一:使用java.text.NumberFormat实现
     * @param x
     * @param y
     * @return
     */
    public static String getPercent(int x, int y) {
        double d1 = x * 1.0;
        double d2 = y * 1.0;
        NumberFormat percentInstance = NumberFormat.getPercentInstance();
        // 设置保留几位小数,这里设置的是保留两位小数
        percentInstance.setMinimumFractionDigits(2);
        return percentInstance.format(d1 / d2);
    }

Tomcat启动不成功提示:Windows不能在本地计算机启动Apache Tomcat【解决办法】

就是打开Tomcat安装目录下的bin目录下
找到Tomcat9w.exe文件,打开


1、首先检查一下自己的jre路径是否正确

2、如果jre路径正确的话,选择startup选项
在mode里面选择java(默认是jvm)


删除Tomcat服务:首先,在运行菜单中输入cmd,打开命令提示符窗口,执行以下命令: sc delete tomcat7 若是Tomcat6则写sc delete tomcat6。 2、删除Tomcat文件: 打开文件管理器,找到Tomcat所在的文件夹,右键选择删除即可

达梦数据库查询用map接收 text字段会被转成clod字段

达梦数据库中,text类型字段会自动转换为cloud类型字段。因此,当您使用map接收text类型字段时,达梦数据库会将该字段的数据类型转换为cloud类型,导致数据类型错误。如果您需要在map中接收text类型字段,请将该字段的数据类型在查询语句中指定为text类型。例如,假设您的查询语句为SELECT name, CAST(content AS TEXT) FROM table_name,其中content是text类型字段,您可以使用CAST函数将其转换为text类型,然后在map中接收。

达梦数据库中的text类型是一种LOB(Large Object),用于存储大量的文本数据。而clob也是一种LOB类型,用于存储字符型数据。在达梦数据库中,text类型字段会被自动转换为clob类型,因为它们都属于LOB类型,并且具有相似的特性。这种转换可能会发生在查询、插入、更新等操作中,如果您需要明确使用text类型,建议在SQL语句中显式地指定该字段为text类型,以避免数据类型错误。

   Map<String, Object> entity = this.genericMapper.getRecordMapById(formTable, recordId);
 while(var3.hasNext()) {
                                            String key = (String)var3.next();
                                            if (itemx.get(key) instanceof ClobProxyImpl) {
                                                ClobProxyImpl clobProxy = (ClobProxyImpl)itemx.get(key);
                                                itemx.put(key, OracleUtils.clobToString(clobProxy));
                                            } else if (itemx.get(key) instanceof Blob) {
                                                Blob blob = (Blob)itemx.get(key);
                                                itemx.put(key, OracleUtils.blobToString(blob));
                                            }
                                        }
package com.jinw.utils;

import com.alibaba.druid.proxy.jdbc.ClobProxyImpl;

import java.sql.Blob;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * @ClassName OracleUtils
 * @Description 一句话描述类的作用
 * @Author liux
 * @Date 2021/12/22 16:22
 **/
public class OracleUtils {
    public static String clobToString(ClobProxyImpl clobProxy) throws SQLException {
        String subString = clobProxy.getSubString(1, (int) clobProxy.length());
        return subString;
    }

    public static String blobToString(Blob blob) throws Exception {
        String newStr = "";
        int blobLength = (int) blob.length();
        byte[] bytes = blob.getBytes(1, blobLength);
        if(bytes == null || blobLength == 0){
            return "";
        }else {
            int i = 1;
            while(i < blobLength){
                bytes = blob.getBytes(i,1024);
                i = i + 1024;
                newStr = newStr + new String(bytes,"UTF-8");
            }
        }
        return newStr;
    }
}
package com.jinw.utils;

import com.alibaba.druid.proxy.jdbc.ClobProxyImpl;

import java.sql.Blob;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * @ClassName OracleUtils
 * @Description 一句话描述类的作用
 * @Author liux
 * @Date 2021/12/22 16:22
 **/
public class OracleUtils {
    public static String clobToString(ClobProxyImpl clobProxy) throws SQLException {
        String subString = clobProxy.getSubString(1, (int) clobProxy.length());
        return subString;
    }

    public static String blobToString(Blob blob) throws Exception {
        String newStr = "";
        int blobLength = (int) blob.length();
        byte[] bytes = blob.getBytes(1, blobLength);
        if(bytes == null || blobLength == 0){
            return "";
        }else {
            int i = 1;
            while(i < blobLength){
                bytes = blob.getBytes(i,1024);
                i = i + 1024;
                newStr = newStr + new String(bytes,"UTF-8");
            }
        }
        return newStr;
    }
}