?? mul_language_helloworld.jsp
字號(hào):
<%@ page contentType="text/plain;charset=UTF-8" import="java.io.*,java.text.*,java.util.*,javax.servlet.jsp.*"%>
<html>
<body>
<%!
Locale locale;
DateFormat format;
JspWriter writer;
%>
<%!
//英語(yǔ)
void processEnglish()throws Exception
{
locale=new Locale("en","US");
format=DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG,locale);
writer.println("in English:");
writer.println("<br>");
writer.println("HelloWorld!");
writer.println(format.format(new Date()));
writer.flush();
}
//中文
void processChinese()throws Exception
{
locale=new Locale("zh","");
format=DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG,locale);
writer.println("in Chinese:");
writer.println("<br>");
writer.println("\u4f60\u597d\u4e16\u754c");
writer.println(format.format(new Date()));
writer.flush();
}
//韓國(guó)語(yǔ)
void processKorean()throws Exception
{
locale=new Locale("ko","");
format=DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG,locale);
writer.println("in Korean:");
writer.println("<br>");
writer.println("\uc548\ud558\uc138\uc694\uc138\uacc4");
writer.println(format.format(new Date()));
writer.flush();
}
//俄語(yǔ)
void processRussian()throws Exception
{
locale=new Locale("ru","");
format=DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG,locale);
writer.println("in Russian:");
writer.println("<br>");
writer.println("\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439,\u041c\u0438\u0440");
writer.println(format.format(new Date()));
writer.flush();
}
//西班牙語(yǔ)
void processSpanish()throws Exception
{
locale=new Locale("es","");
format=DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG,locale);
writer.println("in Spanish:");
writer.println("<br>");
writer.println("En Espa\u00f1ol:");
writer.println("\u00a1Hola Mundo!");
writer.println(format.format(new Date()));
writer.flush();
}
//日語(yǔ)
void processJapanese()throws Exception
{
locale=new Locale("ja","");
format=DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG,locale);
writer.println("in Japanese:");
writer.println("<br>");
writer.println("\u4eca\u65e6\u306f\u4e16\u754c");
writer.println(format.format(new Date()));
writer.flush();
}
%>
<%
//獲得請(qǐng)求的語(yǔ)種
String language=(String)request.getParameter("language");
int lan=Integer.parseInt(language);
%>
<%
writer=out;
switch(lan)
{
case 1:processEnglish();break;
case 2:processChinese();break;
case 3:processKorean();break;
case 4:processRussian();break;
case 5:processSpanish();break;
case 6:processJapanese();break;
}
%>
</body>
</html>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -