- 浏览: 231713 次
- 性别:
- 来自: 河南
最新评论
-
wbbcz4426493:
文章写的不错。继续加油。
对IBatis分页的改进,使ibatis支持hibernate式的物理分页 -
robertzsl:
已经没用了,不过总结的还不错。
JS实现Html File控件赋值 -
liujunhao225:
感谢楼主,我遇到了同样的问题。相信看了你的文章一定可以解决。
dom4j解析xml-取消doctype中DTD验证设置 -
zyguo1006:
写的很好,例子很生动.
JavaScript之call()和apply() -
yyfmp3:
<beans xmlns="http://ww ...
对IBatis分页的改进,使ibatis支持hibernate式的物理分页
话说“天降大任于斯人也,必先苦其心志,劳其筋骨,饿其体肤”,同样,要想更深入的掌握一项技术,必先对其有持久的耐性,然后有遇见问题必解决问题的决心。废话少说,直接贴出异常:
java.rmi.RemoteException: EJB Exception: ; nested exception is:
java.lang.RuntimeException: Unexpected Exception
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:20
5)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef
.java:335)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef
.java:252)
at net.htjs.service.ejb.xtzc.XtZc_q4cz52_EOImpl_923_WLStub.makeRegister(
Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.remoting.rmi.RmiClientInterceptorUtils.doInvoke(R
miClientInterceptorUtils.java:102)
at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doI
nvoke(SimpleRemoteSlsbInvokerInterceptor.java:75)
at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.i
nvoke(AbstractRemoteSlsbInvokerInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
at $Proxy37.makeRegister(Unknown Source)
at net.htjs.web.actions.XtzcAction.doRegister(XtzcAction.java:128)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultA
ctionInvocation.java:404)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(Defa
ultActionInvocation.java:267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:229)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doInte
rcept(DefaultWorkflowInterceptor.java:221)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept
(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(V
alidationInterceptor.java:150)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterce
ptor.doIntercept(AnnotationValidationInterceptor.java:48)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept
(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.interc
ept(ConversionErrorInterceptor.java:123)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept
(ParametersInterceptor.java:167)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept
(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.inter
cept(StaticParametersInterceptor.java:105)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(Checkbox
Interceptor.java:83)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUp
loadInterceptor.java:207)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(
ModelDrivenInterceptor.java:74)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.inte
rcept(ScopedModelDrivenInterceptor.java:127)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at org.apache.struts2.interceptor.ProfilingActivationInterceptor.interce
pt(ProfilingActivationInterceptor.java:107)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.interce
pt(DebuggingInterceptor.java:206)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(Cha
iningInterceptor.java:115)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInt
erceptor.java:143)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(Pr
epareInterceptor.java:121)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept
(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(Ser
vletConfigInterceptor.java:170)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasI
nterceptor.java:123)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.inter
cept(ExceptionMappingInterceptor.java:176)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(Default
ActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTim
erStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionI
nvocation.java:221)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.j
ava:50)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.jav
a:504)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatc
her.java:419)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:42)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:3242)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
ervletContext.java:2010)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC
ontext.java:1916)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j
ava:1366)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
Caused by: java.lang.RuntimeException: Unexpected Exception
at weblogic.rmi.extensions.RemoteRuntimeException.writeReplace(RemoteRun
timeException.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1
004)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1036)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java
:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:13
47)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.jav
a:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at weblogic.rmi.extensions.server.CBVOutputStream.writeObject(CBVOutputS
tream.java:91)
at weblogic.rmi.internal.ServerRequest.unmarshalThrowable(ServerRequest.
java:349)
at weblogic.rmi.internal.ServerRequest.getThrowable(ServerRequest.java:6
2)
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:20
3)
... 123 more
Caused by: java.lang.ClassNotFoundException: com.opensymphony.xwork2.util.XWorkL
ist: This error could indicate that a component was deployed on a cluster memb
er but not other members of that cluster. Make sure that any component deployed
on a server that is part of a cluster is also deployed on all other members of t
hat cluster
at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:21
8)
at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:85
)
at weblogic.common.internal.WLObjectInputStream.resolveClass(WLObjectInp
utStream.java:61)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:154
4)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
699)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:19
08)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at weblogic.rmi.extensions.server.CBVInputStream.readObject(CBVInputStre
am.java:55)
at weblogic.rmi.internal.ServerRequest.copy(ServerRequest.java:261)
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:16
6)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef
.java:335)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef
.java:252)
at net.htjs.service.ejb.system.GaSystem_6uq8bi_EOImpl_923_WLStub.insertX
T_USER(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.remoting.rmi.RmiClientInterceptorUtils.doInvoke(R
miClientInterceptorUtils.java:102)
at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doI
nvoke(SimpleRemoteSlsbInvokerInterceptor.java:75)
at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.i
nvoke(AbstractRemoteSlsbInvokerInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
at $Proxy57.insertXT_USER(Unknown Source)
at net.htjs.service.bo.xtzc.impl.IBoXT_ZCXXImpl.makeRegister(IBoXT_ZCXXI
mpl.java:182)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:296)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
inpoint(ReflectiveMethodInvocation.java:177)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:144)
at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
at $Proxy59.makeRegister(Unknown Source)
at net.htjs.service.ejb.xtzc.XtZcBean.makeRegister(XtZcBean.java:227)
at net.htjs.service.ejb.xtzc.XtZc_q4cz52_EOImpl.makeRegister(XtZc_q4cz52
_EOImpl.java:71)
at net.htjs.service.ejb.xtzc.XtZc_q4cz52_EOImpl_WLSkel.invoke(Unknown So
urce)
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:17
4)
... 123 more
从异常信息中,很明显能看到是因为XWorkList类找不到的异常,这还不简单,把这个类加入ClassPath中不就搞定吗,事实上没那么简单
异常出现的场景
在A项目中的EJB去调用B项目中EJB时,传递的参数是由A项目中Struts2的Action自动封装的实体属性,在实体中包含有一个List类型的属性,在List类型的属性中存储的是String类型的值,在A项目中直接将该属性作为参数传递给B项目中的EJB接口方法,在调用B项目EJB时,就抛出以上异常。(太绕了,都把人看晕了,没办法,表达能力差)
问题解析
经过不断google,不断的log,怎么都找不到哪儿会少XWorkList类,我的EJB端使用的是Spring和IBatis,不会用到什么XWorkList啊,可明明报的就是EJB异常啊,会是什么问题呢,无意中将Action自动封装的实体属性中的List属性类型打印出来看看,看这个List到底是个什么类型(只有这个List是从Web端传递过来的),哈哈,祸害终于找到,原来这个List是个XWorkList类型,郁闷得出去抽根烟
回来了将XWork包放入EJB的classpath,可启动时就报错,先不看什么错误,想一想也不对啊,EJB端和XWork有什么关系,删除掉,直接对实体中的XWorkList转换成ArrayList,经过测试,OK,异常无影了
就这问题搞了我两天,差点放弃,不过在即将崩溃的尽头,将问题解决也是一大快事,在这里贴出来希望能对大家有所帮助
相关推荐
在Action中,你需要创建一个`List<File>`或`List<UploadBean>`(其中UploadBean包含`File`、`String`和`String`属性)来接收文件。在表单中,使用多个`<input type="file">`标签。 ### 配置与限制 Struts2允许你...
在Struts2中实现文件上传,你需要在Action类中添加一个`List<ultipartFile>`类型的属性,这将用于接收上传的文件。例如: ```java public class UploadAction extends ActionSupport { private List<ultipartFile>...
接下来,我们需要配置Struts2的Action类来接收上传的文件。在Action类中,我们将使用Apache的Commons FileUpload库来处理多部分请求。首先,在`struts.xml`配置文件中,为Action指定一个接收多部分请求的拦截器: `...
同样,需要在`struts.xml`中为下载Action添加映射。 **4. 结束语** Struts2提供了一种简洁的方式来实现文件上传和下载功能。通过使用`Apache Commons FileUpload`库,我们可以轻松地处理文件流,从而实现文件的...
- **结果**:`result`元素用于定义Action执行成功后转向的目标页面,本例中为`/next.jsp`。 2. **创建对应的Action文件** - 按照传统Struts框架的做法,在项目的`webRoot`目录下创建一个名为`go.action`的空文件...
当我们要使用JSON时,需要配置Struts2的配置文件(struts.xml),在这里声明Action和对应的Result类型。 Struts2提供了JSON插件来支持JSON数据的处理。要启用这个插件,需要在struts.xml中引入相应的配置: ```xml...
- Struts2允许通过`<param>`节点在配置文件中为Action的属性注入值,如`<param name="savePath">/images</param>`。 6. **配置文件组织**: - 为了保持`struts.xml`配置文件的整洁,可以使用`<include>`元素将...
- 在Struts配置文件中定义Action,可以使用Spring的依赖注入来实例化Action类,并配置其属性。 3. **视图层集成** - 使用JSP页面作为视图层,通过EL表达式和JSTL标签库来显示数据。 4. **拦截器配置** - 可以...
若无复用逻辑,可在自己的Service中为每个Action创建单独的处理方法。Action调用的Service方法应与Action同名,这里指的是Struts配置中的名称,而非Action类的类名。 3. Action分类:Action分为两类。一类处理实体...
3. **配置Struts2过滤器**: 最后,配置Struts2的过滤器`StrutsPrepareAndExecuteFilter`,让它处理所有以`*.action`结尾的请求。 ```xml <filter-name>struts2 <filter-class>org.apache.struts2.dispatcher.ng...
为了在欢迎文件中调用Struts Action,可以在Structs配置文件中为被调用的Action创建一个全局的转发项: ```xml ``` 然后创建一个`welcome.jsp`文件,并将其配置为欢迎文件: ```xml <welcome-file-list> ...
在使用Struts2框架时,可以通过Struts2提供的表单标签来简化复选框的处理过程。 ##### 4.1 学生选课例子 ```xml <s:checkboxlist name="studentModel.cids" list="courseList" listKey="cid" listValue="cname" /> ...
WEB-INF下的applicationContext.xml为Spring的配置文件,struts-config.xml为Struts的配置文件,file-upload.jsp为文件上传页面,file-list.jsp为文件列表页面。 本文后面的章节将从数据持久层->业务层->Web层的...
portletURL.setParameter("struts_action", "/ext/news/columnadmin/view"); portletURL.setParameter("columnId", columnId); ``` 然后,使用这个 URL 和标题行创建 SearchContainer: ```java SearchContainer<T>...