我有这个Java代码,想知道如何在HTML文件中将其作为网站运行:Password Generator by Robotter112:
import java.util.Random;
public class PasswordGenerator
{
public static void main(String[] args)
{
int length = 10; // password length
System.out.println(generatePswd(length));
}
static char[] generatePswd(int len)
{
System.out.println("Your Password:");
String charsCaps = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
String chars = "abcdefghijklmnopqrstuvwxyz";
String nums = "0123456789";
String symbols = "!@#$%^&*_=+-/€.?<>)";
String passSymbols = charsCaps + chars + nums + symbols;
Random rnd = new Random();
char[] password = new char[len];
int index = 0;
for (int i = 0; i < len; i++)
{
password[i] = passSymbols.charAt(rnd.nextInt(passSymbols.length()));
}
return password;
}
}
那么在HTML文件中可以运行这个java的HTML代码是什么?