struts2

Struts2 <s:checkbox> with 'value=“true” not rendered as preselect if has Angular `ng-model`

那年仲夏 提交于 2021-02-20 04:10:51
问题 I have observed a very peculiar behavior of <s:checkbox> rendering along with Bootstrap 3 and AngularJS. I have these two <s:checkbox> in my page, wrapped by some elements of Bootstrap 3 styles: <div class="col-md-1"> <div class="form-group"> <div class="form-other"> <label for="activaCheck"><s:text name="actividad.busqueda.activa"/></label> <s:checkbox class="form-control" id="activaCheck" name="activaCheck" ng-model="formData.activaCheck" value="true"></s:checkbox> <s:checkbox class="form

Not able to upload large files

流过昼夜 提交于 2021-02-19 08:35:07
问题 I would like to upload large amount of image file (max size 10mb) for that I am using following configuration is struts.xml <interceptors> <interceptor-stack name="fileUploadStack"> <interceptor-ref name="exception" /> <interceptor-ref name="alias" /> <interceptor-ref name="servletConfig" /> <interceptor-ref name="prepare" /> <interceptor-ref name="i18n" /> <interceptor-ref name="chain" /> <interceptor-ref name="debugging" /> <interceptor-ref name="profiling" /> <interceptor-ref name=

Errors in Stuts2 appfuse app in Eclipse

杀马特。学长 韩版系。学妹 提交于 2021-02-19 07:24:17
问题 I have build a Stuts2 multimodule app using Appfuse archetype from Eclipse Juno. It works fine when ran through MVN Jetty:run . But When I try to validate the project in Eclipse , it is giving me so many errors I am going to copy the errors here can someone please help me resolve them? Getting Error : Syntax error on token ""><s:param><s:text name="", ; expected in src/main/webapp/scripts/login.js Syntax error on token "<", invalid MultiplicativeExpression line 34 in src/main/webapp/scripts

How to choose a value of a HashMap in select Struts2?

回眸只為那壹抹淺笑 提交于 2021-02-19 03:54:26
问题 I ran into a problem with Struts2. I have a HashMap<String, Integer> that I use in a form with a select to choose name and corresponding id to that name. HashMap iterates and populates my <select> list with names. I only need an id to pick. How do I pick an id/value instead of a name/key? companyMap is a HashMap , where <String, Integer> or key, value. companyName is a String. <s:select label="Pick the company name" headerKey="-1" headerValue="Select Company name" list="companyMap.keys" name

Struts2 preselected checkboxlist

一曲冷凌霜 提交于 2021-02-19 03:48:06
问题 I have tried all the sollutions in similar cases that I found, but with no luck. My jsp. <s:checkboxlist list = "positionsMap" listKey = "%{key.toString()}" listValue = "%{value}" name = "selectedPositions" value = "positionName" label = "Position" /> positionsMap is a Hashmap with key positionId and value positionName . selectedPositions is a list filled with the prechecked positions. Tested with debugger and has the correct value taken from database. positions is a list with id and name. So

Custom 404 error page not working with Struts 2

北战南征 提交于 2021-02-17 02:47:13
问题 I am converting a JSP/Servlet dynamic web project to Struts 2 and the custom error pages (that previously worked with the JSP/Servlet version) have stopped working. When I induce a 404 error by accessing a non-existent page like abc.jsp , it throws below exception: SEVERE: Servlet.service() for servlet jsp threw exception The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed

Validation exception in struts2 action

余生长醉 提交于 2021-02-15 03:14:55
问题 I have some Action class and try to add a form with validation. But every time when I tried to do it I have got an exception. Action class code: public void validate() { if (name == null || name.trim().equals("")) { addFieldError("name", "The name is required"); } if (surname == null || surname.trim().equals("")) { addFieldError("surname", "Age must be in between 28 and 65"); } } Form code: <s:form action="addnew" method="POST"> <s:textfield label="Name: " name="name"/> <s:textfield label=

Multiple submit buttons in Struts 2 form tag

与世无争的帅哥 提交于 2021-02-13 12:44:10
问题 I'm trying to point a button in my form tag to a different action/action class than the form but it won't work. I read in another thread that this is due to a bug in Struts 2 and that struts.mapper.action.prefix.enabled"="true" should be set, so I did it but it's still the same. I can use a different action pointing to a different method of the same action class that the form is using but when I try specifying a different action class it doesn't work. This works, (jsp) <s:form action="print">

Multiple submit buttons in Struts 2 form tag

为君一笑 提交于 2021-02-13 12:41:47
问题 I'm trying to point a button in my form tag to a different action/action class than the form but it won't work. I read in another thread that this is due to a bug in Struts 2 and that struts.mapper.action.prefix.enabled"="true" should be set, so I did it but it's still the same. I can use a different action pointing to a different method of the same action class that the form is using but when I try specifying a different action class it doesn't work. This works, (jsp) <s:form action="print">

Multiple submit buttons in Struts 2 form tag

本秂侑毒 提交于 2021-02-13 12:41:31
问题 I'm trying to point a button in my form tag to a different action/action class than the form but it won't work. I read in another thread that this is due to a bug in Struts 2 and that struts.mapper.action.prefix.enabled"="true" should be set, so I did it but it's still the same. I can use a different action pointing to a different method of the same action class that the form is using but when I try specifying a different action class it doesn't work. This works, (jsp) <s:form action="print">