简体   繁体   English

无法从JSP引用BCrypt文件

[英]Unable to reference BCrypt File from JSP

I am trying to encrypt my password prior to storing in my remote database but I get an error saying 我在尝试将密码加密之前,先将其存储在远程数据库中,但是出现错误提示

"Classes from the default package must not be referenced from JSP file" “不得从JSP文件中引用默认包中的类”

Where else should I reference it? 我还应该在哪里参考呢? I am having BCrypt as a jar file in my lib folder. 我的lib文件夹中有BCrypt作为jar文件。

//Code at JSP file

    <html>
        <body>
            <%
                //This line causes error
                String hashed = BCrypt.hashpw(password, BCrypt.gensalt());
            %>
        </body>
    </html>

You should put your class to the package. 您应该将课程放到包中。

The JSP page is compiled into a class that is placed in the package. JSP页面被编译成放在包中的类。 Classes that are in packages, can't import classes that are in the default package. 程序包中的类不能导入默认程序包中的类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM