lizongbo 的编程学习

编程学习 java为主的web应用开发

  DonewsBlog  |  Donews首页  |  Donews社区  |  Donews邮箱  |  我的首页  |  联系作者  |  聚合   |  登录
  75篇文章 :: 0篇收藏:: 35篇评论:: 2个Trackbacks

公告

lizongbo的blog


文章

收藏

相册

常用网址

存档


正在读取评论……


<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="java.util.*"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%>
<html>
<head>
<title>language choose</title>
</head>
<body bgcolor="#ffffff">

copyright @ lizongbo @ donews.net


<c:if test="${param['locale'] != null}">
  <fmt:setLocale value="${param['locale']}" scope="session"/>
  <fmt:setTimeZone value="${param['locale']}" scope="session"/>
</c:if>
<c:if test="${param['locale'] == null}">
  <fmt:setLocale value="${header['locale']}" scope="session"/>
  <fmt:setTimeZone value="${header['locale']}" scope="session"/>
</c:if>
<%
  Locale crtl = Locale.getDefault();
  Object cobj = session.getAttribute("javax.servlet.jsp.jstl.fmt.locale.session");
  if (cobj != null && cobj instanceof Locale) {
    crtl = (Locale) cobj;
  }
  Locale[] la = java.text.NumberFormat.getAvailableLocales();
%>
<form method="POST" action="">
  language choose:
  <br />
<select name="locale">
<%for (int i = 0; i < la.length; i++) {%>
  <option value="<%=la[i]%>" <%if (la[i].equals(crtl)) {
                                 out.print("selected=\"selected\"");
                               }%>><%= la[i].getDisplayName(crtl)%></option>
<%
  }
%>
</select>
<br />
<input type="submit" value="change"/>
</form>
</body>
</html>



Trackback: http://tb.donews.net/TrackBack.aspx?PostId=371915


[点击此处收藏本文]  发表于2005年05月09日 3:28 PM




正在读取评论……

发表评论

大名:
网址:
验证码
评论