struts

Populate List<String> in struts2 from form data

ε祈祈猫儿з 提交于 2019-12-22 06:25:10
问题 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() {

Struts 2 validation not working properly as application grows

和自甴很熟 提交于 2019-12-22 00:14:11
问题 Is there any alternative validation framework while building complex web app? Or any guide for validation. Links to example is not required as it working on simple Form but not in complex Form with multiple links. This is my action class package com.tpc.action; import java.util.ArrayList; import java.util.List; import com.opensymphony.xwork2.ActionSupport; import com.tpc.domain.LeadFacultyModel; import com.tpc.service.LeadFacultyServiceInterface; public class LeadFacultyAction extends

Struts2, best practice for using method={1}

岁酱吖の 提交于 2019-12-21 05:44:12
问题 I'm new to Struts 2 and I've come across this syntax (recommended in the tutorial). <action name="Register_*" method="{1}" class="Register"> <result name="input">/member/Register.jsp</result> <result type="redirectAction">Menu</result> </action> I understand that it calls Register.{1} method. The problem is a user could put in another (random) value and cause a 500 error (which would correctly be logged as an error). How can this be prevented? 回答1: First of all it won't call the Register.{1}

Tomcat Hot Deploy to instance hosting several applications

て烟熏妆下的殇ゞ 提交于 2019-12-21 05:12:04
问题 My question is about deployment to a Tomcat server instance which hosts multiple applications and hosts application contexts for Struts, Spring, and Hibernate. I would like to deploy changes to one application without restarting my Tomcat server. As an example, many times in our firm we have to deploy new applications or versions of applications to our tomcat enviroment and the process could be: Move class and jsp to the exploded folder then the context reload itself, or Another scenario is

TagLib tag in web.xml is not found ERROR

谁说胖子不能爱 提交于 2019-12-21 05:08:19
问题 I show the error in detail as follows. cvc-complex-type.2.4.a: Invalid content was found starting with element 'taglib'. One of '{"http://java.sun.com/xml/ns/javaee":description,"http://java.sun.com/xml/ns/javaee":display-name, "http://java.sun.com/xml/ns/javaee":icon,"http://java.sun.com/xml/ns/javaee":distributable"http:// java.sun.com/xml/ns/javaee":context-param, "http://java.sun.com/xml/ns/javaee":filter, "http:// java.sun.com/xml/ns/javaee":filter-mapping, "http://java.sun.com/xml/ns

What does the path get from the server by getRealPath () in jsp

你。 提交于 2019-12-20 07:41:19
问题 I am using struts 1.3,jsp for developing application. I want to know what following code will return path from the server. path = getServlet().getServletContext().getRealPath("/") +"images\\logos\\"+ formFile.getFileName(); What will be the path from the server.Can i use this path for showing image on the page. 回答1: First of all: getRealPath is deprecated. (compare: Interface ServletRequest). You should try this instead (since spec 2.1): ServletContext context = session.getServletContext();

Generate image and display it inside JSP along with other content

岁酱吖の 提交于 2019-12-20 07:29:57
问题 I'm using JFreeChart to generate a dynamic chart depending on the user input. I have a JSP with some textbox and combobox, the user makes the input and submits it, and the Action process it, generating an image of a chart. I need to display this image on the same JSP as before, below the textbox/combobox. If I use response.setContentType("image/jpeg"); etc... then I get a page with the image alone. I thought of saving the image to a file and then access it with <img > , but I'm not sure that

Java page re-direct

只愿长相守 提交于 2019-12-20 06:17:03
问题 What I want to do is go to a disclaimer page when they first initially hit this method, and then any time after that go to a different page. My current method just takes to me the disclaimer page. Let me know if furthur explanation is needed...thanks!!! public int show(Action action) throws Exception { HttpServletRequest request = action.getRequest(); action.setJspURI("htemp.jsp"); return FORWARD; } Basically I need to add an If to go to a page the first time it hits this method I guess like

why does struts reset my form after failed validation?

五迷三道 提交于 2019-12-20 05:49:04
问题 I am using the validation framework with Struts 1.1.When validation fails, the entire form is reset. After much time scouring the net, I have gathered: When a new request is received, the form object is created if it does not exist in the current scope (request or session). Reset is called() Form values are populated from the bean properties. Validation starts if enabled If validation fails, ActionErrors are returned and the request is directed to the URI given by the input attribute of the

Parameter “method” not working (Struts 1)

南笙酒味 提交于 2019-12-20 05:23:24
问题 I have the following action declared in my struts.xml: <action path="/updateAccountInfo" type="org.myCompany.UpdateAccountAction" name="myAccountForm" scope="session" validate="true" parameter="method" input="/updateAccountInfo.jsp"> <forward name="success" path="/updateAccountInfo.jsp" /> </action> In my JSP page, I have the following form: <html:form action="/updateAccountInfo.do"> <input type="hidden" name="method" value="sendMessage" /> In my java class, I have the following method: