Configuring JDeveloper 11g to use Struts 2

本文详细介绍了如何在 JDeveloper 11g 中手动配置 Web 项目以使用 Struts2 框架。从创建项目到添加必要的库文件,再到配置 struts.xml 文件和 web.xml 文件,最后实现简单的 Struts2 功能。

原文地址:http://203.208.33.132/search?q=cache:hSQNtuQxaqEJ:theblasfrompas.blogspot.com/2009/04/configuring-jdeveloper-11g-to-use.html+jdeveloper+struts2&cd=2&hl=zh-CN&ct=clnk&gl=cn&st_usg=ALhdy297q-NfZGbk_ZlYjK3n6mE45UIvdA

 

I was recently asked how to setup JDeveloper 11g web projects to use Struts 2 here is what I did to get this working. Keep in mind JDeveloper has design time support for Struts 1.x but not Struts 2 so this is a manual process.

1. Start Jdeveloper 11g
2. Select File | New | General | Applications | Generic Application
3. Name the application "Struts2Demo" and click next
4. Name the project "Demo" and press finish

Now at this point we want to add a simple JSP page to the project so
we end up with a web project , we will need to configure this to use
struts2 manually which we will do soon.

5. Right click on the project and select "New | Web Tier | JSP"
6. call the JSP "sayhello.jsp" and append "/pages" to the end of
the directory path so it creates the JSP in a sub directory called
"pages".

At this point you will need to download the Struts libraries. At a minimum,
you will need to put the following in your WEB-INF/lib directory of your
JDeveloper project:

* struts2 -core.jar (The framework itself)
* xwork.jar (Struts 2 is built on the XWork 2 framework)
* ognl.jar (Object Graph Notation Language is used throughout the framework)
* freemarker.jar (Freemarker is used to create UI tag templates in Struts 2)
* commons-logging.jar (Used to log to log4j or JDK logging)

Download struts2 from here. I am using 2.1.6 here.

http://struts.apache.org/download.cgi

7. Refresh the navigator to ensure your project shows the WEB-INF/lib folder
and the required struts2 libraries.
8. Double click on the project to invoke project properties dialog and
select "Libraries/Classpath"
9. Add the 5 jars files to the project and press OK. You could create
a single library and add the 5 JAR files to that library if you like.

Now we are ready to configure our project to use struts2 .

10. Open up the web.xml and add the following entries


