当前位置: 首页 > news >正文

网站关于我们怎么做单页面seo标题优化关键词怎么选

网站关于我们怎么做单页面,seo标题优化关键词怎么选,厦门网站建设哪家好,企业做网站一般要多少钱学习材料声明 所有知识点都来自互联网,进行总结和梳理,侵权必删。 引用来源:尚硅谷最新版JavaWeb全套教程,java web零基础入门完整版 i18n 国际化(Internationalization)指的是同一个网站可以支持多种不同的语言&…

学习材料声明

所有知识点都来自互联网,进行总结和梳理,侵权必删。
引用来源:尚硅谷最新版JavaWeb全套教程,java web零基础入门完整版

i18n

国际化(Internationalization)指的是同一个网站可以支持多种不同的语言,以方便不同国家,不同语种的用户访问。

很有趣的命名。
主要是实现多种网页语言的转换。
在这里插入图片描述
需要的配置properties文件
在这里插入图片描述
如何使用:

@Test
public void testI18n(){// 得到我们需要的 Locale 对象Locale locale = Locale.CHINA;// 通过指定的 basename 和 Locale 对象,读取 相应的配置文件ResourceBundle bundle = ResourceBundle.getBundle("i18n", locale);System.out.println("username:" + bundle.getString("username"));System.out.println("password:" + bundle.getString("password"));System.out.println("Sex:" + bundle.getString("sex"));System.out.println("age:" + bundle.getString("age"));
}

1.页面语言修改方式1:获取浏览器的默认语言配置。

<%@ page import="java.util.Locale" %>
<%@ page import="java.util.ResourceBundle" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="pragma" content="no-cache" /><meta http-equiv="cache-control" content="no-cache" /><meta http-equiv="Expires" content="0" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Insert title here</title></head><body><%// 从请求头中获取 Locale 信息(语言)Locale locale = request.getLocale();System.out.println(locale);// 获取读取包(根据 指定的 baseName 和 Locale 读取 语言信息)ResourceBundle i18n = ResourceBundle.getBundle("i18n", locale);%><a href="">中文</a>|<a href="">english</a><center><h1><%=i18n.getString("regist")%></h1><table><form><tr><td><%=i18n.getString("username")%></td><td><input name="username" type="text" /></td></tr><tr><td><%=i18n.getString("password")%></td><td><input type="password" /></td></tr><tr><td><%=i18n.getString("sex")%></td><td><input type="radio" /><%=i18n.getString("boy")%><input type="radio" /><%=i18n.getString("girl")%></td></tr><tr><td><%=i18n.getString("email")%></td><td><input type="text" /></td></tr><tr><td colspan="2" align="center"><input type="reset" value="<%=i18n.getString("reset")%>" />&nbsp;&nbsp;<input type="submit" value="<%=i18n.getString("submit")%>" /></td></tr></form></table><br /> <br /> <br /> <br /></center>国际化测试:<br /> 1、访问页面,通过浏览器设置,请求头信息确定国际化语言。<br /> 2、通过左上角,手动切换语言</body>
</html>

2.通过页面设置

