struts1

Difference between core and core_rt jstl tag

倾然丶 夕夏残阳落幕 提交于 2019-12-01 16:49:19
问题 When I use <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> for my struts 1.3.10 project, it throws following exception: org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:56) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:445) org.apache.jasper

In Struts1, how to use set-property tag inside action tag?

早过忘川 提交于 2019-12-01 13:03:20
I want to pass a value in action when it is called using struts1 configuration file. I have create a form bean with following property public class MyForm extends ActionForm { private String task; public String getTask() { return task; } public void setTask(String task) { this.task = task; } } In struts-config.xml, I have defined form bean and action as below. <form-bean name="myForm" type="demo.MyForm"></form-bean> <action path="/myAction" name="myForm" type="demo.MyAction" scope="request"> <set-property value="view" property="task" /> <forward name="success" path="/result.jsp"></forward> <

In Struts1, how to use set-property tag inside action tag?

依然范特西╮ 提交于 2019-12-01 10:16:19
问题 I want to pass a value in action when it is called using struts1 configuration file. I have create a form bean with following property public class MyForm extends ActionForm { private String task; public String getTask() { return task; } public void setTask(String task) { this.task = task; } } In struts-config.xml, I have defined form bean and action as below. <form-bean name="myForm" type="demo.MyForm"></form-bean> <action path="/myAction" name="myForm" type="demo.MyAction" scope="request">

How to emulate nested:root from Struts 1 in Struts 2?

核能气质少年 提交于 2019-11-29 16:36:57
I am working on converting a Struts1 app to Struts2. I have a jsp that has several JSP included. This included JSPs all have the nested:root tag on it. I have found little to nothing on this particular tag except that is similar to html:root , so I've added the include statement in my main JSP and I added the html:form to the sub JSPs but it didn't work. I had initially just added s:form to the sub JSPs and the code in the sub jsp was passed along but none of the tags existing in the sub JSP were processed. All nested tags and all Struts1 tags should be removed/replaced with equivalent Struts2

struts1.* 异常处理机制

爷,独闯天下 提交于 2019-11-29 15:21:09
几个重要类的说明 ActionServlet struts的核心类,用于初始化struts配置文件,处理发送到action的请求; ModuleConfig struts配置文件信息加载的接口,ModuleConfigImpl是接口的默认实现,可以完成基于配置信息的信息读、取操作。每个struts模块文件对应一个实例。 ActionConfig 用于存储action配置信息的实体,配置文件中每一个action对应一个ActionConfig。该类包含该action所在struts配置文件对应的ModuleConfig;它的子类ActionMapping很眼熟吧,action层方法的参数中都有它。 RequestProcessor 请求处理实体类负责处理Action拦截到的请求处理。 初始化加载 struts的启动加载类是ActionServlet,文如其名它是Servlet的扩展,因此初始化在init方法中执行。 public void init() throws ServletException { // Wraps the entire initialization in a try/catch to better handle // unexpected exceptions and errors to provide better feedback // to the

struts1 初始化流程说明

僤鯓⒐⒋嵵緔 提交于 2019-11-29 15:20:55
struts初始化起始于ActionServlet。正如其名,它是Servlet,按照Servlet的声明周期,struts的初始化放在了init方法之中。 public void init() throws ServletException { // struts初始化流程放入try/catch中,这样可以更好的处理未捕获的异常或错误 try { // 1. 初始化内部国际化信息 initInternal(); // 2. 判断convertNull,进行特殊类型转换器注册 initOther(); // 3. 获取当前serverlet的url-pattern initServlet(); // 4. 将自身(ActionServlet)放入Servlet上下文中 getServletContext().setAttribute(Globals.ACTION_SERVLET_KEY, this); // 5. 判断用户是否有自定义模块初始化功能,若存在注册到模块工厂 initModuleConfigFactory(); // 6. 初始化模块默认配置文件 ModuleConfig moduleConfig = initModuleConfig("", config); // 7. 初始化自定义国际化信息 initModuleMessageResources

How to emulate nested:root from Struts 1 in Struts 2?

…衆ロ難τιáo~ 提交于 2019-11-28 11:26:34
问题 I am working on converting a Struts1 app to Struts2. I have a jsp that has several JSP included. This included JSPs all have the nested:root tag on it. I have found little to nothing on this particular tag except that is similar to html:root , so I've added the include statement in my main JSP and I added the html:form to the sub JSPs but it didn't work. I had initially just added s:form to the sub JSPs and the code in the sub jsp was passed along but none of the tags existing in the sub JSP

基于struts1.框架的异常处理方案

不羁岁月 提交于 2019-11-27 03:23:54
首先感谢“郡主”对我的支持,她帮忙完善了跳转地址重定向问题。 1. 目标——什么异常需要我们处理 通常来说,在业务流程中已经将大部分异常进行处理,因为大部分异常是继承java.lang.Exception,所以开发人员在IDE环境中可以轻松识别并使用try catch语句块进行处理。但是别忘了java.lang.RuntimeException。 有很多常见的异常,如java.lang.NullPointerException、java.lang.IndexOutOfBoundsException,都是RuntimeException的子类,这类异常在IDE开发环境中不易判断,而且经常会导致意外的结果,这些异常正式是本文要处理的东西。 PS:不要小看java.lang.NullPointerException,在做单元测试的过程中,一半以上的失败结果都是它造成的,相信在每一个项目中它都是一个可怕的存在。 2. struts1框架对异常的处理支持 struts框架有两种异常处理方式:action的exception配置和global-exceptions配置 <action-mappings> <action path="/Test" scope="request" type="com.sg.LoginAction" parameter="method" > <forward

Migration from Struts 1 to Struts 2

落爺英雄遲暮 提交于 2019-11-26 04:27:37
问题 I am planning to migrate to the Struts 2 with the Struts 1 code base. I am not getting any good source to proceed on this migration. Could you please help on this approach? 回答1: S1 with S2 it will overkill. Both frameworks are complicated, so the maintenance costs increase twice or more time. So, the strategy is to migrate completely to S2. Both frameworks are implemented MVC pattern. Divide the application on three parts that should migrate separately: Model, Controller, and View. The order