Using Struts2 Tags to Formatting Numbers
Here you go : <s:property value=”getText(‘{0,number,#,##0.00}’,{profit})”/> This is how I format numbers in my projects. You can use it with <s:if> to attain what you require.
Here you go : <s:property value=”getText(‘{0,number,#,##0.00}’,{profit})”/> This is how I format numbers in my projects. You can use it with <s:if> to attain what you require.
In your struts.xml add: <constant name=”struts.action.excludePattern” value=”/ServletToExcludeFromStruts*”/> The value be comma delimited as well for multiple exclusions. See http://struts.apache.org/2.2.1/docs/webxml.html
Problem solved ! From the updated documentation, now the problem can be solved by using the new JakartaStreamMultiPartRequest : As from Struts version 2.3.18 a new implementation of MultiPartRequest was added – JakartaStreamMultiPartRequest. It can be used to handle large files, see WW-3025 for more details, but you can simple set <constant name=”struts.multipart.parser” value=”jakarta-stream” /> … Read more
If the goal is to prevent duplicate submission of forms then use token interceptor http://struts.apache.org/2.x/docs/token-interceptor.html or tokenSession interceptor http://struts.apache.org/2.x/docs/token-session-interceptor.html. If you simple want to refresh the page after submit without submitting again then redirect to action where you only show results not form. Use redirectAction result for that.
Yes it is possible, the solution requires the use of include/exclude parameters. Following is an example. Methods getJson1 and getJson2 show includeParameters while getJson3 shows excludeParameters. Note: Although the example uses strings as the arguments for include/exclude parameters the string is interpreted as a regular expression. So I could replace “string1, string2” on action3 with … Read more
In order to do this you may also need to set the filter to run on FORWARD (and INCLUDE as your code shows, although you state you want a FORWARD): <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> <!– If you want includes as well –> </filter-mapping>
The same way you can do it in Struts2, but instead of servlet you can use the action. For example @Action(value=”/PopulateStateList”, results=@Result(type=”json”, params = {“contentType”, “application/json”, “root”, “map”})) public class AjaxMapAction extends ActionSupport { Long countryId; //getter and setter Map<String, String> map=new HashMap<String, String>(); public Map<String, String> getMap() { return map; } @Override public String … Read more
Define global result in the package that other packages extend. For example <package name=”default” extends=”struts-default”> … <global-results> <result name=”error”>/pages/error_page.jsp</result> </global-results> … </package> This result could be used across actions that forward to error page and as exception handling result. If you are using conventions plugin with annotations you could define @Results annotation on the class … Read more
If you are not using GXP plugin, then remove it from classpath. The referenced class is org.apache.struts2.views.gxp.inject.InjectedObjectContainer absent in the distribution. But you could download it from the SVN repositories if required.
With the IteratorStatus object: <s:iterator value=”lis” status=”ctr”> <s:property /> <s:if test=”%{#request.str.equals(lis[#ctr.index])}”> -> This value from “lis” is equal to the value of “str” </s:if> <br/> </s:iterator> With the var parameter: <s:iterator value=”lis” var=”currentValue”> <s:property /> <s:if test=”%{#request.str.equals(#currentValue)}”> -> This value from “lis” is equal to the value of “str” </s:if> <br/> </s:iterator> With the top … Read more