struts-action

Passing variable number of parameters from form in to action in struts 2

感情迁移 提交于 2020-01-15 04:42:26
问题 I am using struts2 in my application and have a form in a jsp which is submitted to a action class. The number of input fields in the form can vary at runtime and hence the action class can not have fixed setter and getter for the parameters. I am trying to capture these variable number of inputs in a single action class. I want to know if its possible via Struts 2 and if it is how can i do it ? I am aware of the input field names in the form (input field names populated via iterator in the

There is no Action mapped for namespace [/] and action name [viewBooks] associated with context path [/SampleTC_test]. - [unknown location]

五迷三道 提交于 2020-01-04 05:59:30
问题 I know that there are several other threads with the same error, but trust me, non of them helped me in solving my issue. I have a web application built on Java using Struts2 version struts-2.3.16 and Hibernate. My issue is, in my application I have struts.xml, because of it's huge size i split it into three xml files. One is main struts.xml which contains two include tag which points out to two different strtus-XXX.xml file's of the same application. My problem is that only one struts-XXX

There is no Action mapped for namespace [/] and action name [viewBooks] associated with context path [/SampleTC_test]. - [unknown location]

对着背影说爱祢 提交于 2020-01-04 05:59:04
问题 I know that there are several other threads with the same error, but trust me, non of them helped me in solving my issue. I have a web application built on Java using Struts2 version struts-2.3.16 and Hibernate. My issue is, in my application I have struts.xml, because of it's huge size i split it into three xml files. One is main struts.xml which contains two include tag which points out to two different strtus-XXX.xml file's of the same application. My problem is that only one struts-XXX

Giving an empty json result while executing struts 2 action class

寵の児 提交于 2019-12-30 11:51:33
问题 Im trying to retrieve data from DB using hibernate ORM and get the out-put as json result using Struts2. Everything work up to retrieving data from DB, but for the json result I get only {} . I think I have done something wrong with my coding. But need some help to figure it out. Here is my Action class : @ParentPackage("json-default") public class SocialIconsAction extends ActionSupport { private List<TiendayaCurrencies> _currency; public List<TiendayaCurrencies> getCurrency() { return

Struts 2 Execute action instead of welcome file

不羁的心 提交于 2019-12-24 11:12:22
问题 I'm working on a Struts 2 application and I want to execute an action (in fact I'm interested more on executing an interceptor) instead of simply showing a welcome file. What is the best way to achieve this? Thanks in advance! 回答1: Either redirect to the action from the welcome file, or use the action URL as a welcome file entry. To do the latter, you'll likely need to set dispatcher elements on the element: <filter-mapping> <dispatcher>REQUEST</dispatcher> etc. Add FORWARD, INCLUDE, and

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

Should I retrieve database record in Struts2 view layer?

帅比萌擦擦* 提交于 2019-12-17 04:07:36
问题 I have a edit page in which I want to retrieve the subjects and levels from database and display as select option for user to edit the course . When the form is submitted, it will make a new request , the user input is captured by courseBean with XML validation. When the XML validation failed, it will forward with the courseBean which just captured the user input to the edit.jsp . So every time I go the edit.jsp , I will retrieve the database records. Should I do it in that way? Besides, I

Explanation of “.action” extention significance in Struts2 URL

試著忘記壹切 提交于 2019-12-08 05:47:23
问题 This might be a useless or lame question but please explain me this. In struts2 when we assign an action to a form button and click on that button, that action is called. Now, when the result of the action file is displayed, the URL in browser shows localhost:8080/HelloWorld/ClassName.action Sometimes by default .action part doesn't show. But both works the same. I am required to explain to someone what is significance of this .action . Why is that extension shown in URL and is there some

struts 2 file upload without struts tags

爱⌒轻易说出口 提交于 2019-12-07 23:10:33
问题 Do I need to make use the struts tags <s:form action="doUpload" method="post" enctype="multipart/form-data"> <s:file name="upload" label="File"/> <s:submit/> </s:form> to make use of File upload functionality that struts 2 is providing ? Can I achieve the same functionality without struts 2 tags ? if yes can i know the conventions need to be incorporated in action or in configuration files to achieve the same ? 回答1: Shortly, yes, you can. Then the configuration and conventions used by the

ModelDriven on struts 2

≯℡__Kan透↙ 提交于 2019-12-07 03:07:36
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 setter for modelDrivenClass public String methodName() { System.out.println("Entrou!"); return SUCCESS;