struts

Combining Mapped properties with Indexed properties in Struts

℡╲_俬逩灬. 提交于 2019-11-29 16:50:00
I'm trying to have a dynamic form and, depending on an attribute type, I would like to display a different input style (textfield, radio buttons, dropdown, checklist, ...). In order to have the dynamic form, I've set up the ActionForm with a Map. Map<String, Object> values; public void setValue(String key, Object value); public Object getValue(String key); My problem comes when I try to set up a checklist or multibox. The ActionForm only passes one value, although I would have expected that the String[] would be mapped to the Object argument. Any idea about how can I solve this? EDIT: in the

The problems in error handling using Struts validation framework

怎甘沉沦 提交于 2019-11-29 16:06:45
I have following defined in struts-config.xml: <struts-config> <form-beans> <form-bean name="LoginForm" type="com.actionform.LoginForm"/> </form-beans> <action-mappings> <!-- action for login --> <action input="/views/login.jsp" name="LoginForm" path="/Login" scope="session" type="com.actions.LoginAction" parameter="method" validate="true"> <forward name="success" path="/views/Frameset.html" /> </action> </action-mappings> <message-resources parameter="/WEB-INF/ApplicationResources"/> <!-- ========================= Validator plugin ================================= --> <plug-in className="org

Struts2 select tag - Dynamically add options

a 夏天 提交于 2019-11-29 08:52:13
I'm working on migrating a Struts1 project to Struts2. And I have encountered the following piece of code. <html:select ...> <logic:iterate id="something" name="" type=""> <logic:equal name="something" property="" value=""> <html:option value=""><bean:write ... /></html:option> </logic:equal> </logic:iterate> </html:select> It checks the value in the iterator and add options to the select list dynamically if the condition is met. How can I achieve something similar with Struts2 select tag. AFAIK, Struts2 select tag won't even work properly with plain html option tag. Indeed Struts2 select tag

How to integrate an old Struts application with Spring 3.x

戏子无情 提交于 2019-11-29 07:37:04
i was wondering how to and what the prefered way of integrating an Struts 1.x application with Spring 3.x so we can benefit from the IOC stuff. Use ContextLoaderPlugin and set the struts controller to the processorClass " AutowiringRequestProcessor " like this (in struts-config.xml): <controller> <set-property property="processorClass" value="org.springframework.web.struts.AutowiringRequestProcessor" /> </controller> <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"> <set-property property="contextConfigLocation" value="/WEB-INF/config/action-servlet.xml"/> </plug-in>

Spring security tags in sitemesh decorator

北城余情 提交于 2019-11-29 07:15:19
I want to use a few tags of the spring security tag library inside the decorator file of site-mesh. However content inside these tags is never shown. Can anyone tell me why this is? Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <%@taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> <html xmlns="http://www.w3.org/1999/xhtml"> <!--HTML--> <form id="login_form" method=

MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection

时光总嘲笑我的痴心妄想 提交于 2019-11-29 06:07:00
I built an web application and deployed locally working perfect. I deployed it on a remote server and started getting the : exception > javax.servlet.ServletException: could not execute query org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:518) org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421) >root cause >org.hibernate.exception.JDBCConnectionException: could not execute query org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74) org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) org

Spring MVC与Struts比较

情到浓时终转凉″ 提交于 2019-11-29 05:22:03
Struts2与SpringMVC 都是比较优秀,也是被广泛使用的Web开发框架,那么他们之间有什么区别呢?今天小博老师就跟大家来讨论下这个问题。 Struts工作流程图 Struts与Spring 之间主要有以下几点区别: 1、Struts2是类级别的拦截, 一个类对应一个request上下文。 SpringMVC 是方法级别的拦截,一个方法对应一个request上下文,而方法同时又跟一个url对应,所以说从架构本身上SpringMVC就容易实现restful url,而struts2的架构实现restful比较困难。因为Struts2中Action的一个方法可以对应一个url,而其类属性却被所有方法共享,这也就无法用注解或其他方式标识其所属方法了。 2、SpringMVC的方法之间基本上是独立的,独享request response数据,请求数据通过参数获取,处理结果通过ModelMap交回给框架,方法之间不共享变量。而Struts2方法之间也虽然是独立的,但其所有Action变量是共享的,一个Action对象对应一个request上下文。 3、由于 Struts 2需要针对每个request进行封装,把request,session等servlet生命周期的变量封装成一个一个Map,供给每个Action使用,并保证线程安全,所以在原则上,是比较耗费内存的。 4、

How to prevent JPA from rolling back transaction?

假如想象 提交于 2019-11-29 04:09:21
Methods invoked: 1. Struts Action 2. Service class method (annotated by @Transactional) 3. Xfire webservice call Everything including struts (DelegatingActionProxy) and transactions is configured with Spring. Persistence is done with JPA/Hibernate. Sometimes the webservice will throw an unchecked exception. I catch this exception and throw a checked exception. I don't want the transaction to roll back since the web service exception changes the current state. I have annotated the method like this: @Transactional(noRollbackFor={XFireRuntimeException.class, Exception.class}) public ActionForward

Populate Collection from Struts2 Form Submission

我是研究僧i 提交于 2019-11-29 04:01:53
问题 I'm trying to populate a List of beans from a form: public class Foo { public String attr1; public String attr2; } public class Bar { public List<Foo> foos; } public class StrutsAction extends Action { public Bar bar; } So in my Struts2 form, what's the best way to populate Foo? Intuitively, I want to do: <input type="hidden" name="bar.foos.attr1" /> but that isn't working and would cause collisions. I'm sure the answer is very simple and I'm overlooking it. 回答1: If I understand it correctly,

POST method getting converted to GET in IE-9

北城余情 提交于 2019-11-29 03:42:37
I have this line of code in my JSP. (I'm using struts 1.3) <html:form action="screening/mine.do" method="post"> . . . </html:form> When the action corresponding to mine.do is invoked (using struts-config.xml), the page is getting submitted as GET instead of POST. All the request parameters including the required ones are getting lost due to this. This issue occcurs only in IE-9. The response remains as POST when I use other versions of IE or any other browsers. How do I make the response to remain as POST in IE-9 ? EDIT : I observed one more issue in this. Whenever the page is rendered in a