selectLanguage.htmlhtmlheadtitleUntitled Document/titlemeta http-equiv=Content-Type c/headbody请选择语言:form action=mul_language_Hel... 推广和普及Java技术,为国内众多的Java爱好者提供一个“平等自由协作创造”
selectLanguage.html<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" c>
</head>
<body>
请选择语言:
<form action="mul_language_HelloWorld.jsp">
<select name="language">
<option value="1">English</option>
<option value="2">chinese</option>
<option value="3">Korean </option>
<option value="4">Russian </option>
<option value="5">Spanish </option>
<option value="6">Japanese </option>
</select>
<input type="submit" value="submit">
</form>
</body>
</html>
mul_language_HelloWorld.jsp
<%@ page c import="java.io.*,java.text.*,java.util.*,javax.servlet.jsp.*"%>
<html>
<body>
<%!
Locale locale;
DateFormat format;
JspWriter writer;
%>
<%!
//英语
void processEnglish()throws Exception
内容来自dedecms
{
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();
}
//韩国语
void processKorean()throws Exception
{
locale=new Locale("ko","");
format=DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG,locale); copyright dedecms
writer.println("in Korean:");
writer.println("<br>");
writer.println("\uc548\ud558\uc138\uc694\uc138\uacc4");
writer.println(format.format(new Date()));
writer.flush();
}
//俄语
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();
}
//西班牙语
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();
}
//日语
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();
}
%>
<%
//获得请求的语种
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> 复制地址和好友共享