<%@ page import="java.util.Locale" %>
<%@ page import="java.util.ResourceBundle" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><meta http-equiv="pragma" content="no-cache" /><meta http-equiv="cache-control" content="no-cache" /><meta http-equiv="Expires" content="0" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Insert title here</title>
</head>
<body><%// 从请求头中获取 Locale 信息(语言)Locale locale = null;String country = request.getParameter("country");if ("cn".equals(country)) {locale = Locale.CHINA;} else if ("usa".equals(country)) {locale = Locale.US;} else {locale = request.getLocale();}System.out.println(locale);// 获取读取包(根据 指定的 baseName 和 Locale 读取 语言信息)ResourceBundle i18n = ResourceBundle.getBundle("i18n", locale);%><a href="i18n.jsp?country=cn">中文</a>|<a href="i18n.jsp?country=usa">english</a><center><h1><%=i18n.getString("regist")%></h1><table><form><tr><td><%=i18n.getString("username")%></td><td><input name="username" type="text" /></td></tr><tr><td><%=i18n.getString("password")%></td><td><input type="password" /></td></tr><tr><td><%=i18n.getString("sex")%></td><td><input type="radio" /><%=i18n.getString("boy")%><input type="radio" /><%=i18n.getString("girl")%></td></tr><tr><td><%=i18n.getString("email")%></td><td><input type="text" /></td></tr><tr><td colspan="2" align="center"><input type="reset" value="<%=i18n.getString("reset")%>" />&nbsp;&nbsp;<input type="submit" value="<%=i18n.getString("submit")%>" /></td></tr></form></table><br /> <br /> <br /> <br /></center>国际化测试:<br /> 1、访问页面,通过浏览器设置,请求头信息确定国际化语言。<br /> 2、通过左上角,手动切换语言</body>
</html>

3.利用JSTL标签库实现国际化

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><meta http-equiv="pragma" content="no-cache" /><meta http-equiv="cache-control" content="no-cache" /><meta http-equiv="Expires" content="0" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Insert title here</title>
</head>
<body><%--1 使用标签设置 Locale 信息--%><fmt:setLocale value="${param.locale}" /><%--2 使用标签设置 baseName--%><fmt:setBundle basename="i18n"/><a href="i18n_fmt.jsp?locale=zh_CN">中文</a>|<a href="i18n_fmt.jsp?locale=en_US">english</a><center><h1><fmt:message key="regist" /></h1><table><form><tr><td><fmt:message key="username" /></td><td><input name="username" type="text" /></td></tr><tr><td><fmt:message key="password" /></td><td><input type="password" /></td></tr><tr><td><fmt:message key="sex" /></td><td><input type="radio" /><fmt:message key="boy" /><input type="radio" /><fmt:message key="girl" /></td></tr><tr><td><fmt:message key="email" /></td><td><input type="text" /></td></tr><tr><td colspan="2" align="center"><input type="reset" value="<fmt:message key="reset" />" />&nbsp;&nbsp;<input type="submit" value="<fmt:message key="submit" />" /></td></tr></form></table><br /> <br /> <br /> <br /></center></body>
</html>
http://www.wangmingla.cn/news/130129.html

相关文章:

  • 网站悬浮qqapp开发教程
  • 做优惠卷网站电脑培训学校能学什么
  • 便宜营销型网站建设优化建站怎么提高关键词搜索权重
  • 网站导航的建设模板推广普通话的文字内容
  • 石家庄网站定制开发广州网络推广万企在线
  • 做网站发布网百度广告收费标准
  • 建设委员会的网站企业在线培训系统
  • 武汉网站改版维护企业网站建站
  • wordpress 百度云加速淘宝seo关键词的获取方法有哪些
  • 唐山网站建设哪家优惠免费搭建个人网站
  • 用php做的网站前后台模板长沙本地推广
  • 一起做网站吧足球比赛今日最新推荐
  • html5 网站框架英文seo外链
  • 南昌做网站的公司哪家好google seo怎么做
  • 如何做网络集资网站网站市场推广
  • 架设网站需要什么河北seo平台
  • 呼和浩特市网站公司电话百度登录个人中心
  • 中国电力建设集团网站seo外包顾问
  • 做网站送推广yandex引擎
  • 网站备案半身照水平优化
  • 大连网站建设哪家专业网络营销环境的分析主要是
  • 哈尔滨网站开发公司电话服务营销
  • 锦州滨海新区城市建设规划网站营销型网站制作企业
  • 沭阳住房和城乡建设局网站杭州网站优化平台
  • 可以做招商的网站百度互联网营销是什么
  • 专做日式新中式庭院的网站有哪些免费建站平台
  • 手机电影网站怎样做市场调研报告总结
  • 杭州建设网站免费杭州seo泽成
  • seo建站新闻营销发稿平台
  • 媒介代理公司排名网站seo推广平台