初学struts所遇问题,救命啊!

Arqui 2004-09-21 01:31:12
(eclipse下)
建立一个输入user与password的LOGIN,

若user=password进入welcome,
若不等提示错误信息。

但提示出错:
org.apache.jasper.JasperException: Cannot find message resources under key org.apache.struts.action.MESSAGE

我的action:
package app;

import javax.servlet.http.*;
import org.apache.struts.action.*;

public final class LogonAction extends Action {

public ActionForward perform(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) {
String username = ((LogonForm)form).getUsername();
String password = ((LogonForm)form).getPassword();
if(!username.equals(password)) {
//ActionErrors errors = new ActionErrors();
//errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("error.logon.invalid"));
//saveErrors(request,errors);
return(new ActionForward(mapping.getInput()));
}
HttpSession session = request.getSession();
session.setAttribute("user",form);
return(mapping.findForward("success"));
}
}
请大家帮忙,这里作揖了
...全文
129 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
stonecsdn 2004-09-21
  • 打赏
  • 举报
回复
<init-param>
<param-name>application</param-name><!--here should be application-->
<param-value>com.youcompany.struts.ApplicationResources</param-value>
</init-param>
Arqui 2004-09-21
  • 打赏
  • 举报
回复
哎呀,楼上大哥谢谢你啦,问题好像解决了,但我还有点不明白的是,我以为在web.xml里设置ApplicationResources呢!

我的web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>ApplicationResources</param-name>
<param-value>com.youcompany.struts.ApplicationResources</param-value>
</init-param>
<init-param>
<param-name>coinfig</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
</web-app>

这里的<init-param>
<param-name>ApplicationResources</param-name>
<param-value>com.youcompany.struts.ApplicationResources</param-value>
</init-param>
不是在指定资源文件吗?而且我用的eclipse的easystruts不允许更改ApplicationResources!!
我有很多很糊涂的,还忘东东赐教,加我MSN:arqui2004@hotmail.com
stonecsdn 2004-09-21
  • 打赏
  • 举报
回复
资源文件放在WEB-INF/classes下
如果你的资源文件名为:ApplicationResources.properties
在struts-config.xml中配置如下:
<struts-config>
.....
<message-resources parameter="ApplicationResources" />
</struts-config>
Arqui 2004-09-21
  • 打赏
  • 举报
回复
资源文件如下:
welcome.title = Struts Logon Example Application
welcome.heading = Welcome!
welcome.message = To get started on your own application,copy the struts-blank.war to a new WAR file using the name for your
application.Place it in your container's "webapp" folder (or equivalent),and let your container auto-deploy the application Edit
skeleton configuration files as needed,reload Struts or restart your container,and you are on your way!(You can find
application.properties file with this message in the <B>/WEB-INF/src/java/resources</B> folder.)
errors.footer = </UL><HR>
errors.header = <H3><FONT color="red">Validation Error</FONT></H3>You must correct the following error(3) before
proceeding:<UL>
error.username.required = <LI>Username is required</LI>
error.password.required = <LI>Password is required</LI>
error.logon.invalid = <LI>Username and password provided not found inuser directory.Password must match exactly,including;
lower or upper case characters.</LI>
error.logon.connect = <LI>Could not connect to user directory.</LI>

感觉没有问题啊!!
pine460 2004-09-21
  • 打赏
  • 举报
回复
资源文件没写对!
内容概要:本文针对网型T型三电平逆变器的低电压穿越(LVRT)能力及其综合控制策略开展深入研究,重点分析电网电压跌落条件下逆变器的动态响应特性与稳定性控制方法。研究基于Simulink平台构建详细的系统仿真模型,融合改进的电流环控制策略与中点电位平衡控制算法,有效提升逆变器在故障工况下的电流跟踪精度、过流抑制能力和直流侧中点电压稳定性。通过多场景仿真验证,所提出的综合控制策略能够显著增强逆变器在低电压穿越过程中的鲁棒性与电能质量,确保新能源系统在电网扰动下的持续可靠并网运行。; 适合人群:电力电子、新能源发电、电力系统自动化等相关专业的研究生、科研人员及从事并网逆变器设计与控制的工程技术人员。; 使用场景及目标:①深入理解三电平逆变器在电网故障下的运行机理与控制挑战;②掌握低电压穿越技术中电流限幅、故障响应及中点电位平衡的核心控制方法;③应用于光伏、风电等新能源并网系统的控制策略开发与仿真验证; 阅读建议:建议结合提供的Simulink仿真模型进行动手实践,重点关注控制器参数设计、中点电位观测与调节模块的实现逻辑,并通过对比不同电压跌落深度和控制策略的仿真结果,深化对系统动态行为与控制性能的理解。
yolo算法港口码头船舶目标检测数据集 目标类别:['ship'] 中文类别:['船舶'] 训练集:16046 张 验证集:1971 张 测试集:983 张 总计:19000 张 该数据集提供了data.yaml文件,内容如下: train: ../train/images val: ../valid/images test: ../test/images nc: 1 names: ['ship'] 该数据集聚焦于港口码头及近海水域的船舶检测任务,涵盖多种类型船舶在不同天气、光照和水文条件下的真实场景。图像样本覆盖了货轮、客轮、拖船、油轮及工程船等典型船只,充分体现了海上交通与港口作业的复杂性与多样性。通过高精度标注,该数据集为海上智能监控、船舶识别与航行安全预警系统提供了高质量的数据支撑,具有重要的实际应用价值。 该数据集在训练集、验证集和测试集之间实现了科学合理的分布,训练集包含16046张图像,验证集1971张,测试集983张,总计19000张。这种分布结构确保了模型在训练过程中具备充足的样本学习能力,同时验证集与测试集规模适中,能够有效评估模型的泛化性能与稳定性,符合深度学习项目对数据划分的标准要求。 该数据集的标注工作严谨规范,所有船舶均采用精确边界框进行标注,覆盖了不同尺寸、姿态和视角下的目标实例。标注框紧密贴合船舶轮廓,未出现明显偏移或遗漏,且在复杂背景(如水面反光、雾天、桥梁遮挡)下仍保持高一致性。标注信息完整可靠,为后续模型训练提供了坚实基础。 该数据集可广泛应用于港口自动化管理、海上交通监控、船舶动态跟踪、航道安全预警以及海洋执法等领域。其丰富的场景覆盖和多样化的船舶类型使其特别适用于智慧港口建设、海上搜救系统开发及航运物流智能化升级,能够有效提升相关系统的识别准确率与响应效率,推动海洋经济数字化转型。

67,535

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