日期:2014-05-18  浏览次数:20693 次

问2个问题,散分
jsp怎么实现多国语转换。.net我会多国语转换,jsp不会~~

还有就是jsp可以用asp的探针吗?
把asp的探针代码放到jsp页面中能够用吗?

因为这个都是我用.net做出来的,所以想在面试java的时候也说这个项目,所以不知道java中是怎么实现。只要说出大概思路就行,因为这个是我要在面试的时候要讲的,所以只要思想....

------解决方案--------------------
jsp有控制验证的功能吗?
有很多方法可以实现,我一般都是用Filter 来实现
可以看看这个http://blog.csdn.net/gnemy/archive/2007/02/04/1501973.aspx


------解决方案--------------------
<%@ page contentType= "text/html;charset=gb2312 " %>
<%@ page import= "java.util.*,java.io.*,javax.servlet.*,javax.servlet.http.*,java.lang.* " %>
<%
/********************************************************************
* Title: JspEnv v
* Description : JSP环境探针
* CopyRight:(c) 2005 www.soho.net.ru
* @author: 若影
* @version: 1.0
* @Data: 2005-1-1 12:00:00
*********************************************************************/

long timePageStart = System.currentTimeMillis();
%>
<%
class EnvServlet
{
public long timeUse=0;
public Hashtable htParam=new Hashtable();
private Hashtable htShowMsg=new Hashtable();
public void setHashtable()
{
Properties me=System.getProperties();
Enumeration em=me.propertyNames();
while(em.hasMoreElements())
{
String strKey=(String)em.nextElement();
String strValue=me.getProperty(strKey);
htParam.put(strKey,strValue);
}
}
public void getHashtable(String strQuery)
{
Enumeration em=htParam.keys();
while(em.hasMoreElements())
{
String strKey=(String)em.nextElement();
String strValue=new String();
if(strKey.indexOf(strQuery,0)> =0)
{
strValue=(String)htParam.get(strKey);
htShowMsg.put(strKey,strValue);
}
}
}
public String queryHashtable(String strKey)
{
strKey=(String)htParam.get(strKey);
return strKey;
}
public long test_int()
{
long timeStart = System.currentTimeMillis();
int i=0;
while(i <3000000)i++;
long timeEnd = System.currentTimeMillis();
long timeUse=timeEnd-timeStart;
return timeUse;
}
public long test_sqrt()
{
long timeStart = System.currentTimeMillis();
int i=0;
double db=(double)new Random().nextInt(1000);
while(i <200000){db=Math.sqrt(db);i++;}
long timeEnd = System.currentTimeMillis();
long timeUse=timeEnd-timeStart;
return timeUse;
}
}
%>
<%
EnvServlet env=new EnvServlet();
env.setHashtable();
String action=new String( " ");
String act=new String( "action ");
if(request.getQueryString()!=null&&request.getQueryString().indexOf(act,0)> =0)action=request.getParameter(act);
%>
<html>
<head>
<title> JSP 探针 </title>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<style>
A { COLOR: #000000; TEXT-DECORATION: none}
A:hover { COLOR: #f58200}
body,td,span { font-size: 9pt}
.input { BACKGROUND-COLOR: #ffffff;BORDER:#f58200 1px solid;FONT-SIZE: 9pt}
.backc { BACKGROUND-COLOR: #f58200;BORDER:#f58200 1px solid;FONT-SIZE: 9pt;color:white}
.PicBar { background-color: #f58200; border: 1px solid #000000; height: 12px;}
.tableBorder {BORDER-RIGHT: #183789 1px solid; BORDER-TOP: #183789 1px solid; BORDER-LEFT: #183789 1px solid; BORDER-BOTTOM: #183789 1px solid; BACKGROUND-COLOR: #ffffff; WIDTH: 760