struts-action

Struts 2: parameters between Actions

只愿长相守 提交于 2019-11-27 13:16:40
问题 I have the following question: I need to pass a parameter (for example ID ) when I finish a form and the action save the form's values, this will forward to the result = "success" and I need that the action that will be call in the success come with the ID and other parameters to later use in the next form for save this information (info-form2 and info.form1)... for example: FORM1 ( USER ) ==== "success" ====> FORM2 ( ADDRESS ) userForm.html ===================> addressForm.html?user_id=X ...

Struts2: method attribute in <s:submit> button doesn't work

旧街凉风 提交于 2019-11-26 21:01:11
问题 I have a form in jsp. There are two submit buttons: "Search" and "Add New" button. I had set each button with their own method attribute. <s:form name="searchForm" action="employeeAction" method="post"> <s:textfield name="id" label="Employee ID"/> <s:textfield name="name" label="Employee Name"/> <s:submit value="Search" method="doSearch"/> <s:submit value="Add New" method="doAddNew"/> </s:form> In struts.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software

Is it best practice to map multiple actions to the same class struts 2.3 [closed]

六眼飞鱼酱① 提交于 2019-11-26 18:37:00
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 12 months ago . I am developing contact manager in struts with options(add,delete,modify,print). I am thinking to map multiple actions(map multiple actions to the same class struts 2.3) to the same class( ContactManager ). I want to know whether it is correct or whether there is need to

Should I retrieve database record in Struts2 view layer?

别等时光非礼了梦想. 提交于 2019-11-26 17:58:04
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 tried to retrieve the subject lit and level lit and store them as the request attribute in the action

How to use parameters, request and session objects present in ActionContext?

大城市里の小女人 提交于 2019-11-26 15:31:44
Here in this code I am using ActionContext to get Session and ServletActionContext from Request object. I feel this is bad practice, as one must use ActionContext only for Request object. Is ActionContext's Request object equivalent to the Request object in Servlets ? If yes, how to get request parameters using it ? Map session = (Map) ActionContext.getContext().getSession(); HttpServletRequest request = ServletActionContext.getRequest(); String operatorId = request.getParameter("operatorId"); session.put("OperatorId", operatorId); // getting hashmap from Bean analysisNames=

How to use parameters, request and session objects present in ActionContext?

别说谁变了你拦得住时间么 提交于 2019-11-26 04:27:42
问题 Here in this code I am using ActionContext to get Session and ServletActionContext from Request object. I feel this is bad practice, as one must use ActionContext only for Request object. Is ActionContext\'s Request object equivalent to the Request object in Servlets ? If yes, how to get request parameters using it ? Map session = (Map) ActionContext.getContext().getSession(); HttpServletRequest request = ServletActionContext.getRequest(); String operatorId = request.getParameter(\"operatorId