struts

ModelDriven on struts 2

早过忘川 提交于 2019-12-23 03:28:30
问题 I am developing a project using hibernate, struts2 and spring, but my problems are with struts. I have created 3 classes extending ActionSupport and are implementing modeldriven for the same class in all of them. I have implemented some methods to be executed when the actions are called. The structure for the classes is like (Class1Action.java): public class Class1Action extends ActionSupport implements ModelDriven<ModelDrivenClass> { private ModelDrivenClass modelDrivenClass; // getter and

Struts 1 - struts-taglib.jar is not being found by my web application

不打扰是莪最后的温柔 提交于 2019-12-23 03:19:12
问题 I am using Struts-1 . I have developed a struts-based web application. I am using struts tags in my JSP pages supplied in struts-taglib.jar by inserting the following lines in the JSP file: <%@ taglib prefix="html" uri="http://struts.apache.org/tags-html" %> <%@ taglib prefix="logic" uri="http://struts.apache.org/tags-logic" %> <%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %> Now the application is working fine when I run it on my localsystem but when I deploy it on a

ActionRedirect migration to Struts 2

冷暖自知 提交于 2019-12-23 03:07:31
问题 I'm currently migrating a wepapp from Struts to Struts 2 and I'm experiencing some difficulties. I have some ActionRedirect with no extra parameters given to it and I don't know how to migrate it, maybe just return a string is efficient? For example I have this : return new ActionRedirect(mapping.getFindforward("failed"); Is it efficient to do that instead ? return "failed"; And when I have parameters how can i migrate it ? I'm working on that part since 2 days. 回答1: In Struts2 redirects are

Invoking methods in Action

情到浓时终转凉″ 提交于 2019-12-23 01:18:41
问题 I'm working on Struts web based application where I have created an action class with multiple methods in it. I invoke these methods based on the kind of task I want the application to perform. Could someone please tell me if I should use this technique to do so? Should I continue invoking the methods like I am or should I create separate action classes for every different action I want to perform? 回答1: One action class can have many actions, many methods, but you should map only one method

Why html checkbox function only works in IE but not in Firefox or Chrome?

限于喜欢 提交于 2019-12-23 01:04:34
问题 I'm debugging a JavaScript/JSP/Struts app, it has a checkbox, for advanced search, when it's checked, other 2 items are supposed to show up on the page for user to enter more info, yet this only works in IE, but not Firefox or Chrome, no response at all when it's checked on the other 2 browsers, why ? And how to make it work in all browsers ? <script type="text/javascript"> function checkAdvSearch(checked) { if(checked) { document.getElementById("searchTerm2").style.display = ''; document

Struts - Using multiple submit buttons for one form? (How to know which was clicked)

余生长醉 提交于 2019-12-22 23:47:44
问题 I have 3 buttons for a form I would like to submit. I'm new to struts and I was wondering, is there a way to find which button was clicked? In my html I have this <html:form action="myAction.jspa"> <div align="right"> <html:submit value="back" /> <html:submit value="continue Later" /> <html:submit value="submit" /> </div> </html:form> And in my Java Action class in the execute() method, I attempt using request.getParameter("back") to check if the back button has been pressed but it doesn't

Struts 1 Losing Request Parameters after Failed Form Validation with Multipart/Form-Data Enctype

泄露秘密 提交于 2019-12-22 20:27:31
问题 I have a simple Struts form. It has a few text fields and a file field. The enctype is multipart/form-data on my form. I validate in the actionform 's validate method. If the text fields are empty, I return errors that they are required. Along with the visible fields, I pass a few hidden fields that are needed as request params when the form is processed and returned to the JSP. The JSP needs these request params . Everything works great when there are no validation errors as the request

How to configure struts action to get parameters via post?

醉酒当歌 提交于 2019-12-22 14:01:45
问题 I'm new to Java EE and Struts2.so i need to find out how to configure struts action to get parameters via post? i had this code to get parameters directly from url like this: @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { response.setContentType("application/json;charset=UTF-8"); response.setHeader("Cache-Control", "no-cache"); response.setCharacterEncoding("UTF-8"); request

struts2-rest plugin..making both struts actions + rest actions work together but. giving java.lang.reflect.InvocationTargetException

混江龙づ霸主 提交于 2019-12-22 10:27:44
问题 I am converting my existing struts 2 application to serve through some rest based services also. I have used two plugins, struts2-rest plugin and struts-convention plugin, Along with these I have also used asm.jar because above was giving a class not found exception which was there in asm jar. I want to have both the functionalities as ..my normal struts action mappings should also work along with rest urls. struts.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache

Populate List<String> in struts2 from form data

大憨熊 提交于 2019-12-22 06:25:13
问题 I feel this should be exceedingly obvious, but so far I've failed to find an answer. I want to have a list of strings (or an array of strings, I really don't care) get populated by form data in Struts2. I've seen several examples of how to do indexed properties with beans, but wrapping a single string inside an object seems fairly silly. So I have something like public class Controller extends ActionSupport { private List<String> strings = new ArrayList<String>(); public Controller() {