简单吧,把字符串转化成Byte,可以很简单解决吧
解决方案 »
- jsp中什么是内部对象啊?
- spring3中beans包里的小问题
- 如何用hibernate自动创建表
- jsp中是如何实现页面在规定时间内不能登录的
- 请教web.xml中404错误
- 如何理解Spring框架中的IoC?
- 做structs2小项目的时候,复制粘帖新工程的时候遇见的崩溃的事情
- 关于weblogic和JDK的问题
- 帮忙一个简单问题
- myeclipse配置tomcat后打开localhost:8080一片空白
- 关于用jdbc-odbc操纵access2000数据库,String sql="create table btm(xwbt char(50),xwcn text)";这样操纵可以吗?
- 在jsp页面组件问题!!!
完全可以用javascript搞定
if (name.value.length<5)
location.href="error.html";
else
location.href="sub.jsp?i=....";在sub.jsp中设置一个parameter用来接收参数就搞了
<form action="sub.jsp" method = post>
Name :<input type = text name = "name"><BR><BR>
<input type = submit name = submit value = Submit>
</form>
</center>
<%
String SUP_ORG = request.getParameter("name");
if (request.getParameter("submit")!=null){
if(SUP_ORG.length() < 5)
response.sendRedirect("error.html");
}
%>
sub.jsp
<%
out.println(request.getParameter("name"));
%>
如果安全性要求不高
同意xiaokang520(Nova) 的方法,用javascript
不过如果比较重要
建议两种方法同时用
因为前一种可以轻松绕过去
<!--
function myCheck(){
if(form1.name.length<5){
window.open("Error","error.htm","");
// alert("Sorry, there was an length error! ");
return false;
}
return true;
}
-->
</script> <center>
<form name="form1" action="check.CheckServlet" method = post onSubmit="return myCheck();">
Name :<input type = text name = "name"><BR><BR>
<input type = submit name = submit value = Submit>
</form>
</center>