<? xml version = '1.0' encoding = 'windows-1252' ?>
< web-app xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version = "2.5"
xmlns = "http://java.sun.com/xml/ns/javaee" >
< description > Empty web.xml file for Web Application </ description >
< filter >
< filter-name > struts2 </ filter-name >
< filter-class > org.apache.struts2 .dispatcher.FilterDispatcher </ filter-class >
</ filter >
< filter-mapping >
< filter-name > struts2 </ filter-name >
< url-pattern > /* </ url-pattern >
</ filter-mapping >
< session-config >
< session-timeout > 35 </ session-timeout >
</ session-config >
< mime-mapping >
< extension > html </ extension >
< mime-type > text/html </ mime-type >
</ mime-mapping >
< mime-mapping >
< extension > txt </ extension >
< mime-type > text/plain </ mime-type >
</ mime-mapping >
</ web-app >


11. Create a java class as follows


package demo . struts2 . action ;

import com . opensymphony . xwork2 . ActionSupport ;

public class ExampleAction extends ActionSupport
{
private String message ;

public String execute () throws Exception
{
this . message = "Hello from Struts 2" ;
return SUCCESS ;
}

public void setMessage ( String message )
{
this . message = message ;
}

public String getMessage ()
{
return message ;
}
}


12. Struts places its configuration in a struts.xml file. Create the file
at the root of your source folder for the project as follow. We’ll need
to add our new action to the struts.xml file.


<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">

< struts >
<!-- Configuration for the default package. -->
< package name = "default" extends = "struts-default" >
< action name = "ExampleAction" class = "demo.struts2 .action.ExampleAction" >
< result name = "success" > /pages/sayhello.jsp </ result >
</ action >
</ package >
</ struts >


13. Finally ensure the "sayhello.jsp" looks as follows


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType = "text/html;charset=windows-1252" %>
<%@ taglib uri = "/struts-tags" prefix = "s" %>
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=windows-1252" />
< title > sayhello</ title >
</ head >
< body >
< h2 >< s:property value = "message" /></ h2 >
</ body >
</ html >



Now we need to add the Struts2 tag library to our project.

14. Double click on the project to invoke the project properties and
select "JSP Tag Libraries"
15. Click the "Add" button
16. Select "Project" and then press the "New" button
17. Navigate to "public_html/WEB-INF/lib/struts2 -core.jar" and
press 'Open"
18. Verify it finds "Struts tage 2.2.3".
19. Press OK
20. Again double click on the project to invoke the project properties
and select "Java EE Application" and set the context root to "struts2demo"
and press Ok
21. Select File | save All
22. Select Build | Demo.jpr to ensure it compiles fine.
23. Navigate to the default domain directory LIB folder of the integrated server
and add the 5 JAR files we need for struts 2

eg: D:/jdev11g-boxer/jdeveloper /jdev/system11.1.1.0.31.52.05/DefaultDomain/lib

commons-logging-1.0.4.jar
freemarker-2.3.13.jar
ognl-2.6.11.jar
struts2 -core-2.1.6.jar
xwork-2.1.2.jar

Now JDeveloper doesn't provide support for running struts2 applications so you
will need to create some sort of index.jsp page which will redirect to our action
we created. Here we will just run the JSP and then alter the URL to invoke
your action so that the view page will render correctly.

23. Right click on "sayhello.jsp" and select "Run" to start the Integrated
WLS.

You will notice it displays nothing , that is due to the fact we have not
run the actual action which we do by altering the URL as follows

http://127.0.0.1:7101/struts2demo/ExampleAction.action

Note: I am not 100% sure why I need to add the struts2 JAR files to
the defualt domain LIB folder of my WLS server as I would expect it to find
those files in the WEB-INF/lib directory of the application which is how
struts1 works and I believe how struts2 should work. I even went back
to JDeveloper 10.1.3 and found that indeed it works there without
having to manilpulate it's classpath which proves the files in WEB-INF/lib
of the application is all that is needed.

 

配置注意事项:


1. jdeveloper现在还不支持直接运行strut2,所以需要手动配置

2. 写struts.xml时候, 在jdeveloper要建立一个普通的xml文件, 不可以使用new-struts-(struts-config.xml) 这样写进去是根据1的规范来定的, 所以加入新的tag会运行有问题.

3. 在添加jsp文件的时候, 同样要把文中提到的struts lib 2.2.3加进去, 这个才是strut2的lib, 否则也运行不了. 原因同1.


这个例子按照我下面配置注意的设置好以后可以运行


代码下载地址: https://pan.quark.cn/s/a4b39357ea24 在计算机视觉技术中,数据集扮演着训练和评估模型的核心角色。Labelme作为一个广受欢迎的开源工具,能够支持用户以交互方式对图像进行标注,而COCO(Common Objects in Context)则是一种被广泛采纳的数据集标准格式,适用于包括物体检测、图像分割在内的多种任务。本文将详细阐述如何将Labelme生成的标注数据转换为COCO数据集的标准格式。 Labelme标注的图像在输出为JSON格式时,会包含以下核心内容: 1. `version`: 指明JSON文件的版本信息。 2. `flags`: 目前未定义或保持为空,预留用于未来的功能扩展。 3. `shapes`: 列表形式存储对象的形状信息,每个形状项包含`label`(对象类别名称),`points`(构成对象边缘的多边形顶点),以及`shape_type`(通常为“polygon”)。 4. `imagePath`和`imageData`: 提供原始图像的存储路径和二进制数据,便于后续图像的还原。 5. `imageHeight`和`imageWidth`: 明确标注图像的垂直和水平尺寸。 COCO数据集的标准格式中定义了三种主要的标注类型: 1. Object instances(目标实例):主要用于执行物体检测任务。 2. Object keypoints(目标上的关键点):适用于人体姿态估计相关应用。 3. Image captions(看图说话):用于生成图像的文本描述。 COCO的JSON结构中包含以下基本组成部分: 1. `images`:记录图像的基本属性,包括`height`(高度)、`...
内容概要:本文围绕基于Basisformer模型的时间序列锂离子电池SOC(State of Charge,荷电状态)预测展开研究,利用PyTorch深度学习框架构建并训练模型,旨在提升锂电池SOC估计的准确性与鲁棒性。该方法融合Transformer架构的核心机制,通过引入基函数(Basis)分解策略,有效捕捉电池充放电过程中长时序、非线性动态特征,增强模型对复杂工况的适应能力。研究不仅详细阐述了Basisformer的网络结构设计、注意力机制优化与训练流程,还提供了完整的Python代码实现方案,涵盖数据预处理、模型搭建、损失函数定义、训练验证及结果可视化等环节,便于科研人员快速复现、调优并拓展至其他电池状态预测任务。; 适合人群:具备一定深度学习与Python编程基础,熟悉PyTorch框架,从事电池管理系统(BMS)、新能源汽车、储能系统、智能传感等领域的高校研究生、科研人员及工程技术人员。; 使用场景及目标:①应用于动力电池与储能系统的实时SOC估算模块,提升系统安全性与能量利用效率;②作为学术研究的基础模型,用于复现、改进基于Transformer的时间序列预测方法在电化学系统中的应用;③为数据驱动的电池健康状态(SOH)、剩余使用寿命(RUL)联合估计提供可扩展的技术框架。; 阅读建议:建议读者结合所提供的代码与公开电池数据集(如NASA、CALCE等)进行动手实践,深入理解模型的输入输出结构与时序建模逻辑,同时可尝试引入温度、老化周期等多维特征,或融合物理模型构建混合预测架构,以进一步提升预测精度与泛化能力。
内容概要:本文系统阐述了基于动态规划算法优化插电式混合动力电动汽车(PHEV)能源管理的技术方案,结合Matlab与Simulink工具实现完整的仿真建模与代码开发。通过动态规划这一全局优化方法,在已知驾驶循环条件下,精确求解发动机、电机及电池之间的最优能量分配策略,以实现燃油消耗与排放的最小化目标,解决PHEV多能源路径规划中的复杂决策问题。文中提供了详尽的仿真模型构建流程与算法实现步骤,涵盖车辆动力学建模、能量管理架构设计、状态空间定义、代价函数构造、最优控制律求解及结果可视化分析等关键环节,全面揭示PHEV能量管理系统的内在机制与优化逻辑。; 适合人群:具备一定Matlab/Simulink编程基础,从事新能源汽车、智能控制、电力电子、自动化或交通运输工程等相关领域的研究生、科研人员及工程技术人员,尤其适合专注于车辆能量管理策略、节能控制算法研究的专业人士。; 使用场景及目标:①深入掌握动态规划在混合动力汽车能量管理中的理论基础与工程实现方法;②学习如何在Matlab/Simulink环境中搭建PHEV整车仿真平台并实施多目标优化仿真;③为学术研究、学位论文撰写或实际工程项目提供可复用的算法框架、模型模板与技术支持,支撑后续对等效燃油消耗最小化策略(ECMS)、模型预测控制(MPC)、实时优化算法等的对比研究与性能评估。; 阅读建议:建议读者结合所提供的完整代码与Simulink模型文件,逐模块调试运行,重点理解状态变量离散化处理、前后向递推求解过程、惩罚项设置以及边界条件处理等核心技术细节,同时可进一步拓展应用于不同工况场景、不同车型结构或与其他优化算法(如庞特里亚金极小值原理PMP)的对比验证,从而深化对PHEV能量管理实时性与全局性平衡问题的理解。
内容概要:本文围绕基于多虚拟同步发电机(VSG)的独立微网系统,开展多目标二次控制策略的MATLAB/Simulink建模与仿真研究。通过构建包含多个VSG单元的独立微网系统,设计并实现了能够同时实现频率与电压的无静差恢复、有功/无功功率精确分配以及环流有效抑制的综合控制目标的二次控制方法。研究重点在于控制策略的整体架构设计、关键控制模块的数学建模及其在Simulink环境中的精细化实现,通过大量仿真实验验证了所提控制策略在不同工况下的有效性、动态响应性能及系统鲁棒性。; 适合人群:具备电力系统分析、自动控制理论及现代电力电子技术等专业知识背景,熟悉MATLAB/Simulink仿真工具,从事新能源发电、微电网运行与控制、分布式能源系统集成等相关领域的科研人员、工程技术人员及高校研究生。; 使用场景及目标:① 深入掌握多VSG独立微网系统的建模方法与稳定性分析要点;② 理解并复现兼顾静态精度与动态品质的多目标二次协同控制算法;③ 为新型微网控制保护装置的研发及先进控制策略的工程化应用提供可靠的仿真验证平台和技术储备。; 阅读建议:学习者应在巩固电力系统基础理论的前提下,重点关注控制算法的设计逻辑、各控制环节间的耦合关系以及Simulink模块的搭建技巧,建议通过调整系统参数、设置不同的负载投切与故障扰动工况进行反复仿真,以深刻理解控制策略的内在机理与适应能力。
【通用视觉框架】基于Qt+Halcon开发的仿Visionmaster的通用视觉框架软件,全套源码,开箱即用 1.1 背景 ​ 本项目软件开发意图为实现对Halcon、Opencv算子及其它视觉软件的便捷使用,由于Halcon和Opencv使用相比VisionPro较为麻烦,故此本软件仿照海康VisionMaster的流程图式操作,实现对Halcon、Opencv及其它视觉软件的二次开发。 2.1 软件概述 本软件使用Qt框架进行开发,实现对视觉流程的自由搭配,市场上对标海康威视的VisionMaster; 本软件使用插件化开发框架,可使用提供的二次开发库自行添加新功能算子和新模块(将生成的插件放置到对应目录下即可); 2.2 功能概述: 视觉流程图式编程:实现对视觉/数据处理算子的自由编程,从而实现各类复杂的视觉需求 项目读取保存:将编程的视觉项目进行保存或者读取 图像显示:主界面中可以显示及监控视觉算子的图像处理情况 日志消息显示:显示软件运行过程中出现的日志消息 多语言:可进行多种语言切换 2.3 开发平台 主开发语言:Qt(C++) C++语言标椎:C++17 开发环境:Window/Linux 编程平台:Qt Creator 编译器: |版本 | MSVC | Qt 6.4.0 MSVC2019 64bit | | Mingw | Qt 6.4.0 MinGW 64-bit | 视觉工具:Halcon19.11 Progress X64 资源介绍请查阅:https://blog.csdn.net/m0_37302966/article/details/146980317 更多视觉框架资源:https://blog.csdn.net/m0_37302966/article/details/146583453
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值