white-page.jsp<%@page pageEncoding="UTF-8"%>
<%@page isELIgnored="false"%>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<bean:message key="sso.onlinetest.result"/>想要得到sso.onlinetest.result
但总是拿到null
if((name.length() < 4) || (name.length() > 20)){
message = new ActionMessage("sso.onlinetest.result", "错误:用户名必须在4-20位长度之间!");
} ...
messages.add(ActionMessages.GLOBAL_MESSAGE, message);
return messages;若用户名小于4个单词
我就将错误写在sso.onlinetest.result键里
以下是资源包sso.label.username=Username:
sso.label.password=Password:
...sso.onlinetest.result={0}
最后是外层的action
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
String username = request.getParameter("username");
String nickname = request.getParameter("nickname");
response.setHeader("Charset","utf-8"); ActionMessages messages = null;
if(username != null){
username = new String(username.getBytes("ISO8859-1"),"UTF-8");
OnlineTestService testService = new UsernameOnlineTestService(username);
messages = testService.test();
}
else if(nickname != null){
nickname = new String(nickname.getBytes("ISO8859-1"),"UTF-8");
OnlineTestService testService = new UsernameOnlineTestService(username);
messages = testService.test();
}
this.saveMessages(request, messages);
return mapping.findForward("white-page");
}不知道哪里有错!请高手指点!
<%@page isELIgnored="false"%>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<bean:message key="sso.onlinetest.result"/>想要得到sso.onlinetest.result
但总是拿到null
if((name.length() < 4) || (name.length() > 20)){
message = new ActionMessage("sso.onlinetest.result", "错误:用户名必须在4-20位长度之间!");
} ...
messages.add(ActionMessages.GLOBAL_MESSAGE, message);
return messages;若用户名小于4个单词
我就将错误写在sso.onlinetest.result键里
以下是资源包sso.label.username=Username:
sso.label.password=Password:
...sso.onlinetest.result={0}
最后是外层的action
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
String username = request.getParameter("username");
String nickname = request.getParameter("nickname");
response.setHeader("Charset","utf-8"); ActionMessages messages = null;
if(username != null){
username = new String(username.getBytes("ISO8859-1"),"UTF-8");
OnlineTestService testService = new UsernameOnlineTestService(username);
messages = testService.test();
}
else if(nickname != null){
nickname = new String(nickname.getBytes("ISO8859-1"),"UTF-8");
OnlineTestService testService = new UsernameOnlineTestService(username);
messages = testService.test();
}
this.saveMessages(request, messages);
return mapping.findForward("white-page");
}不知道哪里有错!请高手指点!
解决方案 »
- 两个结构树的结点异同的比较
- JSP关于数据截断的问题
- sync4j 哪位用过?
- 请问tomcat如何实现访问http://****,跳转到http://****/web/my.jsp.
- strutus跳转及servlet配制
- 请问有人在J2EE1.2的工程上用过JSTL么,是不是一定要J2EE1.3以上的才可以?
- java代码中如何读取存放在server端的特定用户calendar信息?
- 1000分,调查,两年以上工作经验 的程序员最想学习什么知识,各个论坛都有,谢谢!
- 请大家看看我的这段代码,具体应如何修改(代码很少初级问题)
- jdk1.4是不是和sql server 2000 jdbc不兼容?
- 怎么判断jsp页面是第一次打开的
- 怎么发布啊?求解!
<bean:write name="messages" />
</html:messages>
# Copyright (c) 2004-2006, Novascope S.A. and the JOSSO team
# All rights reserved.
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the JOSSO team nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
## -- standard errors --
#errors.suffix=</li>
#errors.prefix=<li>
#errors.header=<ul class="error-msg"><font color="red" face="Verdana">
#errors.footer=</font></ul># -- SSO Message Resources
sso.label.username=Username:
sso.label.password=Password:
sso.info.session={0}sso.button.login=Loginsso.login.success={0}!
sso.login.redirect=You'll be redirected to your <a href="{0}">site</a>
sso.login.failed=Invalid Authentication Informationsso.error=Error : {0}
sso.onlinetest.result={0}我的ApplicationResource.properties,不是有sso.onlinetest.result={0}这一行吗?
sso.onlinetest.result不是键吗?
谢谢老大再解答一下哦
用<html:message>就会输出asdfasvalue1了。