Re: The different output with Date whether the Http request have application/json

2023-12-03 Thread Yasser Zamani
Hi,

Thanks for reaching out!

Could you please try setting your desired value to Struts constant 
"struts.json.dateformat" and see if any change happens? Or try 
https://stackoverflow.com/a/59471917?

Regards,
Yasser



From:  
Sent: Saturday, December 2, 2023 4:21 PM
To: user@struts.apache.org
Subject: The different output with Date whether the Http request have 
application/json

Hi all:

  I am new of use struts framework , and when I have a request with no
application/json to my app which use Struts framework having json
plugin , The Date Object return is something like
“2015-05-04T10:08:15+00:00” which is RFC 3339 format , Its fine .

  But when I have request with header have application/json , The Date
Object return is something like 1701522508943 . I believe which
represent the millionseconds since January 1, 1970, 00:00:00 GMT . But
how ?  I didn’t see any article mention it . And I didn’t get any tips
from source code . The DefaultJSONWriter seems not doing this ?

  Can someone tell me how and which java class turn the Date Object to
number and sent to front ?

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts 6.3 tags do not automatically evaluate the value field against the ognl stack

2023-11-28 Thread Yasser Zamani
lt;#include 
"/${parameters.templateDir}/${parameters.expandTheme}/scripting-events.ftl" /> 
<#include 
"/${parameters.templateDir}/${parameters.expandTheme}/common-attributes.ftl" /> 
<#global evaluate_dynamic_attributes = true/> <#include 
"/${parameters.templateDir}/${parameters.expandTheme}/dynamic-attributes.ftl" 
/> /><#rt/> <#rt/>
${itemValue}<#t/>



Kind Regards,

Nate

-Original Message-
From: Lukasz Lenart 
Sent: Saturday, 25 November 2023 15:04
To: Nate Kerkhofs 
Cc: Struts Users Mailing List 
Subject: Re: Struts 6.3 tags do not automatically evaluate the value field 
against the ognl stack

Hello Nate,

I approved your message but to get replies from the members of the Struts User 
group please subscribe to the list [1] [1] https://struts.apache.org/mail.html

Cheers
Lukasz

pt., 24 lis 2023 o 16:32 Yasser Zamani  napisał(a):
>
> Hi Nate,
>
> Thanks for reaching out!
>
> What I can't understand is how your app evaluates the value. Because I see 
> the following in Struts UIBean.java since 2006:
>
> // see if the value was specified as a parameter already
> if (parameters.containsKey("value")) {
> parameters.put("nameValue" , parameters.get("value"));
> } else {
>
> which I think means that it doesn't evaluate value if you've already set it. 
> As far as I remember Struts evaluates name to calculate value if it's not 
> already set.
>
> Don't you have some specific magic in your app? Could you please see also 
> Struts logs for any WARN message?
>
> Regards,
> Yasser
>
> 
> From: Nate Kerkhofs 
> Sent: Friday, November 24, 2023 3:23 PM
> To: user@struts.apache.org
> Subject: Struts 6.3 tags do not automatically evaluate the value field
> against the ognl stack
>
> Greetings,
>
> I am currently upgrading a Struts 2.5 project to Struts 6.3, and I ran into 
> an issue with Struts 6.3 tags not evaluating the value against the ognl 
> stack. I have reproduced this issue both with the radio map included in the 
> struts2-core jar and with a custom radiomap.ftl, and also with an s:textfield 
> instead of an s:radio. In both cases, the value attribute on the source page 
> doesn't get resolved against the ognl stack, instead using the string literal 
> entered in the value attribute.
>
> I have about 140 s:radio components formatted like below, with "locked" being 
> a Boolean field in the Action java controller:
>
>   label="%{getText('label.projectStream.locked')}"
> list="lockedOptionMap" id="locked" name="locked" value="locked" />
>
> In this case, none of the radios with a value set are setting their checked 
> status based on the boolean value because parameters.nameValue doesn't get 
> evaluated by ognl. If I remove the value attribute or make it an explicit 
> ognl expression using %{}, it does resolve the attribute against the ognl 
> stack and select the right item, but with the code above, the value got 
> resolved against the ognl ValueStack in 2.5, but that doesn't happen in 6.3. 
> Instead, it just sets nameValue to "locked" or whatever string literal 
> "value" is set to.
>
> I cannot find any mention of this breaking change in the migration guide, 
> though I did find an issue dating back to 2007 mentioning a similar problem: 
> https://issues.apache.org/jira/browse/WW-1907 which means that this either is 
> a regression or it a deliberate design decision to no longer evaluate this 
> property against the ognl stack.
>
> Either way, I'd like to know whether this is an intentional change, and if so 
> what the recommended way is to use a field on the ognl stack to configure the 
> value of a field: should I add an explicit %{} evaluation symbol around the 
> value attribute, or should I just leave out the value attribute entirely, 
> instead relying solely on the name attribute set on the tag?
>
> Kind regards,
>
> Nate Kerkhofs
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
B�CB��[��X��ܚX�KK[XZ[�\�\�][��X��ܚX�P��]˘\X�K�ܙ�B��܈Y][ۘ[��[X[��K[XZ[�\�\�Z[��]˘\X�K�ܙ�B


Re: Struts 6.3 tags do not automatically evaluate the value field against the ognl stack

2023-11-24 Thread Yasser Zamani
Hi Nate,

Thanks for reaching out!

What I can't understand is how your app evaluates the value. Because I see the 
following in Struts UIBean.java since 2006:

// see if the value was specified as a parameter already
if (parameters.containsKey("value")) {
parameters.put("nameValue" , parameters.get("value"));
} else {

which I think means that it doesn't evaluate value if you've already set it. As 
far as I remember Struts evaluates name to calculate value if it's not already 
set.

Don't you have some specific magic in your app? Could you please see also 
Struts logs for any WARN message?

Regards,
Yasser


From: Nate Kerkhofs 
Sent: Friday, November 24, 2023 3:23 PM
To: user@struts.apache.org
Subject: Struts 6.3 tags do not automatically evaluate the value field against 
the ognl stack

Greetings,

I am currently upgrading a Struts 2.5 project to Struts 6.3, and I ran into an 
issue with Struts 6.3 tags not evaluating the value against the ognl stack. I 
have reproduced this issue both with the radio map included in the struts2-core 
jar and with a custom radiomap.ftl, and also with an s:textfield instead of an 
s:radio. In both cases, the value attribute on the source page doesn't get 
resolved against the ognl stack, instead using the string literal entered in 
the value attribute.

I have about 140 s:radio components formatted like below, with "locked" being a 
Boolean field in the Action java controller:




In this case, none of the radios with a value set are setting their checked 
status based on the boolean value because parameters.nameValue doesn't get 
evaluated by ognl. If I remove the value attribute or make it an explicit ognl 
expression using %{}, it does resolve the attribute against the ognl stack and 
select the right item, but with the code above, the value got resolved against 
the ognl ValueStack in 2.5, but that doesn't happen in 6.3. Instead, it just 
sets nameValue to "locked" or whatever string literal "value" is set to.

I cannot find any mention of this breaking change in the migration guide, 
though I did find an issue dating back to 2007 mentioning a similar problem: 
https://issues.apache.org/jira/browse/WW-1907 which means that this either is a 
regression or it a deliberate design decision to no longer evaluate this 
property against the ognl stack.

Either way, I'd like to know whether this is an intentional change, and if so 
what the recommended way is to use a field on the ognl stack to configure the 
value of a field: should I add an explicit %{} evaluation symbol around the 
value attribute, or should I just leave out the value attribute entirely, 
instead relying solely on the name attribute set on the tag?

Kind regards,

Nate Kerkhofs

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



S2-064: CVE-2023-34396: Apache Struts: DoS via OOM owing to no sanity limit on normal form fields in multipart forms

2023-06-14 Thread Yasser Zamani
Affected versions:

- Apache Struts through 2.5.30
- Apache Struts through 6.1.2

Description:

Allocation of Resources Without Limits or Throttling vulnerability in Apache 
Software Foundation Apache Struts.This issue affects Apache Struts: through 
2.5.30, through 6.1.2.

Credit:

Matthew McClain (finder)

References:

https://cwiki.apache.org/confluence/display/WW/S2-064
https://struts.apache.org/
https://www.cve.org/CVERecord?id=CVE-2023-34396


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



S2-063: CVE-2023-34149: Apache Struts: DoS via OOM owing to not properly checking of list bounds

2023-06-14 Thread Yasser Zamani
Affected versions:

- Apache Struts through 2.5.30
- Apache Struts through 6.1.2

Description:

Allocation of Resources Without Limits or Throttling vulnerability in Apache 
Software Foundation Apache Struts.This issue affects Apache Struts: through 
2.5.30, through 6.1.2.

Credit:

Matthew McClain (finder)

References:

https://cwiki.apache.org/confluence/display/WW/S2-063
https://struts.apache.org/
https://www.cve.org/CVERecord?id=CVE-2023-34149


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Mirgrating to struts 2.5.30 from 2.3.37

2023-05-17 Thread Yasser Zamani

Hi Rohan,

Looks like something in logon.jsp is evaluated to null and you get 
NullPointerException. So I think firstly you need to debug jsp and see 
what's the root cause. If it's from Struts or not.


Regards,
Yasser

On 5/18/2023 8:29 AM, Rohan Patil7 wrote:

Hi team,

Earlier, we have upgraded from struts 2.3.37 to 2.5.30 and it was working fine, 
but later on we starting setting error as below and we stop seeing login page 
of our application

StackTrace of error:

[5/18/23 0:49:41:612 EDT] 008a ServletWrappe I 
com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [EDMClient] 
[/EDMClient] [/pageComponents/logon.jsp]: Initialization successful.
[5/18/23 0:49:41:632 EDT] 008a   I 
com.ibm.icm.chl.console.tools.SessionListener sessionCreated  HTTP Session 
"jEolWoRsMzFRf9mx__cZUCb" Created at Thu May 18 00:49:41 EDT 2023
[5/18/23 0:49:41:723 EDT] 008a ServletWrappe E 
com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: An exception 
was thrown by one of the service methods of the servlet 
[/pageComponents/logon.jsp] in application [EDMClient]. Exception created : 
[java.lang.NullPointerException
   at com.ibm._jsp._logon._jspService(_logon.java:536)
   at 
com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
   at 
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1235)
   at 
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
   at 
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
   at 
com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
   at 
com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)
   at 
com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:220)
   at 
com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:143)
   at 
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:78)
   at 
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:979)
   at 
com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1119)
   at 
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1408)
   at 
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:198)
   at 
org.apache.tiles.request.servlet.ServletRequest.forward(ServletRequest.java:265)
   at 
org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:228)
   at 
org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57)
   at 
org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
   at 
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
   at 
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397)
   at 
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238)
   at 
org.apache.tiles.TilesContainerWrapper.render(TilesContainerWrapper.java:103)
   at 
org.apache.tiles.impl.mgmt.CachingTilesContainer.render(CachingTilesContainer.java:126)
   at 
org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:158)
   at 
org.apache.struts2.result.StrutsResultSupport.execute(StrutsResultSupport.java:206)
   at 
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:375)
   at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:279)
   at 
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:250)
   at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
   at 
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:179)
   at 
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
   at 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
   at 
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
   at 
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:49)
   at 

Re: New warning message with V6.1.1 - SecurityMemberAccess...

2023-01-04 Thread Yasser Zamani
You would have .disabled somewhere in your own app code ognl 
expressions, I would guess. Could you please search for .disabled there? 
Or put a break-point at [1] and see what ognl, how and why are trying to 
access UIBean.disabled non-public member!


Regards

[1] 
https://github.com/apache/struts/blob/master/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java#L99


On 1/3/2023 11:09 PM, Ralph Grove wrote:

I just upgraded from Struts2 2.5.3 to 6.1.1 .  After a few tweaks (mostly 
related to Bootstrap5), the application is running correctly, but it’s 
generating a new warning message (always 4 times):

[WARN ] 2023-01-03 14:20:08 [https-jsse-nio-8443-exec-186] SecurityMemberAccess 
- Access to non-public [protected java.lang.String 
org.apache.struts2.components.UIBean.disabled] is blocked!
[WARN ] 2023-01-03 14:20:08 [https-jsse-nio-8443-exec-186] SecurityMemberAccess 
- Access to non-public [protected java.lang.String 
org.apache.struts2.components.UIBean.disabled] is blocked!
[WARN ] 2023-01-03 14:20:08 [https-jsse-nio-8443-exec-186] SecurityMemberAccess 
- Access to non-public [protected java.lang.String 
org.apache.struts2.components.UIBean.disabled] is blocked!
[WARN ] 2023-01-03 14:20:08 [https-jsse-nio-8443-exec-186] SecurityMemberAccess 
- Access to non-public [protected java.lang.String 
org.apache.struts2.components.UIBean.disabled] is blocked!


The message is a result of the execution of this tag:
   

The variables are setup by the action class shown below, which forwards to the 
JSP containing the s:radio tag.

It seems to be working correctly, but the warning messages are puzzling. Does 
anyone know why the warnings are appearing?

Thanks,
Ralph Grove

--

public class UserSetupAction extends ActionSupport {

 private static final Logger logger = 
LogManager.getLogger(UserSetupAction.class);
 
 private String userId;
 
 private String firstName;

 private String lastName;
 private Calendar lastActivity;
 private Boolean projectAdmin;
 private Boolean systemAdmin;
 private char status;
 private Calendar statusDate;
 
 private Map statuses;


 @Override
 public String execute() throws SQLException {
 try {
 User user = UserPersistence.getUser(userId);
 
 firstName = user.getFirstName();

 lastName = user.getLastName();
 lastActivity = user.getLastActivity();
 projectAdmin = user.getProjectAdmin();
 systemAdmin = user.getSystemAdmin();
 status = user.getStatus();
 statusDate = user.getStatusDate();
 
 statuses = User.getStatusMap();
 
 return SUCCESS;

 } catch (Exception e) {
 logger.error("USA.execute(): ", e);
 return ERROR;
 }
 }
 
 public String getUserId() {

 return userId;
 }
 
 public void setUserId(String userId) {

 this.userId = userId;
 }
 
 public String getFirstName() {

 return firstName;
 }
 
 public void setFirstName(String firstName) {

 this.firstName = firstName;
 }
 
 public String getLastName() {

 return lastName;
 }
 
 public void setLastName(String lastName) {

 this.lastName = lastName;
 }
 
 public Calendar getLastActivity() {

 return lastActivity;
 }
 
 public void setLastActivity(Calendar lastActivity) {

 this.lastActivity = lastActivity;
 }
 
 public Boolean getProjectAdmin() {

 return projectAdmin;
 }
 
 public void setProjectAdmin(Boolean projectAdmin) {

 this.projectAdmin = projectAdmin;
 }
 
 public Boolean getSystemAdmin() {

 return systemAdmin;
 }
 
 public void setSystemAdmin(Boolean systemAdmin) {

 this.systemAdmin = systemAdmin;
 }
 
 public char getStatus() {

 return status;
 }
 
 public void setStatus(char status) {

 this.status = status;
 }
 
 public Calendar getStatusDate() {

 return statusDate;
 }
 
 public void setStatusDate(Calendar statusDate) {

 this.statusDate = statusDate;
 }
 
 public Map getStatuses() {

 return statuses;
 }
 
 public void setStatuses(Map statuses) {

 this.statuses = statuses;
 }
 
}



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: When Struct 2.3.34 update Struct 2.5.30,the original interface cannot be accessed

2022-09-12 Thread Yasser Zamani




On 9/10/2022 9:27 AM, wwyyzz_001 wrote:

"login" action is defined in default namespase."success" result is defined 
inglobal-results,result type is json.


Where in which package you've defined the global-results? Could you 
share please its definition? Have you extended strus-default?



Invokehttp://localhost:8080/wisdomcampus-gs/user/login  is ok in 
Struts2.3.34.
But it is not ok in Structs 2.5.30,Structs throw exception(Could not find 
action or result) in 
DefaultActionInvocation.executeResult(DefaultActionInvocation.java:377)
Error log is :
2022-09-09 18:32:16 [http-nio-8080-exec-1] DEBUG SecurityMemberAccess:67 - 
Checking access for [target: wisdom.user.action.LoginAction@3fd415d2, member: 
public
final java.lang.String wisdom.common.JsonActionBase.execute() throws 
java.lang.Exception, property: null]
2022-09-09 18:32:16 [http-nio-8080-exec-1] DEBUG InstantiatingNullHandler:98 - 
Entering nullPropertyValue [target=[wisdom.user.action.LoginAction@3fd415d2, 
com.
opensymphony.xwork2.DefaultTextProvider@e405047], property=locale]
2022-09-09 18:32:16 [http-nio-8080-exec-1] DEBUG I18nInterceptor:124 - After 
action invocation Locale=null
2022-09-09 18:32:16 [http-nio-8080-exec-1] WARN Dispatcher:613 - Could 
not find action or result: /wisdomcampus-gs/login
com.opensymphony.xwork2.config.ConfigurationException: No result defined for 
action wisdom.user.action.LoginAction and result success


This log line shows that the action is successfully resolved, but for 
some reason Struts cannot find global result 'success' for it. Are you 
sure that you've defined 'success' as a global result? TBH it's a bit 
strange I think to define 'success' as global result. Could you please 
explicitly define a result 'success' for that action specifically? just 
to see if problem is with global-results.


Regards

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Not able to get Array of Objects values from one Action class to another

2022-07-13 Thread Yasser Zamani

Hi,

Thanks for reaching out!

I think it will work, but only for simple objects like strings and 
numbers. Are they simple object and it doesn't work? then please provide 
your jsp and action related portions. If not, then I think you likely 
should use session to store complex objects.


Regards.

On 7/13/2022 6:12 PM, Shambhavi R wrote:

Hi,


I'm not able to get the array of objects from one Action Class to another
in Struts 2.5.

In short, the flow goes like this:

Action Class A ---> JSP ---> Action Class B

I have the array of Objects in Action Class A and I'm able to get those
values in the JSP redirected from Action Class A.

On clicking a submit in the JSP, the execute() method of Action class B
gets executed and the Array of Objects in Action class B are always null.

I have getters and setters in both the Action Classes for the Array.



Usually, to get values from one Action class to another, using hidden
properties in the JSP works. But it does not work in the case of Array of
Objects.


I want to know how to get the Array of Object values in Action Class B.


Thanks,

Shambhavi



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Problem with Struts 6.0 and Bootstrap plugin

2022-06-24 Thread Yasser Zamani
I think you should keep the global 'output_format' unset.

Regards.

On 2022/06/23 21:07:44 Ralph Grove wrote:
> I’m working on a Struts application that uses the Struts Bootstrap plugin. I 
> upgraded it to Struts V6 by installing theses libs:
> 
> commons-fileupload-1.4.jar
> commons-lang3-3.10.jar
> freemarker-2.3.31.jar
> log4j-api-2.17.2.jar
> ognl-3.3.2.jar
> struts2-core-6.0.0.jar
> 
> commons-text-1.8.jar
> log4j-1.2-api-2.17.0.jar
> log4j-core-2.17.0.jar
> 
> struts2-bootstrap-plugin-4.0.1.jar
> 
> 
> The application now serves static content with no problem, but whenever a 
> form that uses bootstrap is accessed, this error message results:
> 
> [ERROR] 2022-06-23 16:52:19 [https-jsse-nio-8443-exec-70] runtime - Error 
> executing FreeMarker template
> freemarker.core._MiscTemplateException: Template inclusion failed (for 
> parameter value "/template/~~~bootstrap/controlheader-core.ftl"):
> Syntax error in template "template/~~~bootstrap/controlheader-core.ftl" in 
> line 51, column 44:
> Using ?html (legacy escaping) is not allowed when auto-escaping is on with a 
> markup output format (HTML), to avoid double-escaping mistakes.
> 
> (Stack trace follows below).
> 
> 
> Here’s the source code for a test page that I put up to demonstrate the 
> problem:
> 
> <%@page contentType="text/html" pageEncoding="UTF-8" errorPage="error.jsp" %>
> <%@page import="org.personalitypad.utility.Config" %>
> <%@page import="org.personalitypad.utility.JspLogger" %>
> <%@page import="org.apache.log4j.Logger" %>
> 
> <%@taglib prefix="s" uri="/struts-tags" %>
> <%@taglib prefix="sj" uri="/struts-jquery-tags" %>
> <%@taglib prefix="sb" uri="/struts-bootstrap-tags" %>
> 
> 
> 
> 
> 
> 
> http://www.w3.org/1999/xhtml;>
> 
> Personality Pad | Test
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Test
> 
>  cssClass="form-vertical">
> 
>  label="Email Address"
> name="userId"
> size="50"
> maxlength="50"
> tooltip="Enter the email address with which you 
> registered." />
> 
>  label="Password"
> name="password" />
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> I would appreciate any suggestions for how to fix this.
> 
> Thanks,
> Ralph Grove
> 
> 
> 
> FTL stack trace ("~" means nesting-related):
>   - Failed at: #include "/${parameters.templateDir}/...  [in template 
> "template/~~~bootstrap/controlheader.ftl" at line 21, column 1]
>   - Reached through: #include "/${parameters.templateDir}/...  [in 
> template "template/bootstrap/text.ftl" at line 21, column 1]
> 
>   at freemarker.core.Include.accept(Include.java:164) 
> ~[freemarker-2.3.31.jar:2.3.31]
>   at freemarker.core.Environment.visit(Environment.java:347) 
> ~[freemarker-2.3.31.jar:2.3.31]
>   at freemarker.core.Environment.visit(Environment.java:353) 
> ~[freemarker-2.3.31.jar:2.3.31]
>   at freemarker.core.Environment.include(Environment.java:2955) 
> ~[freemarker-2.3.31.jar:2.3.31]
>   at freemarker.core.Include.accept(Include.java:171) 
> ~[freemarker-2.3.31.jar:2.3.31]
>   at freemarker.core.Environment.visit(Environment.java:347) 
> ~[freemarker-2.3.31.jar:2.3.31]
>   at freemarker.core.Environment.visit(Environment.java:353) 
> ~[freemarker-2.3.31.jar:2.3.31]
>   at freemarker.core.Environment.process(Environment.java:326) 
> ~[freemarker-2.3.31.jar:2.3.31]
>   at freemarker.template.Template.process(Template.java:383) 
> ~[freemarker-2.3.31.jar:2.3.31]
>   at 
> org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:154)
>  ~[struts2-core-6.0.0.jar:6.0.0]
>   at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:588) 
> ~[struts2-core-6.0.0.jar:6.0.0]
>   at org.apache.struts2.components.UIBean.end(UIBean.java:547) 
> ~[struts2-core-6.0.0.jar:6.0.0]
>   at 
> org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:40)
>  ~[struts2-core-6.0.0.jar:6.0.0]
>   at 
> org.apache.jsp.WEB_002dINF.jsp.test_jsp._jspx_meth_s_005ftextfield_005f0(test_jsp.java:452)
>  ~[?:?]
>   at 
> org.apache.jsp.WEB_002dINF.jsp.test_jsp._jspx_meth_s_005fform_005f0(test_jsp.java:397)
>  ~[?:?]
>   at 
> org.apache.jsp.WEB_002dINF.jsp.test_jsp._jspService(test_jsp.java:224) ~[?:?]
>   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:71) 
> ~[jasper.jar:9.0.43]
>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) 
> ~[servlet-api.jar:4.0.FR]
>   at 
> 

Re: struts.ognl.expressionMaxLength

2022-04-03 Thread Yasser Zamani

Hi Ralph,

Thanks for using this feature!

Yes you're right. Struts uses OGNL not only for user's expressions, but 
also internally for its internal purposes :( and unfortunately, this 
feature cannot distinguish between them.


By the way, according to our security reports so far, 200 should be a 
good maximum [1]. That being said, we don't have a known attack vector 
less than 200 characters yet. 30 is too safe, however ;) Unfortunately, 
by now we don't and can't know what length Struts itself needs owing to 
complexity of different situations. I would say try 100, it should be 
enough. But as per [1], try to not use a value larger than 200.


Thanks again!

Regards,
Yasser.

[1] 
https://github.com/apache/struts/blob/4746a49d177baee9d99acd243c2aec627828b2bc/core/src/main/resources/org/apache/struts2/default.properties#L240


On 4/2/2022 11:12 PM, Ralph Grove wrote:

After revising my code, I reduced the maximum OGNL expression length to 30, 
since the longest expression remaining in my code is 28 characters.

 

This, however, triggers another exception:

[ERROR] 2022-04-02 14:34:51 [https-jsse-nio-8443-exec-9] OgnlValueStack - Could 
not evaluate this expression due to security constraints: 
[#attr['s2b_form_element_class’]]

Evidently there are some automatically generated OGNL expressions with length 
longer than 30. What’s a reasonable minimum expression length that will 
accommodate these?

Thanks,
Ralph




On Mar 30, 2022, at 2:17 AM, Lukasz Lenart  wrote:

wt., 29 mar 2022 o 17:14 Ralph Grove  napisał(a):


I found the problem - I had neglected to include the leading spaces of the 
continuation line when calculating the expression length. They were converted 
to tabs in my editor, which made the expression shorter. Putting the expression 
on a single line eliminates the exception.

Original source:



Ok, I was suspecting so after inspecting the stack trace. Anyway I
would put such logic in the action or model, like this:

JSP:


Java class:
public class Participant {
  ...
  public boolean isNoSurveyResponse() {
return checklist <= 2 || surveyResponse == null;
  }
}


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Date Type Converter strange behavior

2021-04-26 Thread Yasser Zamani
Hi thanks for reaching out!

I don't remember and should check that your desired behavior used to work or 
not but as a quick answer I think you're looking for Class wide conversion [1] 
e.g. @TypeConversion(type = ConversionType.APPLICATION, property = 
"java.util.Date", DateConverter.class)?

Regards.

[1] https://struts.apache.org/core-developers/type-conversion-annotation.html

On 2021/04/25 20:02:47, M Huzaifah  wrote: 
> Hy guys,
> 
> i found somethin strange with StrutsTypeConverter.
> let say i have a converter like this:
> 
> 
> //-- begin DateConverter class ---
> import java.text.ParseException;
> import java.text.SimpleDateFormat;
> import java.util.Date;
> import java.util.Map;
> 
> import javax.annotation.PostConstruct;
> 
> import org.apache.commons.lang.ArrayUtils;
> import org.apache.commons.lang.StringUtils;
> import org.apache.struts2.util.StrutsTypeConverter;
> 
> public class DateConverter extends StrutsTypeConverter {
>   
>   private  String shortDateFormat;
>   
>   @PostConstruct
>   public void loadFormat() {
>   this.shortDateFormat = "dd/MM/";
>   }
> 
>   @SuppressWarnings("unused")
>   @Override
>   public Object convertFromString(Map arg0, String[] arg1, Class arg2) {
>   
>   System.out.println("begin converter");
> 
>   if(ArrayUtils.isEmpty(arg1) || StringUtils.isEmpty(arg1[0])) {
>   return null;
>   }
> 
>   Date date = null;
>   
>   try {
>   //cek kalo formatnya dd/MM/ hh:mm:ss
>   if(arg1[0].contains(" ")) {
>   this.shortDateFormat = "dd/MM/ hh:mm:ss";
>   date = new 
> SimpleDateFormat(shortDateFormat).parse(arg1[0]);
>   }else {
>   date = new 
> SimpleDateFormat(shortDateFormat).parse(arg1[0]);
>   }
>   }catch (ParseException e) {
>   System.out.println("DateConverter StrutsTypeConverter 
> gagal parsing date;");
>   e.printStackTrace();
>   }
> 
>   System.out.println("end converter");
>   return date;
>   }
> 
>   @Override
>   public String convertToString(Map arg0, Object arg1) {
> 
>   System.out.println("begin converter to string");
>   if(arg1 instanceof Date) {
>   System.out.println("end converter to string");
>   return new 
> SimpleDateFormat(shortDateFormat).format((Date) arg1);
>   }
> 
>   System.out.println("end converter to string");
>   return StringUtils.EMPTY;
>   }
> 
>   
>   
> }
> 
> //-- end DateConverter class ---
> 
> 
> 
> and in my action class, i have 2 property. one of them is Date type. and 
> other one is Pojo which one of that Pojo property have a Date type. so my 
> action look like this
> 
> 
> //-- begin MasterPatienAction class ---
> 
> @Namespace("/patient")
> @ParentPackage("app-default")
> @Conversion(conversions = {
>   @TypeConversion(key = "birthDate", converterClass = 
> DateConverter.class)
> })
> public class MasterPatientAction extends BaseAction {
> 
>   /**
>* 
>*/
>   private static final long serialVersionUID = 1L;
> 
>   private static transient Logger log = 
> Logger.getLogger(MasterPatientAction.class);
>   
>   
>   Patient patient;
>   List listPatient;
>   Date birthDate;
>   
>   @Action(value = "init", results = {
>   @Result(name = "success", location = 
> "/pages/pasient-main.jsp"),
>   @Result(name = "error", location = 
> "/pages/pasient-main.jsp"),
>   @Result(name = "input", location = 
> "/pages/pasient-main.jsp")
>   })
>   public String init() {
>   log.info("begin execute method init");
>   
>   log.info("end execute method init");
>   return SUCCESS;
>   }
> 
>   @Action(value = "search", results = {
>   @Result(name = "success", location = 
> "/pages/pasient-main.jsp"),
>   @Result(name = "error", location = 
> "/pages/pasient-main.jsp"),
>   @Result(name = "input", location = 
> "/pages/pasient-main.jsp")
>   })
>   public String search() {
>   log.info("begin execute method search");
>   
>   if(birthDate!=null) {
>   patient.setPatientBirthDate(birthDate);
>   }
>   
>   try {
>   listPasien = service.search(patient);
>   } catch (DnaException e) {
>   setMessageError("error 

Re: AliasInterceptor parameter mapping issue

2020-08-28 Thread Yasser Zamani

Hi Brian,

Sorry for inconvenience :( yes for me as well it looks like an 
unintentional bug introduced by [1].


Thanks a lot for writing to us! To followup its resolution would you 
mind create a new JIRA ticket?


Regards.

[1] 
https://github.com/apache/struts/commit/787f2f96eb9f1bb3c8012ab42aa222ae6286a91a#diff-b7b7c87c1012088e79dcc5a7bd9e8127


On 8/28/2020 4:58 AM, Brian Lenz wrote:

Hello,

We are running into an issue with the AliasInterceptor after upgrading to
2.5.22 (from 2.3.35). The issue is that the fallback behavior to look in
HttpParameters for a value guarantees a value will always be set and that
Evaluated.isDefined() will subsequently always return true. The issue is
that HttpParameters.get() *always* returns a non-null value. If there isn't
an explicit value set, then it returns a Parameter.Empty. This cascades
back to AliasInterceptor, which results in the empty value *always* being
set on the stack.

As an example, let's say I have a parameter f with alias foo. If I set a
value for foo on the request, the behavior in AliasInterceptor will result
in an empty value being set for foo, thus overwriting the actual value
submitted.

Is this the designed behavior? Based on the structure of the code, it
appears to be a bug since there is unnecessary logic otherwise
(specifically, the call to value.isDefined() on line 179). Further, this is
different behavior from the older versions of Struts (pre-HttpParameters).

Instead, I would think that isDefined() should be checked on the
Parameter returned
from HttpParameters so that a non-null value is only set in the Evaluated if
the parameter is actually defined.

Does anyone have any thoughts or insight into this issue? I looked in JIRA
and couldn't find anything related to it. Does anyone know of any
workarounds (aside from creating a custom AliasInterceptor to fix the
behavior)?

Thanks!

Brian



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts 2.5.23

2020-07-05 Thread Yasser Zamani
Hi thanks for the test build!

I think because mvnw cannot accept -D... jvm options directly.

Regards.


On 7/3/2020 10:29 AM, Lukasz Lenart wrote:
> Now I'm confused, this helped, but I was doing exactly the same thing :\
> 
> export MAVEN_OPTS=-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2
> 
> https://central.sonatype.org/articles/2018/May/04/discontinued-support-for-tlsv11-and-below/
> 
> Anyway, 2.5.23 is under build & deploy now :)
> 
> 
> Regards
> 

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: have plan to upgrade version of spring in struts 2 Spring plugin?

2019-12-14 Thread Yasser Zamani
Hi,

Thank you so much!

Yes we will upgrade Spring gradually during Struts 2.6.x releases - Struts 2.5 
is under maintenance mode only for security releases.

However, recent Struts 2.5.22 uses Spring 4.3.25.RELEASE [1]; doesn't it work 
for you?

Regards.

[1] https://mvnrepository.com/artifact/org.apache.struts/struts2-core/2.5.22

>-Original Message-
>From: Sai Man Yau 
>Sent: Wednesday, December 11, 2019 7:58 AM
>To: user@struts.apache.org
>Subject: have plan to upgrade version of spring in struts 2 Spring plugin?
>
>Dear Struts 2 Team,
>
>Thanks for your hard work to maintain such great framework to sustain all other
>developers. Thanks!!
>
>Since struts is using spring is some of the component, I would like to ask 
>will there
>a plan to upgrade the spring dependencies for Struts 2 Spring plugin because of
>the Spring has officially announced most of the versions will be EOL in coming
>years. Thanks.
>
>Reference quote:
>"The current version (2.5.10.1) of the Struts 2 Spring plugin has transitive
>dependencies to the Spring 4.1.6.RELEASE version. "
>
>Regards,
>Simon
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: convention plugin Issue

2019-12-07 Thread Yasser Zamani
Hi,

I guess that the behavior of defining actions with same name and namespace is 
undefined. I think it's not an issue because Convention Plugin has no avenue to 
distinguish between them when you request http://localhost:8080/hello-world.

Regards.

>-Original Message-
>From: Zahid Rahman 
>Sent: Thursday, December 5, 2019 4:51 PM
>To: Struts Users Mailing List 
>Subject: convention plugin Issue
>
>Hi,
>
>On this page
>https://struts.apache.org/plugins/convention/#setup
>
>if I have  com.example.actions.HelloWorld.java
>and
>uk.mypackage.actions.HelloWorld.java
>with  url http://localhost:8080/hello-world then
>uk.mypackage.actions.HelloWorld.java  execute is run.
>
>If I have
>uk.example.actions.HelloWorld.java
>and
>com.example.actions.HelloWorld.java
>then  com.example.actions.HelloWorld.java  execute is run.
>
>uk.mypackage.actions.HelloWorld,java overrides the other two.


RE: blank Page

2019-12-07 Thread Yasser Zamani


>-Original Message-
>From: Zahid Rahman 
>Sent: Wednesday, December 4, 2019 8:11 PM
>To: Struts Users Mailing List 
>Subject: blank Page
>
>Hi,
>
>I downloaded the latest JVM and tomcat.
>I set JAVA_HOME  as system variable to the latest version of JVM like any
>developer.
>the tomcat home page appeared.  wow ! and more wow ! great ! freeware which
>talk to the browser.
>I no longer have to do 1 week training on vendor tools.
>I am free at last free at last , free at last.
>Now I can learn this tool to a depth I have never learned before producing
>industrial software using the most complex programming features. So complex
>that another developer will have serious problems understanding. It will test 
>his
>skills to  the limit.
>I can now learn HTML and JAVASCRIPT , I thought ANSI SQL  and pure object
>orientated programmer. No more wrappers.
>
>Then I  noticed there was a JVM already installed on my operating system in
>program files  sub directory. I wanted to replicate the user environment.
>so I set JAVA_HOME in the .bat file pointing to latest JVM for tomcat only.
>That's when I got a blank page.
>
>It is my understanding that the communication protocol was incompatible
>between the latest JDK and the earlier JRE already installed used by browser. 
>The
>two JVMS couldn't talk to each other.
>So disappointed I was.

No. AFAIK User browser used JRE and your server JDK aren't connected, are 
independent. User browser talks with your tomcat via HTTP protocol and process 
your server text responses by its own local HTML, JavaScript, Flash, JRE and 
etc engines.

>
>Then I found another set of instruction showing  how to plug JSERV module with
>Apache web server.
>Once I did that the tomcat cat home page re appeared in the same browser.
>
>Now, I come from the third world and I know they use old computers and they do
>not have the bandwidth to download 500 - 600 MB operating system patches.
>Especially my tribe members. Like Apache I also come from a small  tribe and I
>want to prototype an application so that we can keep track. I want to prototype
>using Struts2.

AFAIK they usually don't need whole system patches. They just need a latest 
browser download which usually is small. I'm not sure but maybe you can avoid 
using complex JavaScript and HTML components to work with old browsers but in 
general I think it's impossible to work with very old OS/browsers.

>
>Obviously I do not have access to the lowest level communication protocol.
>The one that makes it possible for a  web page to travel half way across the 
>world
>in a split second.

It's simple HTTP protocol  :)

>That is confidential and I am a lowly developer.
>
>Can the expert please tell me, do I still have to use Apache in front or can I 
>just
>use tomcat with the latest stable JVM and it will communicate with what ever
>browser no matter how old ?

No you don't. Using Apache HTTP server in front doesn't help working with old 
browsers.

I hope these help! But for further info Google is your friend. Simply search 
phrases like "develop for old browsers" and etc.

Regards.


RE: /struts-2.5.22-all.zip where can download

2019-12-02 Thread Yasser Zamani
Hi Zahid,

Thanks for that! Could you please move it as a pull request at 
https://github.com/apache/struts-site/? Once done you can see result at 
https://struts.staged.apache.org/ (it's hard to read your changes here at mail 
list)

Kind Regards.

>-Original Message-
>From: Zahid Rahman 
>Sent: Tuesday, November 26, 2019 10:32 PM
>To: Struts Users Mailing List 
>Subject: Re: /struts-2.5.22-all.zip where can download
>
>Here are some changes and corrections I wish to suggest for page
>https://struts.apache.org/getting-started/how-to-create-a-struts2-web-
>application.html
>.
>What I mean to say is that, I wish the page had been written as follows.
>
>STEP 1.
>
>*-*
>*-/pom.xml [file]*
>
>
>
>
>
>*- /src- /src/main - /src/main/java-
>/src/main/resources- /src/main/webapp-
>/src/main/webapp/WEB-INF*
>
>*maven jetty:run* command does helps to create file  header  of config file
>*/pom.xml*  with error messages except it does not help to create
>the tag war.
>Without this tag you get build successful message, but jetty does not go into
>*server mode*.  I think this is inconsistent and is very important because 
>there is
>no error message and the desired effect is missing.
>
>These are the error messages I am referring which assist with creating file 
>header
>of */pom.xml*
>
>
>
>
>*[ERROR]   The project
>[unknown-group-id]:[unknown-artifact-id]:[unknown-version]
>(c:\struts2\work_dir\mvntest\pom.xml) has 4 errors[ERROR]
>'modelVersion' is missing. @ line 1, column 9[ERROR] 'groupId' is
>missing. @ line 1, column 9[ERROR] 'artifactId' is missing. @ line 1,
>column 9[ERROR] 'version' is missing. @ line 1, column 9*
>
>So  I think file header for the /pom.xml should be mentioned on that
>page as follows.
>
>
>
>
>
>
>* 4.0.0
>org.apachebasic-struts
>1.0war*
>
>To remove  the warning of platform independent there should be a mention to
>include the following tags
>
>
>
>
>
>
>*
>UTF-8
>2.5.20*
>
>Later in the page the dependency TAG is mentioned , but I feel the dependencies
>TAG should also be included as follows.
>
>**
>
>*  *
>
>
>
>* org.apache.struts
> struts2-core
> ${struts2.version} *
>
>
>**
>
>mvn jetty:run  commands does actually inform */${build.finalName} deprecated
>to  /${project.build.finalName}*
>
>Below is my complete pom.xml file
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>*
>4.0.0org.apache
>basic-struts1.0
>war
>UTF-8
>2.5.20
> org.apache.struts
> struts2-core
> ${struts2.version} 
>  basic-struts
>org.eclipse.jetty
>jetty-maven-plugin
>9.4.7.v20170914
>  
>  /${project.build.finalName}
>CTRL+C
>8999
>10
>  src/main/webapp/WEB-INF/web.xml
>  
>  *
>
>
>Best Regards
>
>zahid
>
>
>
>On Mon, 25 Nov 2019 at 08:41, Lukasz Lenart  wrote:
>
>> niedz., 24 lis 2019 o 06:15 Zahid Rahman 
>> napisał(a):
>> > "struts cookbook" button is unresponsive on main page
>> > http://localhost:8080/struts2-showcase/index.action
>> > It was unresponsive in the previous version too.
>>
>> Thanks, changed to point to https://github.com/apache/struts-examples
>>
>>
>> Regards
>> --
>> Łukasz
>> + 48 606 323 122 http://www.lenart.org.pl/
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>


RE: OFF TOPIC: hot reload

2019-12-02 Thread Yasser Zamani
Did you mean Struts' "configuration" e.g. struts.xml file hot reload?

Kind Regards.

>-Original Message-
>From: Zahid Rahman 
>Sent: Thursday, November 28, 2019 1:17 PM
>To: Struts Users Mailing List 
>Subject: OFF TOPIC: hot reload
>
>FLUTTER'S hot reload  (memory Hungary emulator) and Struts  development in
>eclipse works in the same way.
>which one came first ?

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


RE: Update views how to ?

2019-11-24 Thread Yasser Zamani
Thank you so much Zahid! you made my day :)

As far as I can recall there aren't too much to do to release Struts 2.6. I 
hope it's going to be soon :)

Regards.

>-Original Message-
>From: Zahid Rahman 
>Sent: Sunday, November 24, 2019 2:10 PM
>To: Struts Users Mailing List 
>Subject: Re: Update views how to ?
>
>The  advantages you have outlined in file
> (quoted below) is
>precisely the reason for my post . Now I feel struts2 is a complete framework  
>for
>any imaginable  application.  Struts 2 is now a simple yet powerful , adaptable
>framework. Please do what you need to do for version
>2.6 to refine the last piece.
>
>
>
>
>Example: A minimal chat room using server push Open current
>page in different tabs, browsers and computers then send messages.
>This is a minimal chat room which uses server push to retrieve new
>messages.
>It doesn't poll the server frequently to check if a new message is available to
>display.
>Instead it waits for the server to push back new messages. This approach has 
>two
>obvious advantages:
>low-lag communication without requests being sent, and no waste of server
>resources and network bandwidth.
>Reference: https://www.javaworld.com/article/2077995/java-concurrency/java-
>concurrency-asynchronous-processing-support-in-servlet-3-0.html
>">
>Asynchronous processing support in Servlet 3.0
>
>
>On Sun, 24 Nov 2019, 08:09 Yasser Zamani,  wrote:
>
>> Hi Zahid,
>>
>> Additionally, AFAIK...
>>
>> If your users are a lot, then I think you have to wait for Struts 2.6
>> release where I've added support for Async actions. For an instance
>> usage see my example at [1] (you can try it via running Struts 2.6
>> snapshot showcase - it's a simple chat room i.e. classic usage of server 
>> push).
>>
>> Otherwise or anyway, for now, you can try if Struts ExecAndWait is
>> able to handle your users.
>>
>> Regards.
>>
>> [1]
>> https://github.com/apache/struts/pull/179/commits/aee171c3b8ad40100661
>> 2c4df44ed540fb2ed7e3
>>
>> >-Original Message-
>> >From: M Huzaifah 
>> >Sent: Friday, November 22, 2019 6:57 AM
>> >To: Struts Users Mailing List 
>> >Subject: Re: Update views how to ?
>> >
>> >Hi,
>> >
>> >You should use stream mecanism for that case. What i've done, i used
>> >JMS, message-broker, which mean the browser always listen to
>> >message-broker
>> server
>> >using websocket (STOMP,AMQP,etc). When backend push message to the
>> >broker server, browser automatically receive and render the message
>> >to the
>> browser. I
>> >use ActiveMQ over MQTT, and render the message using javascript in
>> browser.
>> >
>> >You can find another stream mecanism or reactive application example
>> >out
>> there.
>> >
>> >Regards
>> >
>> >On Fri, Nov 22, 2019, 10:06 Zahid Rahman  wrote:
>> >
>> >> Hi,
>> >>
>> >> I have an admin screen (jsp) where  the administrator updates
>> >> values
>> i.e.
>> >> current weather temperature, cricket , football score, death
>> >> counter showing people killed by knife crime in a city, natural
>> >> causes , car accidents etc.
>> >>
>> >>
>> >> I have at least two users who are looking at the current
>> >> temperature or game score etc. (JSP).
>> >>
>> >> Once the administrator updates the values , the data viewed by the
>> >> two users In their browser is now stale data , due to the fact the
>> >> web browser is based on a stateless pull model.
>> >>
>> >> Is there an example app or maven  archetype which shows how I can
>> >> update or  refresh  the views (JSPs viewed in browser) in all the
>> >> user sessions [views ] from inside the running application server
>> >> using the
>> >> struts2 framework.
>> >>
>>


RE: Update views how to ?

2019-11-24 Thread Yasser Zamani
Hi Zahid,

Additionally, AFAIK...

If your users are a lot, then I think you have to wait for Struts 2.6 release 
where I've added support for Async actions. For an instance usage see my 
example at [1] (you can try it via running Struts 2.6 snapshot showcase - it's 
a simple chat room i.e. classic usage of server push).

Otherwise or anyway, for now, you can try if Struts ExecAndWait is able to 
handle your users.

Regards.

[1] 
https://github.com/apache/struts/pull/179/commits/aee171c3b8ad401006612c4df44ed540fb2ed7e3

>-Original Message-
>From: M Huzaifah 
>Sent: Friday, November 22, 2019 6:57 AM
>To: Struts Users Mailing List 
>Subject: Re: Update views how to ?
>
>Hi,
>
>You should use stream mecanism for that case. What i've done, i used JMS,
>message-broker, which mean the browser always listen to message-broker server
>using websocket (STOMP,AMQP,etc). When backend push message to the broker
>server, browser automatically receive and render the message to the browser. I
>use ActiveMQ over MQTT, and render the message using javascript in browser.
>
>You can find another stream mecanism or reactive application example out there.
>
>Regards
>
>On Fri, Nov 22, 2019, 10:06 Zahid Rahman  wrote:
>
>> Hi,
>>
>> I have an admin screen (jsp) where  the administrator updates values i.e.
>> current weather temperature, cricket , football score, death counter
>> showing people killed by knife crime in a city, natural causes , car
>> accidents etc.
>>
>>
>> I have at least two users who are looking at the current temperature
>> or game score etc. (JSP).
>>
>> Once the administrator updates the values , the data viewed by the two
>> users In their browser is now stale data , due to the fact the web
>> browser is based on a stateless pull model.
>>
>> Is there an example app or maven  archetype which shows how I can
>> update or  refresh  the views (JSPs viewed in browser) in all the user
>> sessions [views ] from inside the running application server using the
>> struts2 framework.
>>


Re: /struts-2.5.22-all.zip where can download

2019-11-23 Thread Yasser Zamani
Hi,

https://dist.apache.org/repos/dist/dev/struts/2.5.22

Thanks for testing the bits!

Regards.
On 23 November 2019, at 20:03, Sai Man Yau 
mailto:ieomon...@gmail.com>> wrote:

Dear Friends,

I would like to know where could I download the 
dev/struts/2.5.22/struts-2.5.22-all.zip for my local project to have a test 
run? Thanks.

Regards,
Simon



RE: How to pass parameters to s:component inside s:iterator?

2019-10-06 Thread Yasser Zamani
Hi Albert,

Could you try without the inner s:if tag? I remember that some tags don't work 
inside each other :(

Despite if it was the problem or not, I think it's more readable design to move 
iterator and if tags inside the component (items.jsp) itself, have you ever 
considered it?

Regards.

>-Original Message-
>From: albert kao 
>Sent: Saturday, October 5, 2019 7:26 PM
>To: Struts Users Mailing List 
>Subject: How to pass parameters to s:component inside s:iterator?
>
>How to pass parameters to s:component inside s:iterator?
>e.g. These simpilied codes pass the parameter "John" to items.jsp.
>However, the browser displays an empty string.
>
>status="status">
>  name="%{'client['+#status.index+'].firstName'}" label="firstName.label">
>
>  
>
>  
>
>
>
>items.jsp:
>  name="%{#fieldname}"
>  value="%{parameters.inputValue}"/>
>/>


Re: How to auto submit a jsp page after loading

2019-10-04 Thread Yasser Zamani
Hi Albert,

I think Dave is right -- if you wanted to test, then you would not do this.

What have you been using for test? If it tested UI also (e.g. Selenium),
it would have facilities to automate clicking on submit button [1]. If
you didn't want to test UI at all (e.g. JMeter), you would not try to
execute client side codes -- just call action via http, validate and
process result and repeat respectively.

Hope this helps!

Regards.

[1] https://pythonspot.com/selenium-click-button/

On 10/3/2019 4:03 PM, Dave Newton wrote:
> On Thu, Oct 3, 2019 at 7:57 AM albert kao  wrote:
> 
>> This is desired for saving time when testing a web application.
>>
> 
> Two points:
> 
> * You'd no longer be testing the page.
> * You'd introduce *additional* functionality not present on the real page.
> 
> Dave
> 


Re: JSON plugin: filter fields in a Map with Lists

2019-09-27 Thread Yasser Zamani
You're welcome :) Sorry I thought you don't need keys. If you needed
them, then following would work:

public Map> getResult() {
return result;
}

^result\.[^\[]+\[\d+\]\.interestingProperty$


Then only limitation of this one is that keys should not contain [
character because of [^\[]+ which I had to use instead of .* to avoid
including all of the model.

Kind Regards.

On 9/27/2019 3:29 PM, Micael Carreira wrote:
> Thanks, that indeed works Yasser.
> 
> However, with that configuration I won't have access to the map keys,
> which I also need. For now, I created a new getter that retrieves only
> the keys, but this is a workaround.
> 
> However from what you said, I guess it is not possible to have both the
> keys and values filtered in a map structure as I originally wanted, right?
> 
> Thanks again for your help,
> Email Signature
> Micael Carreira
> Software Developer Logo
> <https://www.itclinical.com_source=mail_medium=banner_campaign=signature>
> 
> Rua Augusto Macedo, 12-B
> 1600-794 Lisbon - Portugal
> t: +351 21 714 4500
> www.itclinical.com
> <http://www.itclinical.com_source=mail_medium=banner_campaign=signature>
> Facebook icon <https://www.facebook.com/ITClinical> LinkedIn icon
> <https://www.linkedin.com/company/itclinical>
> The content of this email is confidential and intended for the recipient
> specified in message only. It is strictly forbidden to share any part of
> this message with any third party, without a written consent of the
> sender. If you received this message by mistake, please reply to this
> message and follow with its deletion, so that we can ensure such a
> mistake does not occur in the future.
> 
> On 26/09/19 22:25, Yasser Zamani-2 [via Struts] wrote:
>> Hi Micael, thanks for your report!
>>
>> You're right! I debugged Struts with your model, Map> List>. I realized with following sample initialization:
>>
>>  MyObject mo = new MyObject();
>>  mo.setInterestingProperty("IP");
>>  mo.setNotInterestingProperty("NIP");
>>  ArrayList mol = new ArrayList();
>>  mol.add(mo);
>>  result = new HashMap<>();
>>  result.put("first", mol);
>>
>> Struts checks result.first[0].interestingProperty if it has any
>> includeProperties matches.
>>
>> The map key can be any string i.e. .* Consequently you have to have
>> result\..*\[\d+\]\.interestingProperty but .* causes including all of
>> the model -- because Struts splits above into multiple regex: result,
>> result\..*, result\..*\[\d+\] and result\..*\[\d+\]\.interestingProperty
>> and checks input with them respectively. The second one passes all!
>>
>> I just could find following workaround which you might like:
>>
>>  private Map> result;
>>  public Collection> getResult() {
>>  return result.values();
>>  }
>> 
>>     ^result$,^result\[\d+\]\[\d+\]\.interestingProperty$
>> 
>>
>> Hope this helps!
>>
>> Best.
>>
>> On 9/25/2019 8:57 PM, Micael Carreira wrote:
>>> Hello Yasser, thanks for your reply.
>>>
>>> It did not work. The configuration you suggested, sends nothing in JSON
>>> object.
>>>
>>> I also tried this configuration:
>>>
>>> 
>>>  result\..+,
>>>  result,interestingProperty
>>> 
>>>
>>> But it sends all properties, including notInterestingProperty.
>>>
>>> Best regards,
>>>
>>> Email Signature
>>> Micael Carreira
>>> Software Developer Logo
>>> <https://www.itclinical.com_source=mail_medium=banner_campaign=signature>
>>>
>>>
>>> Rua Augusto Macedo, 12-B
>>> 1600-794 Lisbon - Portugal
>>> t: +351 21 714 4500
>>> www.itclinical.com
>>> <http://www.itclinical.com_source=mail_medium=banner_campaign=signature>
>>>
>>>  Facebook icon <https://www.facebook.com/ITClinical> LinkedIn icon
>>> <https://www.linkedin.com/company/itclinical>
>>> The content of this email is confidential and intended for the recipient
>>> specified in message only. It is strictly forbidden to share any part of
>>> this message with any third party, without a written consent of the
>>> sender. If you received this message by mistake, please reply to this
>>> message and follow with its deletion, so that we can ensure such a
>>> mistake does not occur in the future.

Re: JSON plugin: filter fields in a Map with Lists

2019-09-26 Thread Yasser Zamani
Hi Micael, thanks for your report!

You're right! I debugged Struts with your model, Map>. I realized with following sample initialization:

MyObject mo = new MyObject();
mo.setInterestingProperty("IP");
mo.setNotInterestingProperty("NIP");
ArrayList mol = new ArrayList();
mol.add(mo);
result = new HashMap<>();
result.put("first", mol);

Struts checks result.first[0].interestingProperty if it has any
includeProperties matches.

The map key can be any string i.e. .* Consequently you have to have
result\..*\[\d+\]\.interestingProperty but .* causes including all of
the model -- because Struts splits above into multiple regex: result,
result\..*, result\..*\[\d+\] and result\..*\[\d+\]\.interestingProperty
and checks input with them respectively. The second one passes all!

I just could find following workaround which you might like:

private Map> result;
public Collection> getResult() {
return result.values();
}

^result$,^result\[\d+\]\[\d+\]\.interestingProperty$


Hope this helps!

Best.

On 9/25/2019 8:57 PM, Micael Carreira wrote:
> Hello Yasser, thanks for your reply.
> 
> It did not work. The configuration you suggested, sends nothing in JSON
> object.
> 
> I also tried this configuration:
> 
> 
>     result\..+,
>     result,interestingProperty
> 
> 
> But it sends all properties, including notInterestingProperty.
> 
> Best regards,
> 
> Email Signature
> Micael Carreira
> Software Developer Logo
> <https://www.itclinical.com_source=mail_medium=banner_campaign=signature>
> 
> Rua Augusto Macedo, 12-B
> 1600-794 Lisbon - Portugal
> t: +351 21 714 4500
> www.itclinical.com
> <http://www.itclinical.com_source=mail_medium=banner_campaign=signature>
> Facebook icon <https://www.facebook.com/ITClinical> LinkedIn icon
> <https://www.linkedin.com/company/itclinical>
> The content of this email is confidential and intended for the recipient
> specified in message only. It is strictly forbidden to share any part of
> this message with any third party, without a written consent of the
> sender. If you received this message by mistake, please reply to this
> message and follow with its deletion, so that we can ensure such a
> mistake does not occur in the future.
> 
> On 25/09/19 09:18, Yasser Zamani-2 [via Struts] wrote:
>>
>>> -Original Message-
>>> From: Micael Carreira 
>>> Sent: Tuesday, September 24, 2019 1:30 PM
>>> To: user@struts.apache.org
>>> Subject: JSON plugin: filter fields in a Map with Lists
>>>
>>> Hello,
>>>
>>> In MyAction, I have the following instance variable:
>>>
>>>  Map> result;
>>>
>>> And MyObject has the following properties:
>>>
>>>  MyObject
>>>  |- interestingProperty
>>>  |- notInterestingProperty
>>>
>>> I want to return the action result as a JSON. So, in my struts
>>> configuration I have:
>>>
>>>  
>>>      
>>>          
>>>          result\..+$
>>>          
>>>      
>>>  
>>>
>>> This returns all keys/values in result map. But I want to write a
>>> JSON with only
>>> interestingProperty of each MyObject (which are in a list).
>> Hi,
>>
>> Doesn't below work for you (to write only interestingProperty)?
>>
>> 
>> result,interestingProperty
>> 
>>
>> Regards.
>>
>>> I've fiddled with the regular expression for a while, but could not
>>> find a way to do
>>> it.
>>>
>>> Is it possible to achieve what I need?
>>>
>>> Thanks,
>>>
>>> -- 
>>> Email Signature
>>> Micael Carreira
>>> Software Developer Logo
>>> <https://www.itclinical.com_source=mail_medium=banner_cam
>>> paign=signature>
>>>
>>> Rua Augusto Macedo, 12-B
>>> 1600-794 Lisbon - Portugal
>>> t: +351 21 714 4500
>>> www.itclinical.com
>>> <http://www.itclinical.com_source=mail_medium=banner_cam
>>> paign=signature>
>>> Facebook icon <https://www.facebook.com/ITClinical> LinkedIn icon
>>> <https://www.linkedin.com/company/itclinical>
>>> The content of this email is confidential and intended for the
>>> recipient specified in
>>> message only. It is strictly forbidden to share any part of this
>>> message with any
>>> third party, without a written consent of the sender. If you received
>>> this message
>>> by mistake, please reply to this message and follow with its
>>> deletion, so that we
>>> can ensure such a mistake does not occur in the future.
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
> 


RE: JSON plugin: filter fields in a Map with Lists

2019-09-25 Thread Yasser Zamani


>-Original Message-
>From: Micael Carreira 
>Sent: Tuesday, September 24, 2019 1:30 PM
>To: user@struts.apache.org
>Subject: JSON plugin: filter fields in a Map with Lists
>
>Hello,
>
>In MyAction, I have the following instance variable:
>
>     Map> result;
>
>And MyObject has the following properties:
>
>     MyObject
>     |- interestingProperty
>     |- notInterestingProperty
>
>I want to return the action result as a JSON. So, in my struts configuration I 
>have:
>
>     
>         
>             
>             result\..+$
>             
>         
>     
>
>This returns all keys/values in result map. But I want to write a JSON with 
>only
>interestingProperty of each MyObject (which are in a list).

Hi,

Doesn't below work for you (to write only interestingProperty)?


result,interestingProperty


Regards.

>
>I've fiddled with the regular expression for a while, but could not find a way 
>to do
>it.
>
>Is it possible to achieve what I need?
>
>Thanks,
>
>--
>Email Signature
>Micael Carreira
>Software Developer Logo
>paign=signature>
>
>Rua Augusto Macedo, 12-B
>1600-794 Lisbon - Portugal
>t: +351 21 714 4500
>www.itclinical.com
>paign=signature>
>   Facebook icon  LinkedIn icon
>
>The content of this email is confidential and intended for the recipient 
>specified in
>message only. It is strictly forbidden to share any part of this message with 
>any
>third party, without a written consent of the sender. If you received this 
>message
>by mistake, please reply to this message and follow with its deletion, so that 
>we
>can ensure such a mistake does not occur in the future.



RE: Migrating the Migration Guide

2019-09-21 Thread Yasser Zamani
Hi,

Sorry I cannot recall why we should migrate -- Have INFRA compelled us and 
Confulence is going to be removed? Or just to beautify?

Anyway, I think we can use a Jekyll/Ruby custom tag component which at site 
build time, downloads that Confulence's page html as an anonymous user and 
includes it in output -- like what I've already done for some snippets.

Regards.

>-Original Message-
>From: Lukasz Lenart 
>Sent: Friday, September 20, 2019 11:20 AM
>To: Struts Users Mailing List 
>Subject: Migrating the Migration Guide
>
>Hi,
>
>The very last thing to migrate from Confluence to Markdown is our Migration
>Guide [1]. The only problem with having all in .md files and exposed via Git 
>is that
>with Confluence we can restrict access to particular pages which is useful when
>we are preparing a security release. We can prepare the Version Notes without
>exposing any information to public, clarify things and so on. Having all in 
>.md files
>won't be possible to do so.
>
>I wonder what can of flow would help us still use Confluence in such cases but
>keep the final docs in .md files, do you have some ideas?
>
>[1] https://cwiki.apache.org/confluence/display/WW/Migration+Guide
>
>
>Regards
>--
>Łukasz
>+ 48 606 323 122 http://www.lenart.org.pl/
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


ApacheCon Europe 2019: Join Struts Hackathon!

2019-09-09 Thread Yasser Zamani
Dear Struts Community (@user, @dev, @pmc),

There will be a hackathon space at ApacheCon Europe 2019 in Berlin
reserved for Struts. It will be available on 23rd/24th October from 1:00
PM for 2/4 hours.

We want to invite everybody to participate on the hackathon where we are
collaboratively researching, discussing and developing effective usage
of Asynchronous [1] using Struts. Then we are trying to add it into Struts.

That's our initial default topic, would you like to amend? If so,
collaborative development on project source code, improvements to
project documentation, and development of example apps or tools built
upon Struts are all encouraged.

Furthermore, it's a nice opportunity to get in touch with other users,
contributors and committers.

More details will be available leading up to the event, but here’s
generally what to expect:

- Dedicated space with chairs, power, wifi, snacks, and caffeine.
- Tables dedicated to Struts.
- ‘Getting Started’ discussions for new and aspiring committers
- (industrial) IoT Corner with industrial equipment to code against

Interested? Email user@struts.apache.org to amend topic or just to count
attendees :)

Thanks!
Apache Struts Team

P.S. Swag and stickers on RedBubble are also available [2]. Enjoy!

[1]
https://www.hackerearth.com/practice/notes/asynchronous-servlets-in-java/
[2]
https://www.redbubble.com/people/comdev/works/40935299-apache-struts?asc=u

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


Re: Invalid Field Value when using Map

2019-06-28 Thread Yasser Zamani


On 6/24/2019 8:51 PM, Prasanth Pasala wrote:
> I have built a test project to just test the Map variables. In the
> validate method it does give a String object (for value of map). But
> seems like a field error is also added. If I try to use the map in
> validate method I would get a class cast exception, but if I don't do
> anything with the map values then the input page is displayed with
> invalid field value error.
> 
> So I guess the issue is that my validate method is trying to validate
> the values in the map and that causes the exception, as the map has
> String values in it.
> 
> I have to update the validation methods to check if the value is of type
> Double or not. Is this how it is supposed to work?

I also like to not see that value in Map but maybe it's required for
some reason - I didn't check. But you may use following workaround:

if (!hasFieldErrors() || !getFieldErrors().contains(myFieldName) {
// my extra customized validation logic for myFieldName
}

>  I would have thought> that a field error would be added and the String value 
> would not be
> added to the Map as the code is expecting Doubles.

Me too! Could you please put a break-point at your app's [1] and see
what happens next for that field?

Regards.

[1]
https://github.com/apache/struts/blob/651eac2c57396aa11ee65002006b3123dd69cbb4/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java#L445



> 
> Thanks,
> Prasanth
> 
> On 6/24/19 1:42 AM, Yasser Zamani wrote:
>> Hi,
>>
>> I think putting breakpoints at [1] and [2] and seeing if you reach
>> there and what happens next can help proceeding this issue.
>>
>> Thanks in advance!
>>
>> Regards.
>>
>> [1]
>> https://github.com/apache/struts/blob/651eac2c57396aa11ee65002006b3123dd69cbb4/core/src/main/java/com/opensymphony/xwork2/conversion/impl/DefaultObjectTypeDeterminer.java#L114
>>
>> [2]
>> https://github.com/apache/struts/blob/651eac2c57396aa11ee65002006b3123dd69cbb4/core/src/main/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptor.java#L118
>>
>>
>>
>>> -Original Message-
>>> From: Prasanth 
>>> Sent: Friday, June 21, 2019 6:27 PM
>>> To: user@struts.apache.org
>>> Subject: Re: Invalid Field Value when using Map
>>>
>>> Hi Yasser,
>>>
>>> The conversion error occurs when the field is not a map. I have a
>>> form with
>>> int/long fields, if the user enters non numeric value the form
>>> display error.
>>>
>>> The actions are validation aware and the control does come to validation
>>> method. It is in the validation method that I usually get exceptions 
>>> as the code is
>>> expecting to have a Double but the type of the object in the map is a
>>> String. I
>>> have tried to check in the validate method if the object is of type
>>> Double and if it
>>> is not a Double add a field error. When I do that OGNL seems to have
>>> an issue
>>> when displaying the input form with the values in the map. Seems like
>>> OGNL is
>>> now expecting a Double value and is not able to handle a String
>>> object being
>>> present in the map. The JSP stops at the field which has String value.
>>>
>>> So even if I add additional validations to make sure all values in
>>> the map are
>>> Doubles it would still cause a problem as Struts would not be able to
>>> display the
>>> input form.
>>>
>>> Thanks,
>>> Prasanth
>>>
>>> On 6/21/19 1:23 AM, Yasser Zamani wrote:
>>>> Oh interesting!
>>>>
>>>> Have you seen [1]? e.g. conversion error interceptor should be present
>>>> in your interceptor stack. To debug, for example put a number field
>>>> which is not a map and see if conversion error appears - I think you
>>>> should also have fieldErrors tag in your jsp.
>>>>
>>>> It seems your action also should be ValidationAware. Put a break-point
>>>> at [2] and see if your code reaches there and what happens next.
>>>>
>>>> Regards.
>>>>
>>>> [1]
>>>> https://struts.apache.org/core-developers/type-conversion.html#collect
>>>> ion-and-map-support
>>>> [2]
>>>> https://github.com/apache/struts/blob/651eac2c57396aa11ee65002006b3123
>>>>
>>> dd69cbb4/core/src/main/java/com/opensymphony/xwork2/interceptor/Conver
>>>> sionErrorInterceptor.java#L116
>>>>
>>>> On 6/19/2019 10:35 PM, Pras

RE: Invalid Field Value when using Map

2019-06-24 Thread Yasser Zamani
Hi,

I think putting breakpoints at [1] and [2] and seeing if you reach there and 
what happens next can help proceeding this issue.

Thanks in advance!

Regards.

[1] 
https://github.com/apache/struts/blob/651eac2c57396aa11ee65002006b3123dd69cbb4/core/src/main/java/com/opensymphony/xwork2/conversion/impl/DefaultObjectTypeDeterminer.java#L114
[2] 
https://github.com/apache/struts/blob/651eac2c57396aa11ee65002006b3123dd69cbb4/core/src/main/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptor.java#L118


>-Original Message-
>From: Prasanth 
>Sent: Friday, June 21, 2019 6:27 PM
>To: user@struts.apache.org
>Subject: Re: Invalid Field Value when using Map
>
>Hi Yasser,
>
>The conversion error occurs when the field is not a map. I have a form with
>int/long fields, if the user enters non numeric value the form display error.
>
>The actions are validation aware and the control does come to validation
>method. It is in the validation method that I usually get exceptions  as the 
>code is
>expecting to have a Double but the type of the object in the map is a String. I
>have tried to check in the validate method if the object is of type Double and 
>if it
>is not a Double add a field error. When I do that OGNL seems to have an issue
>when displaying the input form with the values in the map. Seems like OGNL is
>now expecting a Double value and is not able to handle a String object being
>present in the map. The JSP stops at the field which has String value.
>
>So even if I add additional validations to make sure all values in the map are
>Doubles it would still cause a problem as Struts would not be able to display 
>the
>input form.
>
>Thanks,
>Prasanth
>
>On 6/21/19 1:23 AM, Yasser Zamani wrote:
>> Oh interesting!
>>
>> Have you seen [1]? e.g. conversion error interceptor should be present
>> in your interceptor stack. To debug, for example put a number field
>> which is not a map and see if conversion error appears - I think you
>> should also have fieldErrors tag in your jsp.
>>
>> It seems your action also should be ValidationAware. Put a break-point
>> at [2] and see if your code reaches there and what happens next.
>>
>> Regards.
>>
>> [1]
>> https://struts.apache.org/core-developers/type-conversion.html#collect
>> ion-and-map-support
>> [2]
>> https://github.com/apache/struts/blob/651eac2c57396aa11ee65002006b3123
>>
>dd69cbb4/core/src/main/java/com/opensymphony/xwork2/interceptor/Conver
>> sionErrorInterceptor.java#L116
>>
>> On 6/19/2019 10:35 PM, Prasanth Pasala wrote:
>>> Hi Yasser,
>>>
>>> I think at run time you can add any type of objects you want to the map.
>>> The checks are only at compile time on the data types of objects
>>> added to Maps.
>>>
>>> Thanks,
>>> Prasanth
>>>
>>> On 6/19/19 1:29 AM, Yasser Zamani wrote:
>>>> Hi Prasanth,
>>>>
>>>> I'm surprised how you get non digit characters in your map while
>>>> both key and value are not String!
>>>>
>>>> Regards.
>>>>
>>>>> -Original Message-
>>>>> From: Prasanth 
>>>>> Sent: Monday, June 17, 2019 8:52 PM
>>>>> To: Struts Users Mailing List 
>>>>> Subject: Invalid Field Value when using Map
>>>>>
>>>>> Hi,
>>>>>
>>>>> I have a form that uses maps to store data as shown below. When the
>>>>> user enters valid numbers it works as expected, but when user
>>>>> enters non digit characters in the text field a String object is
>>>>> saved in the map rather than showing a "Invalid field value for
>>>>> field " message which is done for basic data types like
>>>>> int/long/double. Is this something that struts has not implemented
>>>>> for maps yet, as the annotations provide the expected data type?
>>>>>
>>>>>   @Element(value=java.lang.Double.class)
>>>>>   private HashMap deferralAmountValue = new
>>>>> HashMap();
>>>>>   @Element(value=java.lang.Double.class)
>>>>>   private HashMap deferralPercentValue = new
>>>>> HashMap();
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Prasanth
>>>> 
>>>> - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>
>>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>



Re: Invalid Field Value when using Map

2019-06-21 Thread Yasser Zamani
Oh interesting!

Have you seen [1]? e.g. conversion error interceptor should be present
in your interceptor stack. To debug, for example put a number field
which is not a map and see if conversion error appears - I think you
should also have fieldErrors tag in your jsp.

It seems your action also should be ValidationAware. Put a break-point
at [2] and see if your code reaches there and what happens next.

Regards.

[1]
https://struts.apache.org/core-developers/type-conversion.html#collection-and-map-support
[2]
https://github.com/apache/struts/blob/651eac2c57396aa11ee65002006b3123dd69cbb4/core/src/main/java/com/opensymphony/xwork2/interceptor/ConversionErrorInterceptor.java#L116

On 6/19/2019 10:35 PM, Prasanth Pasala wrote:
> Hi Yasser,
> 
> I think at run time you can add any type of objects you want to the map.
> The checks are only at compile time on the data types of objects added
> to Maps.
> 
> Thanks,
> Prasanth
> 
> On 6/19/19 1:29 AM, Yasser Zamani wrote:
>> Hi Prasanth,
>>
>> I'm surprised how you get non digit characters in your map while both
>> key and value are not String!
>>
>> Regards.
>>
>>> -Original Message-
>>> From: Prasanth 
>>> Sent: Monday, June 17, 2019 8:52 PM
>>> To: Struts Users Mailing List 
>>> Subject: Invalid Field Value when using Map
>>>
>>> Hi,
>>>
>>> I have a form that uses maps to store data as shown below. When the
>>> user enters
>>> valid numbers it works as expected, but when user enters non digit
>>> characters in
>>> the text field a String object is saved in the map rather than
>>> showing a "Invalid
>>> field value for field " message which is done for basic
>>> data types like
>>> int/long/double. Is this something that struts has not implemented
>>> for maps yet,
>>> as the annotations provide the expected data type?
>>>
>>>  @Element(value=java.lang.Double.class)
>>>  private HashMap deferralAmountValue = new
>>> HashMap();
>>>  @Element(value=java.lang.Double.class)
>>>  private HashMap deferralPercentValue = new
>>> HashMap();
>>>
>>>
>>> Thanks,
>>> Prasanth
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
> 
> 


RE: Invalid Field Value when using Map

2019-06-19 Thread Yasser Zamani
Hi Prasanth,

I'm surprised how you get non digit characters in your map while both key and 
value are not String!

Regards.

>-Original Message-
>From: Prasanth 
>Sent: Monday, June 17, 2019 8:52 PM
>To: Struts Users Mailing List 
>Subject: Invalid Field Value when using Map
>
>Hi,
>
>I have a form that uses maps to store data as shown below. When the user enters
>valid numbers it works as expected, but when user enters non digit characters 
>in
>the text field a String object is saved in the map rather than showing a 
>"Invalid
>field value for field " message which is done for basic data types 
>like
>int/long/double. Is this something that struts has not implemented for maps 
>yet,
>as the annotations provide the expected data type?
>
>     @Element(value=java.lang.Double.class)
>     private HashMap deferralAmountValue = new
>HashMap();
>     @Element(value=java.lang.Double.class)
>     private HashMap deferralPercentValue = new
>HashMap();
>
>
>Thanks,
>Prasanth


Re: Upgrade from struts 2.3.37 to struts 2.5.20 issue.

2019-06-12 Thread Yasser Zamani
No I meant latest version of struts-jsf plugin jar. You have mentioned
"The previous problem had been solved." i.e. you already have
struts-core in classpath and already you have finished some migration;
So I told trying to also include latest version of struts-jsf plugin jar
and seeing if your app compile and run or if any exception.

Regards.

On 6/12/2019 12:12 PM, fanggdev@ wrote:
> Hi,
> 
> I have included the latest version jar (Struts2-core-2.5.20) and i got the 
> following error:
> [2019 Jun 12 10:01:33] ERROR Dispatcher[] - Dispatcher initialization 
> failed
> com.opensymphony.xwork2.config.ConfigurationException: Unable to load 
> configuration.
>   at 
> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
>  ~[struts2-core-2.5.20.jar:2.5.20]
>   at 
> org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:957) 
> ~[struts2-core-2.5.20.jar:2.5.20]
>   at 
> org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:463)
>  ~[struts2-core-2.5.20.jar:2.5.20]
>   at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:496) 
> [struts2-core-2.5.20.jar:2.5.20]
>   at 
> org.apache.struts2.dispatcher.InitOperations.initDispatcher(InitOperations.java:73)
>  [struts2-core-2.5.20.jar:2.5.20]
>   at 
> org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:61)
>  [struts2-core-2.5.20.jar:2.5.20]
>   at 
> org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)
>  [catalina.jar:7.0.94]
>   at 
> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
>  [catalina.jar:7.0.94]
>   at 
> org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108)
>  [catalina.jar:7.0.94]
>   at 
> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:5037)
>  [catalina.jar:7.0.94]
>   at 
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5739)
>  [catalina.jar:7.0.94]
>   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) 
> [catalina.jar:7.0.94]
>   at 
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1018)
>  [catalina.jar:7.0.94]
>   at 
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994) 
> [catalina.jar:7.0.94]
>   at 
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) 
> [catalina.jar:7.0.94]
>   at 
> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127) 
> [catalina.jar:7.0.94]
>   at 
> org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2020) 
> [catalina.jar:7.0.94]
>   at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) 
> [?:1.7.0_55]
>   at java.util.concurrent.FutureTask.run(FutureTask.java:262) [?:1.7.0_55]
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>  [?:1.7.0_55]
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>  [?:1.7.0_55]
>   at java.lang.Thread.run(Thread.java:745) [?:1.7.0_55]
> Caused by: com.opensymphony.xwork2.config.ConfigurationException: Parent 
> package is not defined: jsf-default
>   at 
> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.buildPackageContext(XmlConfigurationProvider.java:689)
>  ~[struts2-core-2.5.20.jar:2.5.20]
>   at 
> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:539)
>  ~[struts2-core-2.5.20.jar:2.5.20]
>   at 
> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.buildPackageContext(XmlConfigurationProvider.java:685)
>  ~[struts2-core-2.5.20.jar:2.5.20]
>   at 
> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:539)
>  ~[struts2-core-2.5.20.jar:2.5.20]
>   at 
> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:326)
>  ~[struts2-core-2.5.20.jar:2.5.20]
>   at 
> org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:108)
>  ~[struts2-core-2.5.20.jar:2.5.20]
>   at 
> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:196)
>  ~[struts2-core-2.5.20.jar:2.5.20]
>   at 
> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
>  ~[struts2-core-2.5.20.jar:2.5.20]
>   ... 21 more

Re: Upgrade from struts 2.3.37 to struts 2.5.20 issue.

2019-06-11 Thread Yasser Zamani
Hi FANG,

I am not familiar with that plugin but as a simplest solution, does your
application compile when you simply put it's latest version jar in your
classpath? If so, does it run correctly? If not then I will look at that
plugin and think about any solution :) - and please also include the
first exception stack trace or error message if it doesn't compile or run.

Regards.

On 6/10/2019 7:32 PM, FANG YAP wrote:
> Hi,
> 
> The previous problem had been solved. I have another new issue regarding to
> the Struts 2 JSF Plugin. I know that the "struts2-jsf-plugin.jar" was
> removed and not supporting from Struts 2.5 onwards, how do we rectify
> Struts-JSF-Plugin in our project as the project was extending jsf-default
> in struts.xml. Any idea? And is there an alternative way to put the plugin
> back in place?
> 
> On Wed, 22 May 2019 at 14:06, Lukasz Lenart  wrote:
> 
>> Hi,
>>
>> Did you follow the migration guideline?
>> https://cwiki.apache.org/confluence/display/WW/Struts+2.3+to+2.5+migration
>>
>> Regards
>> Lukasz
>>
>> wt., 21 maj 2019 o 18:45 HuiFung@GMail  napisał(a):
>>>
>>> encounter issue when .ear file deployed in Weblogic 12.1.3.0.0 server.
>>>
>>> Error: Struts Dispatcher cannot be found...
>>>
>>> Upgraded the necessary jar files such as struts core, json and updates
>> the
>>> necessary properties file. but still encounter the struts dispatcher
>> error.
>>>
>>> any idea what did I missed out? project is using ANT build and also is a
>>> non-maven project.
>>>
>>> Regards,
>>>
>>> Hui Fung
>>> Sent from G-Mail
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
> 

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


RE: Migration Help for angular2

2019-05-25 Thread Yasser Zamani


>-Original Message-
>From: Gopal, Siva Prakash (US - Mechanicsburg Delivery)
>
>Sent: Wednesday, May 22, 2019 10:51 AM
>To: Struts Users Mailing List 
>Subject: RE: Migration Help for angular2
>
>Our Current Application as below structure
>
>
>
>Config.xml
>
>
>
>
>method="loadForgotCredentials">
>
> name="anonymous">true
>
> name="success">success.jsp -> jsp
>(tiles-def)
>
>type="chain">resetSubmit 
>
>
>
>
>
>Action class
>
>
>
>class CredentialsAction{
>
>private String username;
>
>private String pwd;
>
>
>
>public String loadForgotCredentials(){
>
>if(true){
>
>return success;
>
>}else{
>
>return 
> passreset;
>
>}
>
>}
>
>
>
>}
>
>Currently (http:\\localhost\Demo\credentials) it will render 
> JSP or
>chaining to another action class.
>
>
>
>What is best approach to change above structure to return as 
> json
>response for API call. Since i need to use that api call in angular code.


Hi Siva,

Use Struts "JSON Plugin" [1] which has json result for actions [2]. Regarding 
chains, use json result for last action in the chain e.g. for resetSubmit 
action in your example above.

Regards.

[1] https://struts.apache.org/plugins/json/
[2] https://struts.apache.org/plugins/json/#write-the-mapping-for-the-action


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


RE: No Form Found under '' in locale 'en_CA'. A Form Must be defined in the Commons Validator configuration...

2019-03-19 Thread Yasser Zamani
Hi Edmound, good morning,

Struts 1 EOL has occurred years ago and I think unfortunately we don't have any 
one in current team to handle such issues.

Thanks for using Struts.

Regards.

>-Original Message-
>From: edmound.hubbard.oildex@ edmound.hubbard.oil...@gmail.com>
>Sent: Thursday, March 14, 2019 5:42 PM
>To: user@struts.apache.org
>Subject: No Form Found under '' in locale 'en_CA'. A Form Must be defined in 
>the
>Commons Validator configuration...
>
>Morning,
>
>I am running into an issue, first let me give you a high level of the problem.
>
>Main Site:  When accessing website users are able to click a button which will
>trigger a series of Strut actions and take that user to a confirmation page.
>Everything works as it should.
>
>Now our new scenario is a user who is coming from another web application is
>navigating to a new Strut Action within the Main Site, which hooks up to the
>workflow process when someone clicks on the button within the Main Site. but
>even though it goes through all the same strut actions when it comes to the
>building of the JSP page I get the error as mentioned in the Subject.
>
>Both have called the last strut:
>  type="com.openInvoice.invoice.web.action.InvoiceApprovalPrepareAction"
>  scope="request"
>  name="DocumentApprovalForm"
>  parameter="{1}"
>  validate="false">
>
>The only difference I'm seeing is the button does a post, whereas the new entry
>point is a GET.  Would that have anything to do with it?
>
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org



RE: Issue : Binding Integer Array upon form submission

2019-03-19 Thread Yasser Zamani
Hi Muhammad,

I tested your sample exactly and works as expected here 
(setRfaAccessType(Integer[] rfaAccessType) called with ticked values).

The first thing you can do is enabling devMode and log level to warn and 
looking output for any relevant warnings. If not try debug level.

Thanks for using Struts.

Regards.

>-Original Message-
>From: Muhammad Salman Farooq1 
>Sent: Monday, March 18, 2019 2:51 PM
>To: user@struts.apache.org
>Subject: Issue : Binding Integer Array upon form submission
>
>
>
>We have just migrated our application from 2.2.3 to struts 2.5.20.
>In one of our use-cases, we have two checkboxes with same "name" attribute
>and upon submission, they submit integer values that we bind with Integer array
>being defined in the action.
>After migration, that thing stopped working.
>Here is my code snippet in JSP:
>
>
>id="rfaacess_STORAGE">
>
>
>id="rfaacess_SERVER">
>
>
>
>
>
>Here is the integer array in Action class (Setters and getters also
>defined)
>
>
>private Integer[] rfaAccessType;
>
>
>
>
>
>I need your help to remediate this issue. If this way of submitting form and
>binding it to an array still supported in Struts? If not, what should I do so 
>that I
>have minimum change in my code?
>
>Regards,
>Muhammad Salman Farooq
>Lead Developer - HWSW Server Program
>OCAJP | OCPJP Java SE 7
>IBM Global Business Services
>Islamabad, Pakistan
>
>Phone: 92-0345-5061795 | 92-0304-6664753
>E-mail: muhammad.salman.faro...@pk.ibm.com

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: HashMap with String as key

2019-03-12 Thread Yasser Zamani
(regarding your previous emails background) Please also consider that the key 
2432-123 is not further Long. It's String.

Regards.

>-Original Message-
>From: Lukasz Lenart 
>Sent: Tuesday, March 12, 2019 10:52 AM
>To: Struts Users Mailing List 
>Subject: Re: HashMap with String as key
>
>pon., 11 mar 2019 o 18:41 Prasanth  napisał(a):
>> When you have a HashMap backed form and String as key, are there any
>restrictions on the characters allowed?
>>
>> I have keys like "2432-123" as I have to incorporate two ids in the
>> key. When I have these keys the HashMap is not getting populated. If I change
>it, so that there is only one id (no hyphen) then the data is getting posted as
>expected.
>
>I assume it's because of the "-" (minus) sign, and OGNL performs an evaluation 
>or
>something. Could you check if you have key 2309 in your map as a result of
>distraction operation (2432-123 = 2309)?
>
>
>Regards
>--
>Łukasz
>+ 48 606 323 122 http://www.lenart.org.pl/
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org



RE: Migrating from Struts 1.2 to recent Struts

2019-03-12 Thread Yasser Zamani
Hi David,

These are some useful resources I found via googling:

* Official Migration Guide: Struts 1 to Struts 2 [1]
* Stackoverflow answer: Migration from Struts 1 to Struts 2 [2]
* InfoQ Migration Guide, part one [3]

Thanks for using Struts!

Kind Regards.

[1] https://cwiki.apache.org/confluence/display/WW/Migration+Guide
[2] https://stackoverflow.com/a/20130845/1362623
[3] http://www.infoq.com/articles/converting-struts-2-part1


>-Original Message-
>From: Dave Newton 
>Sent: Monday, March 11, 2019 10:32 PM
>To: Struts Users Mailing List 
>Subject: Re: Migrating from Struts 1.2 to recent Struts
>
>Kind of depends what you're migrating it to. Roughly speaking you copy your
>business logic as-is and rewrite the web interface side of things.
>
>
>On Mon, Mar 11, 2019 at 2:16 PM davidrobertwoos...@gmail.com <
>davidrobertwoos...@gmail.com> wrote:
>
>> I'm forced to migrate a sizable application from Struts 1.2 to
>> something recent, and I don't know where to start. I understand that
>> Struts 1.2 is ~ancient~ history and no longer supported in any way,
>> shape or form. But it must be done.
>>
>> How can I accomplish such a migration?
>>
>> Thanks,
>>
>> David
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>
>--
>em: davelnew...@gmail.com
>mo: 908-380-8699
>tw: @dave_newton 
>li: dave-newton 
>gh: davelnewton 
>so: Dave Newton 
>bl[0]: Bucky Bits 
>bl[1]: Maker's End Blog 
>sk: davelnewton_skype


RE: Mapping struts.xml actions to their full URL

2019-03-12 Thread Yasser Zamani
Hi there,

The whole Struts itself is a servlet/filter defined in web.xml and you cannot 
divide your actions between multiple servlet/filter I think.

Regards.

>-Original Message-
>From: shonlevin1234@ 
>Sent: Monday, March 11, 2019 3:45 PM
>To: user@struts.apache.org
>Subject: Mapping struts.xml actions to their full URL
>
>As part of security tests we are doing, I have to map the actions appears in
>struts.xml to their full URLs. I know to connect between the namespace and the
>action name of every action from struts.xml, but how can I know which servlet
>refers to each action?
>
>For example, this is my struts.xml file-
>
>
>
>bar2.jsp
>
>
>
>I know that the URL contains the path "/barspace/bar.action" but how can I 
>build
>the rest of the URL (with the servlet prefix as well)?
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org



Re: Help with syntax struts 2

2019-03-10 Thread Yasser Zamani



On 3/9/2019 3:34 AM, Deborah White wrote:
> Can someone help me with the syntax on this?
> 
> 

Hi Deborah,

I tested the syntax and it works. If it doesn't work there then I guess
if reportId is String then try  else then
try . Also
try replacing || with && or != with == variations.

Thanks for using Struts!

Regards.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Map backed form

2019-03-07 Thread Yasser Zamani
Hi Prasanth,

I searched and saw it is some different for ModelDriven [1].

Regards.

[1]
https://struts.apache.org/core-developers/type-conversion.html#applying-a-type-converter-to-a-bean-or-model
(Applying a Type Converter to a bean or model)

On 3/6/2019 7:36 PM, Prasanth wrote:
> I have created the below in CompDeferralAction-conversion.properties (action 
> class is CompDeferralAction). The variable name is deferralCode. But still 
> struts is populating the value as Long rather
> than Integer. Am I missing anything here?
> This action is ModelDriven so the deferralCode variable is in a different 
> class.
> 
> Looking at the documentation seems like it should be KeyProperty, so I named 
> it as such.
> KeyProperty_deferralCode=java.lang.Long
> Element_deferralCode=java.lang.Interger
> 
> I have also tried the annotations
> 
>     @TypeConversion(rule=ConversionRule.MAP, key="java.lang.Long", 
> value="java.lang.Integer")
>     public void setDeferralCode(HashMap deferralCode) {
>         this.deferralCode = deferralCode;
>     }
> 
> Thanks,
> Prasanth
> 
> On 2/16/19 3:20 AM, Yasser Zamani wrote:
>> I think a file named yourActionClass-conversion.properties beside your 
>> action with following contents should help [1]:
>>
>> Key_xxx=java.lang.Long
>> Element_xxx=java.lang.Double
>>
>> (where xxx is the field name of the collection property in your action or 
>> object)
>>
>> Regards.
>>
>> [1] 
>> https://struts.apache.org/core-developers/type-conversion.html#collection-and-map-support
>>
>>> -Original Message-
>>> From: Prasanth 
>>> Sent: Friday, February 15, 2019 9:08 PM
>>> To: user@struts.apache.org
>>> Subject: Re: Map backed form
>>>
>>> Does struts follow a specific logic as to what the data type of the object 
>>> would be
>>> based on user input? Meaning when is it converted to a Double vs Integer vs
>>> String?
>>>
>>> Thanks,
>>> Prasanth
>>>
>>> On 2/15/19 7:45 AM, Lukasz Lenart wrote:
>>>> pt., 15 lut 2019 o 00:17 Prasanth  napisał(a):
>>>>> I have a map (Map) but based on the data entered by the
>>>>> user the value in the Map is Double or String. Example if the user enters 
>>>>> a
>>> value of 10 then it is coming in as double but if the user enters 10.5 then 
>>> a string
>>> is present in the value. Does Struts2 look at the data types of the key and 
>>> value of
>>> the map and set the key and values in the map accordingly?
>>>> Struts is not a problem here, generic types are erased at runtime, so
>>>> basically this a Map at the end
>>>> https://docs.oracle.com/javase/tutorial/java/generics/erasure.html
>>>>
>>>>> If not, what is the best practice for the declaration of Map, is there a 
>>>>> way to
>>> force Struts2 to only have Double objects as values?
>>>> I would probably use a custom type instead of Double and implement
>>>> converter for it, or even replace the Map with a List of custom
>>>> objects.
>>>>
>>>>
>>>> Regards
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
> 
> 


RE: Jboss 7.2 gives 404 after deployment

2019-02-23 Thread Yasser Zamani
>From: John W. Himpel 
>Sent: Saturday, February 23, 2019 11:22 PM
>To: user@struts.apache.org
>Subject: Jboss 7.2 gives 404 after deployment
>
>Greetings,
>
>I have a very small Struts web app that I developed under Red Hat Developer
>Studio.
>
>I am using Struts 2.5.20, Jboss 7.2.0.
>
>Right-click in on the project name in Red Hat Developer Studio, select
>properties->Web Project Settings and the Context root: shows a
>"learning".
>
>After deployment, in Firefox I enter the following url:  "
>http://localhost:8080/learning/UserAction.action; and I get a 404 response.  I
>have tried every variation of url strings that I can think of and everything 
>returns a
>404 response.
>
>JBoss 7.2.0 standalone server.log
>2019-02-22 17:07:05,389 INFO  [org.wildfly.extension.undertow] (ServerService
>Thread Pool -- 156) WFLYUT0021: Registered web context:
>'/learning-0.0.1-SNAPSHOT' for server 'default-server'
>Any suggestions or debugging tips would be greatly appreciated.


What about http://localhost:8080/learning-0.0.1-SNAPSHOT/listUser or 
http://localhost:8080/listUser. I don't have experience with Jboss but in 
tomcat we can open /manager and see what's going with webapps. Does Jboss have 
similar thing? In general I think you should discover in which context path the 
app is deployed? Is it started at all?

Kind Regards.


Re: How to use s:iterator s:include s:param

2019-02-17 Thread Yasser Zamani
Hi Albert,

I found following at [1].

"Note: Any additional params supplied to the included page are not
accessible within the rendered page through the  tag since
no valuestack will be created. You can, however, access them in a
servlet via the HttpServletRequest object or from a JSP page via a
scriptlet.

How To access parameters

Parameters are passed as request parameters, so use the
${param.ParamName} notation to access them. Do not use the property tag
to access parameters in included files."

So it seems you can use ${param.itemList}.

Thanks for using Struts!

Regards.

[1] https://struts.apache.org/tag-developers/include-tag.html

On 2/16/2019 4:33 PM, albert kao wrote:
> This display properly:
> 
>   
> 
>   
> 
> 
> I refactor to the following two files, which display nothing.
> I have other codes in items.jsp which confirms that items.jsp is being used
> in showitems.jsp.
> Please help.
> Thanks.
> 
> items.jsp:
> 
> 
> 
>   
> 
>   
> 
> 
> 
> 
> showitems.jsp:
> 
>   
> 
> 


RE: Array of submit buttons

2019-02-16 Thread Yasser Zamani
>From: Prasanth 
>Sent: Friday, February 15, 2019 3:02 AM
>To: Struts Users Mailing List 
>Subject: Array of submit buttons
>
>Hi,
>
>I have a form with tabular data and need to have delete buttons for each row. 
>So
>have a ArrayList in the action and the form has name="delete[%{#rowNumber}]" value="Delete"/> inside an iterator. When the
>user clicks on the Delete button the ArrayList was not populated. So
>changed the ArrayList to a Map. Interestingly the map is populated but the 
>value
>in the map is a String array, rather than a single String, with one element 
>having
>string Delete.
>
>Do s:submit work differently from s:textfield when it comes to saving data to
>ArrayList or Map?


No, AFAIK finally both are http parameters.

I expect ArrayList to work also e.g. for rowNumber=3, I expect delete={null, 
null, null, "Delete"} :( Could you please set devMode and increase log levels 
to WARN and check the output? What Struts version do you use?

Regards.


RE: Map backed form

2019-02-16 Thread Yasser Zamani
I think a file named yourActionClass-conversion.properties beside your action 
with following contents should help [1]:

Key_xxx=java.lang.Long
Element_xxx=java.lang.Double

(where xxx is the field name of the collection property in your action or 
object)

Regards.

[1] 
https://struts.apache.org/core-developers/type-conversion.html#collection-and-map-support

>-Original Message-
>From: Prasanth 
>Sent: Friday, February 15, 2019 9:08 PM
>To: user@struts.apache.org
>Subject: Re: Map backed form
>
>Does struts follow a specific logic as to what the data type of the object 
>would be
>based on user input? Meaning when is it converted to a Double vs Integer vs
>String?
>
>Thanks,
>Prasanth
>
>On 2/15/19 7:45 AM, Lukasz Lenart wrote:
>> pt., 15 lut 2019 o 00:17 Prasanth  napisał(a):
>>> I have a map (Map) but based on the data entered by the
>>> user the value in the Map is Double or String. Example if the user enters a
>value of 10 then it is coming in as double but if the user enters 10.5 then a 
>string
>is present in the value. Does Struts2 look at the data types of the key and 
>value of
>the map and set the key and values in the map accordingly?
>> Struts is not a problem here, generic types are erased at runtime, so
>> basically this a Map at the end
>> https://docs.oracle.com/javase/tutorial/java/generics/erasure.html
>>
>>> If not, what is the best practice for the declaration of Map, is there a 
>>> way to
>force Struts2 to only have Double objects as values?
>> I would probably use a custom type instead of Double and implement
>> converter for it, or even replace the Map with a List of custom
>> objects.
>>
>>
>> Regards



RE: [struts-user] XML based configuration

2019-02-12 Thread Yasser Zamani
We had similar resolved issue at [1]. Could you please see if [2] fixes this 
also?

Regards.

[1] 
https://lists.apache.org/thread.html/f4e1d1a5c917d0fa759cce667b23ef1e076c51ad7907dcfbdeb88707@%3Cdev.struts.apache.org%3E
[2] 
https://lists.apache.org/thread.html/3825d060bb13474987603719026bb06f66d28a388680e13a5858db57@%3Cdev.struts.apache.org%3E


>-Original Message-
>From: Jason Pyeron 
>Sent: Thursday, January 31, 2019 9:29 AM
>To: 'Struts Users Mailing List' 
>Subject: RE: [struts-user] XML based configuration
>
>> -Original Message-
>> From: Jason Pyeron 
>> Sent: Wednesday, January 30, 2019 9:53 PM
>> > -Original Message-
>> > From: Jason Pyeron 
>> > Sent: Wednesday, January 30, 2019 9:11 PM
>> >
>> > It has been 10+ years since I used the XML configuration, so please
>> > bear with me.
>> >
>> > I am attempting to deploy Apache Roller under a sub context
>> > (public#roller.war) so the url would be
>> > http://127.0.0.1:8080/public/roller/roller-ui/login.rol .
>> >
>> > When I do so, I get an exception cannot find definition named .Login
>> >
>
>So I think I have narrowed it down.
>
>file:/C:/programs.x64/apache-software-foundation/apache-tomcat-
>7.0.82/webapps/public#roller/WEB-INF/tiles.xml
>
>But when this URL is stored in the 
>org.apache.tiles.request.ApplicationResource,
>specifically org.apache.struts2.tiles.StrutsApplicationResource it is 
>splitting the
>URL in two:
>
>pathPrefix="/C:/programs.x64/apache-software-foundation/apache-tomcat-7.0"
>
>and
>
>suffix=".82/webapps/public"
>
>
>If I hack it with the debugger to :
>
>
>pathPrefix="/C:/programs.x64/apache-software-foundation/apache-tomcat-
>7.0.82/webapps/public#roller/WEB-INF/tiles.xml"
>
>and
>
>suffix=""
>
>It works until the next restart!
>
>
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org



Re: How to import Struts Examples into Eclipse IDE inside a single project

2019-02-10 Thread Yasser Zamani
Hi Albert,

Please see if https://stackoverflow.com/a/38714946 helps. If not, you
have to ask Eclipse team or research further if it is even possible and
how. Unfortunately I don't have experience with any multi-module maven
project with Eclipse (it's not specific to Struts).

Regards.

On 2/9/2019 6:22 PM, albert kao wrote:
> How to import Struts Examples into Eclipse IDE inside a single project?
> 
> I tried this way but multiple projects (action-chaining, annotations, ...,
> wildcard-regex) appeared in Eclipse Package Explorer.
> 
> I used "New Java project" to create the struts-examples-master project.
> I downloaded and unzipped the struts-examples-master.zip from
> https://github.com/apache/struts-examples.
> 
> I used "Import Maven", "Existing Maven Projects".
> 
> My struts-examples-master project src folder is still empty and multiple
> projects (action-chaining, annotations, ..., wildcard-regex) appeared in
> Eclipse Package Explorer
> My Eclipse IDE for Enterprise Java Developers version is 2018-12 (4.10.0).
> 


RE: Struts2 Checkboxlist

2019-02-06 Thread Yasser Zamani
Ach! Sorry, you're right. For checkbox list it's MultiselectInterceptor class 
which handles this and here it works with following config:

List selectedLongs= new ArrayList<>();
public List getLongs(){
List longs= new ArrayList<>();
longs.add(0L);
longs.add(1L);
return longs;
}
public void setSelectedLongs(List selectedLongs){
this.selectedLongs = selectedLongs;
}
public List getSelectedLongs(){
return selectedLongs;
}




/WEB-INF/tags/ui/exampleSubmited.jsp
/WEB-INF/tags/ui/example.jsp



When I post an empty form, MultiselectInterceptor adds an empty string for 
selectedLongs http param, then Struts internal conversion converts it to an 
empty instance of List, then setSelectedLongs will be called here with it.

Regards.

>-Original Message-
>From: Prasanth Pasala 
>Sent: Wednesday, February 6, 2019 12:30 AM
>To: user@struts.apache.org
>Subject: Re: Struts2 Checkboxlist
>
>Hi Yasser,
>
>Even after having the param the ArrayList was not populated with -1 for
>unchecked checkboxes. The ArrayList is in form. The set method in the
>form is not getting called when I don't check any of the checkboxes. I am 
>using a
>checkboxlist rather than individual checkboxes.
>
>            
>        
>        form
>    
>    
>        -1
>    
>
>
>Thanks,
>Prasanth
>
>On 2/5/19 5:43 AM, Yasser Zamani wrote:
>> Hi Prasanth,
>>
>> Yes, I think. Now I can recall a long discussion about this at [1]. i.e. you 
>> also can
>keep array list of long but override the interceptor like below [2]:
>>
>> > class="com.afs.ListConverterTestAction">
>> 
>> -1
>> 
>>
>> Kind Regards.
>>
>> [1] https://github.com/apache/struts/pull/169
>> [2] https://github.com/apache/struts/pull/169#issuecomment-352999309
>>
>>
>>> -Original Message-
>>> From: Prasanth Pasala 
>>> Sent: Tuesday, February 5, 2019 3:26 AM
>>> To: user@struts.apache.org
>>> Subject: Re: Struts2 Checkboxlist
>>>
>>> I am using the defaultStack but the ArrayList used for the checkboxes
>>> is of type Long. If we change it to ArrayList of Boolean would the
>>> interceptor set the values to false? Or is this only applicable if
>>> you have individual checkboxes rather than checkboxlist?
>>>
>>> Thanks,
>>> Prasanth
>>>
>>> On 2/4/19 4:29 PM, Paul Zepernick wrote:
>>>> Yes, setFoo is only called if the checkbox is checked.  However,
>>>> Struts 2 does have a checkbox interceptor:
>>>> https://struts.apache.org/core-developers/checkbox-interceptor.html
>>>>
>>>> This interceptor defaults checkbox Boolean's to False if the box is not
>checked.
>>> This is part of the default interceptor stack.
>>>> Paul
>>>>
>>>> -Original Message-
>>>> From: Prasanth Pasala 
>>>> Sent: Monday, February 4, 2019 5:21 PM
>>>> To: user@struts.apache.org
>>>> Subject: Re: Struts2 Checkboxlist
>>>>
>>>> NOTICE: This email originated from outside of the organization. Do
>>>> not click
>>> links or open attachments unless you recognize the sender and know
>>> the content is safe.
>>>> Is that how Struts2 is expected to work? Meaning setFoo would not be
>>>> called if
>>> non of the Foo checkboxes are selected? I know that is how Struts1 worked.
>>>> Thanks,
>>>> Prasanth
>>>>
>>>> On 2/2/19 7:08 PM, Prasanth Pasala wrote:
>>>>> Hi Yasser,
>>>>>
>>>>> When none of the checkboxes is selected the setFoo is not getting called.
>>>>>
>>>>> Thanks
>>>>> Prasanth
>>>>>
>>>>> On February 2, 2019 8:02:07 AM CST, Yasser Zamani
>>>  wrote:
>>>>>> Hi Prasanth,
>>>>>>
>>>>>> AFAIK this tag is like this:
>>>>>>
>>>>>> 
>>>>>>
>>>>>> It calls getBar method of your action or finds bar in value stack
>>>>>> to find out what to display. Same for baz to find out which to be
>>>>>> selected. Then it calls yourAction.setFoo to post selected items. i.e.
>>>>>> it is up to you what you do with it in 

RE: Struts2 Checkboxlist

2019-02-05 Thread Yasser Zamani
Hi Prasanth,

Yes, I think. Now I can recall a long discussion about this at [1]. i.e. you 
also can keep array list of long but override the interceptor like below [2]:



-1


Kind Regards.

[1] https://github.com/apache/struts/pull/169
[2] https://github.com/apache/struts/pull/169#issuecomment-352999309


>-Original Message-
>From: Prasanth Pasala 
>Sent: Tuesday, February 5, 2019 3:26 AM
>To: user@struts.apache.org
>Subject: Re: Struts2 Checkboxlist
>
>I am using the defaultStack but the ArrayList used for the checkboxes is of 
>type
>Long. If we change it to ArrayList of Boolean would the interceptor set the 
>values
>to false? Or is this only applicable if you have individual checkboxes rather 
>than
>checkboxlist?
>
>Thanks,
>Prasanth
>
>On 2/4/19 4:29 PM, Paul Zepernick wrote:
>> Yes, setFoo is only called if the checkbox is checked.  However,
>> Struts 2 does have a checkbox interceptor:
>> https://struts.apache.org/core-developers/checkbox-interceptor.html
>>
>> This interceptor defaults checkbox Boolean's to False if the box is not 
>> checked.
>This is part of the default interceptor stack.
>>
>> Paul
>>
>> -Original Message-
>> From: Prasanth Pasala 
>> Sent: Monday, February 4, 2019 5:21 PM
>> To: user@struts.apache.org
>> Subject: Re: Struts2 Checkboxlist
>>
>> NOTICE: This email originated from outside of the organization. Do not click
>links or open attachments unless you recognize the sender and know the content
>is safe.
>>
>> Is that how Struts2 is expected to work? Meaning setFoo would not be called 
>> if
>non of the Foo checkboxes are selected? I know that is how Struts1 worked.
>>
>> Thanks,
>> Prasanth
>>
>> On 2/2/19 7:08 PM, Prasanth Pasala wrote:
>>> Hi Yasser,
>>>
>>> When none of the checkboxes is selected the setFoo is not getting called.
>>>
>>> Thanks
>>> Prasanth
>>>
>>> On February 2, 2019 8:02:07 AM CST, Yasser Zamani
> wrote:
>>>> Hi Prasanth,
>>>>
>>>> AFAIK this tag is like this:
>>>>
>>>> 
>>>>
>>>> It calls getBar method of your action or finds bar in value stack to
>>>> find out what to display. Same for baz to find out which to be
>>>> selected. Then it calls yourAction.setFoo to post selected items. i.e.
>>>> it is up to you what you do with it in setFoo method. Normally you
>>>> should clear baz and fill it with them again to update selected items.
>>>>
>>>> Thanks for using Struts!
>>>>
>>>> Kind Regards.
>>>>
>>>>> -Original Message-
>>>>> From: Prasanth 
>>>>> Sent: Saturday, February 2, 2019 1:08 AM
>>>>> To: user@struts.apache.org
>>>>> Subject: Struts2 Checkboxlist
>>>>>
>>>>> Hi,
>>>>>
>>>>> I am using a checkboxlist on a jsp page which corresponds to a
>>>> ArrayList in the
>>>>> form class, which is used to store form data from a multi page wizard.
>>>> I am using
>>>>> scope interceptor to store the form class in session so that the
>>>>> data
>>>> persists as
>>>>> the user navigates the wizard. When the user selects some check
>>>>> boxes
>>>> it is
>>>>> correctly populated in the form class but if the user navigates
>>>>> back
>>>> in the wizard
>>>>> and unchecks the check box (non of the check boxes selected) struts
>>>> doesn't set
>>>>> the ArrayList to empty. It will still contain the old selection.
>>>>> What
>>>> is the best way
>>>>> to solve this issue?
>>>>>
>>>>> My Options:
>>>>> 1. Should I use Preparable and set this ArrayList to empty? Since
>>>>> this
>>>> is a wizard
>>>>> (multiple pages submitting to the same action) have to make sure it
>>>>> is
>>>> done only
>>>>> when submitting the page that have these checkboxes.
>>>>> 2. Create two separate ArrayLists, one to get values from Struts
>>>>> and
>>>> another to
>>>>> save the original selection and clear the first array list. Down
>>>>> side
>>>> is I need to
>>>>> populate the list linked to the form when user navigates back to
>>>>> that

RE: Struts2 Checkboxlist

2019-02-02 Thread Yasser Zamani
Hi Prasanth,

AFAIK this tag is like this:



It calls getBar method of your action or finds bar in value stack to find out 
what to display. Same for baz to find out which to be selected. Then it calls 
yourAction.setFoo to post selected items. i.e. it is up to you what you do with 
it in setFoo method. Normally you should clear baz and fill it with them again 
to update selected items.

Thanks for using Struts!

Kind Regards.

>-Original Message-
>From: Prasanth 
>Sent: Saturday, February 2, 2019 1:08 AM
>To: user@struts.apache.org
>Subject: Struts2 Checkboxlist
>
>Hi,
>
>I am using a checkboxlist on a jsp page which corresponds to a ArrayList in the
>form class, which is used to store form data from a multi page wizard. I am 
>using
>scope interceptor to store the form class in session so that the data persists 
>as
>the user navigates the wizard. When the user selects some check boxes it is
>correctly populated in the form class but if the user navigates back in the 
>wizard
>and unchecks the check box (non of the check boxes selected) struts doesn't set
>the ArrayList to empty. It will still contain the old selection. What is the 
>best way
>to solve this issue?
>
>My Options:
>1. Should I use Preparable and set this ArrayList to empty? Since this is a 
>wizard
>(multiple pages submitting to the same action) have to make sure it is done 
>only
>when submitting the page that have these checkboxes.
>2. Create two separate ArrayLists, one to get values from Struts and another to
>save the original selection and clear the first array list. Down side is I 
>need to
>populate the list linked to the form when user navigates back to that page.
>
>Neither of them seem elegant. Is there a way to make struts set the ArrayList 
>to
>empty when user doesn't select any check box?
>
>Using Struts 2.3.35
>
>Thanks,
>Prasanth

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


RE: Escaping dollar sign and curly brackets

2019-02-02 Thread Yasser Zamani
>From: Micael Carreira 
>Sent: Friday, February 1, 2019 6:56 PM
>To: user@struts.apache.org
>Subject: Escaping dollar sign and curly brackets
>
>Hey,
>
>In my action I'm using getText(myKey) to get a localized string. This string 
>has
>some placeholders of mine, in ${placeholder} format. Consider my original key 
>is
>defined as this in my properties file:
>
>     myKey = Some text ${placeholder} more text.
>
>I've read in Struts documentation that it uses MessageFormat. So, if I want
>literals, I need to use single quotes. This is what I did in my properties 
>file:
>
>     myKey = Some text '${placeholder}' more text.
>
>However, when I call getText(myKey) I get: Some text ' more text. Why does this
>happen?

It seems firstly ${placeholder} is evaluated to empty by Struts then '' is 
evaluated to ' by MessageFormat.

>
>I also noticed that the problem is the dollar sign AND curly brackets without 
>any
>character in between. If I have this definition:
>
>     myKey = Some text '$' text '{placeholder}' more text.
>
>It gets resolved to: Some text $ text {placeholder} more text.
>
>Can somebody explain me how can I escape the dollar and curly brackets
>characters?

I guess '$'{placeholder} or $'{placeholder}' or '$''{placeholder}' should work 
:\ could you please report back the result for each one? And which Struts 
version you test?

Thanks for using Struts!

Kind Regards.


RE: EmptyStackException after upgrading Struts 2.3 to 2.5

2019-01-29 Thread Yasser Zamani
>From: Lukasz Lenart 
>Sent: Tuesday, January 29, 2019 2:18 PM
>To: Struts Users Mailing List 
>Subject: Re: EmptyStackException after upgrading Struts 2.3 to 2.5
>
>wt., 29 sty 2019 o 11:30 Yasser Zamani  napisał(a):
>> Yes you both are right. It looks like a race condition between stack.clear 
>> and
>stack.write [1]. But somehow it's odd. I was aware about this and defined them
>as prototype [2] so I except new instance on each request. I also can recall I
>tested them heavily on high concurrent load [3].
>
>but this is used in an interceptor and interceptors are created once per 
>package,
>so the same instance will be used for the same requests

Yes I recently learnt it but I always logically had this assumption: When bean 
A needs bean B to be injected and B's type is `prototype`, then Struts internal 
injection cycle always re-inject a new instance of B into A regardless if A's 
type is `singleton` or `prototype`. So I missed this case :( and Ach, you're 
right, I now can retain my high concurrent test was on JSONResult not 
JSONInterceptor :(

Regards.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


RE: EmptyStackException after upgrading Struts 2.3 to 2.5

2019-01-29 Thread Yasser Zamani
Hi,

Yes you both are right. It looks like a race condition between stack.clear and 
stack.write [1]. But somehow it's odd. I was aware about this and defined them 
as prototype [2] so I except new instance on each request. I also can recall I 
tested them heavily on high concurrent load [3].

By the way, Eduardo, you also can workaround this issue for now by 
synchronizing access to custom.action via using java synchronized keyword 
inside your action method.

Thanks for using Struts!

Regards.

[1] 
https://github.com/apache/struts/blob/6183fa0147affb466a9ac18f9c03b3920f3b876a/plugins/json/src/main/java/org/apache/struts2/json/DefaultJSONWriter.java#L114
[2] 
https://github.com/apache/struts/blob/6183fa0147affb466a9ac18f9c03b3920f3b876a/plugins/json/src/main/resources/struts-plugin.xml#L30
[3] https://github.com/apache/struts/pull/167#issuecomment-329083889

>-Original Message-
>From: Lukasz Lenart 
>Sent: Monday, January 28, 2019 10:35 PM
>To: Struts Users Mailing List 
>Subject: Re: EmptyStackException after upgrading Struts 2.3 to 2.5
>
>Hi,
>
>I think you are right, it's probably a side effect of changes related to this 
>issues
>
>https://issues.apache.org/jira/browse/WW-4034
>
>Could you register a new JIRA ticket to fix that?
>
>
>Regards
>--
>Łukasz
>+ 48 606 323 122 http://www.lenart.org.pl/
>
>pon., 28 sty 2019 o 16:55 Eduardo Guadalupe 
>napisał(a):
>>
>> I suspect there is a concurrency issue with the DefaultJSONWriter
>> implementation.
>> I have overridden the JSONInterceptor so a new instance of JSONUtil is used
>> with every request and the issue is not happening anymore. I suppose there
>> is a performance cost with that change but for now it works.
>>
>> https://github.com/lalo-
>mx/struts/commit/ed29e3f4ed841ef13559c02da1c8dca9b68fb0a7
>>
>> Does it sound reasonable what I have found? Or should I better review the
>> configuration / documentation for some other change that I have not
>> contemplated?
>>
>> On 2019/01/25 23:57:44, Eduardo Quintanilla 
>wrote:
>> > Hi,
>> >
>> > I recently upgraded Struts from version 2.3.34 to 2.5.20. After doing the
>> recommended fixes the application runs correctly but an exception started
>> happening sporadically.
>> >
>> > The app is built and runs in JDK 8 with Tomcat 9.0.12
>> >
>> > The app is a little big so i have not able to create an example yet.
>> > The more relevant libraries in use are Spring + Struts + Hibernate
>> >
>> > Any tips about how to find the root cause of the issue?
>> >
>> >
>> > Request:
>> > Request URL: https://localhost/app/rest/custom.action
>> > Request Payload: {"params":["example"],"method":"load","id":1}
>> >
>> > Logs:
>> > DefaultDispatcherErrorHandler: Exception occurred during processing
>> request: null
>> > java.util.EmptyStackException: null
>> > at java.util.Stack.peek(Stack.java:102) ~[?:1.8.0_191]
>> > at java.util.Stack.pop(Stack.java:84) ~[?:1.8.0_191]
>> > at
>>
>org.apache.struts2.json.DefaultJSONWriter.process(DefaultJSONWriter.java:196)
>> ~[struts2-json-plugin-2.5.20.jar:2.5.20]
>> > at
>> org.apache.struts2.json.DefaultJSONWriter.value(DefaultJSONWriter.java:154)
>> ~[struts2-json-plugin-2.5.20.jar:2.5.20]
>> > at
>> org.apache.struts2.json.DefaultJSONWriter.write(DefaultJSONWriter.java:121)
>> ~[struts2-json-plugin-2.5.20.jar:2.5.20]
>> > at org.apache.struts2.json.JSONUtil.serialize(JSONUtil.java:140)
>> ~[struts2-json-plugin-2.5.20.jar:2.5.20]
>> > at org.apache.struts2.json.JSONUtil.serialize(JSONUtil.java:110)
>> ~[struts2-json-plugin-2.5.20.jar:2.5.20]
>> > at
>> org.apache.struts2.json.JSONInterceptor.intercept(JSONInterceptor.java:178)
>> ~[struts2-json-plugin-2.5.20.jar:2.5.20]
>> > at
>>
>com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvoc
>ation.java:249)
>> ~[struts2-core-2.5.20.jar:2.5.20]
>> > at
>>
>org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(Debug
>gingInterceptor.java:250)
>> ~[struts2-core-2.5.20.jar:2.5.20]
>> > at
>>
>com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvoc
>ation.java:249)
>> ~[struts2-core-2.5.20.jar:2.5.20]
>> > at
>>
>com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercep
>t(DefaultWorkflowInterceptor.java:179)
>> ~[struts2-core-2.5.20.jar:2.5.20]
>> > at
>>
>com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Meth
>odFilterInterceptor.java:99)
>> ~[struts2-core-2.5.20.jar:2.5.20]
>> > at
>>
>com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvoc
>ation.java:249)
>> ~[struts2-core-2.5.20.jar:2.5.20]
>> > at
>>
>com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.doIntercept
>(ConversionErrorInterceptor.java:142)
>> ~[struts2-core-2.5.20.jar:2.5.20]
>> > at
>>
>com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Meth
>odFilterInterceptor.java:99)
>> ~[struts2-core-2.5.20.jar:2.5.20]
>> > at
>>
>com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvoc
>ation.java:249)
>> 

RE: S2.5.20 Illegal reflective access by ognl.OgnlRuntime

2019-01-29 Thread Yasser Zamani
Hi Lukasz,

Just FYI I personally feel it's not related to static accesses - It seems Java 
11 warns such accesses and next Java release won't allow such accesses anymore 
i.e. current ognl won't work on them anymore.

Regards.

>-Original Message-
>From: Lukasz Lenart 
>Sent: Friday, January 25, 2019 3:14 PM
>To: Struts Users Mailing List 
>Subject: Re: S2.5.20 Illegal reflective access by ognl.OgnlRuntime
>
>Hi Burton,
>
>This probably is related to
>https://issues.apache.org/jira/browse/WW-5004
>https://issues.apache.org/jira/browse/WW-5006
>
>and you can downgrade OGNL version to 3.1.18 or wait for 2.5.21 (should be
>ready soon)
>
>
>Regards
>--
>Łukasz
>+ 48 606 323 122 http://www.lenart.org.pl/
>
>pt., 25 sty 2019 o 12:41 Burton Rhodes  napisał(a):
>>
>> After upgrading my application to JDK 11 and S2.5.20 I am receiving the
>> following warning.  Curious if there is a bug or if my resolved version of
>> ognl should be corrected in my pom.xml file
>>
>> WARNING: An illegal reflective access operation has occurred
>> WARNING: Illegal reflective access by ognl.OgnlRuntime
>> (file:/D:/m2/repository/ognl/ognl/3.1.21/ognl-3.1.21.jar) to method
>> java.util.TreeMap$Entry.getKey()
>> WARNING: Please consider reporting this to the maintainers of
>> ognl.OgnlRuntime
>> WARNING: Use --illegal-access=warn to enable warnings of further illegal
>> reflective access operations
>> WARNING: All illegal access operations will be denied in a future release
>>
>> Thanks!
>> Burton
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


Re: Java 11 support

2019-01-25 Thread Yasser Zamani
Hello and Thank you Sebastian!

Could you please continue with this workaround: downgrade OGNL to 3.1.18.

 ognl
 ognl
 3.1.18

and report if any further issue emerges? If so it's so great to fix them
as well for 2.5.21. If not, then, it's an another evidence to merge [1],
I think :)

Sincerely Yours,
Yasser.

[1] https://github.com/apache/struts/pull/315

On 1/25/2019 12:20 PM, Sebastian Götz wrote:
> Hey guys,
> 
> I can tell you now that my other problems or not related to the ASM
> configuration or Java 11.
> In the Apache JIRA I have created another issues
> (https://issues.apache.org/jira/browse/WW-5006) which is related to OGNL
> accessing static fields.
> 
> Kind regards,
> 
> Sebastian
> 
> Am 24.01.2019 um 12:13 schrieb Yasser Zamani:
>> Hi Sebastian, thanks again for your time to feed back! It's really a
>> great help.
>>
>> Regarding the web app doesn't work, it always a good practice to enable
>> devMode and set log mode to warn or at next step to debug.
>>
>> Kind Regards.
>>
>> On 1/24/2019 2:11 PM, Sebastian Götz wrote:
>>> Hello Yasser,
>>>
>>> I have followed your instructions. The exceptions are gone although my
>>> webapp does not work either.
>>> But I need more time to figure out whether this is a general
>>> compatibility issue between struts2 2.5.2 and 2.5.20 or a matter of the
>>> Java 11 compiler.
>>>
>>>
>>> Am 23.01.2019 um 08:17 schrieb Yasser Zamani:
>>>>> -Original Message-
>>>>> From: Sebastian Götz 
>>>>> Sent: Thursday, January 17, 2019 4:41 PM
>>>>> To: user@struts.apache.org
>>>>> Subject: Re: Java 11 support
>>>>>
>>>>> Hi folks,
>>>>>
>>>>> it appears that there is some work left in the convention plugin. As I 
>>>>> can see from
>>>>> my IVY resolve process this plugin drags in asm 5.2. From its sources it 
>>>>> looks like it
>>>>> supports class version up to 1.8 (class version 52).
>>>>> As we compile with JDK 11 already (class version 55) we get a lot of these
>>>>> exceptions:
>>>>>
>>>>>  java.lang.IllegalArgumentException
>>>>>     at org.objectweb.asm.ClassReader.(Unknown Source)
>>>>>     at org.objectweb.asm.ClassReader.(Unknown Source)
>>>>>     at org.objectweb.asm.ClassReader.(Unknown Source)
>>>>>     at
>>>>> org.apache.struts2.convention.DefaultClassFinder.readClassDef(DefaultClassFind
>>>>> er.java:461)
>>>>>     at
>>>>> org.apache.struts2.convention.DefaultClassFinder.(DefaultClassFinder.java:
>>>>> 93)
>>>>>     at
>>>>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildClassFind
>>>>> er(PackageBasedActionConfigBuilder.java:395)
>>>>>     at
>>>>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions(Pa
>>>>> ckageBasedActionConfigBuilder.java:377)
>>>>>     at
>>>>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionCo
>>>>> nfigs(PackageBasedActionConfigBuilder.java:333)
>>>>>     at
>>>>> org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(Classpat
>>>>> hPackageProvider.java:52)
>>>>>     at
>>>>> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(D
>>>>> efaultConfiguration.java:206)
>>>>>     at
>>>>> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(Con
>>>>> figurationManager.java:66)
>>>>>     at
>>>>> org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:957)
>>>>>     at
>>>>> org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.j
>>>>> ava:463)
>>>>>     at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:496)
>>>>>     at
>>>>> org.apache.struts2.dispatcher.InitOperations.initDispatcher(InitOperations.java:7
>>>>> 3)
>>>>>     at
>>>>> org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrep
>>>>> areAndExecuteFilter.java:61)
>>>>>     at
>>>>> eu.inform.servlet.context.URIExcludeFilter.init(URIExcludeFilter.java:37)
>>>>>     at
>>>>> org.apache.catalina.core.Applicat

Re: Java 11 support

2019-01-24 Thread Yasser Zamani
Hi Sebastian, thanks again for your time to feed back! It's really a
great help.

Regarding the web app doesn't work, it always a good practice to enable
devMode and set log mode to warn or at next step to debug.

Kind Regards.

On 1/24/2019 2:11 PM, Sebastian Götz wrote:
> Hello Yasser,
> 
> I have followed your instructions. The exceptions are gone although my
> webapp does not work either.
> But I need more time to figure out whether this is a general
> compatibility issue between struts2 2.5.2 and 2.5.20 or a matter of the
> Java 11 compiler.
> 
> 
> Am 23.01.2019 um 08:17 schrieb Yasser Zamani:
>>
>>> -Original Message-
>>> From: Sebastian Götz 
>>> Sent: Thursday, January 17, 2019 4:41 PM
>>> To: user@struts.apache.org
>>> Subject: Re: Java 11 support
>>>
>>> Hi folks,
>>>
>>> it appears that there is some work left in the convention plugin. As I can 
>>> see from
>>> my IVY resolve process this plugin drags in asm 5.2. From its sources it 
>>> looks like it
>>> supports class version up to 1.8 (class version 52).
>>> As we compile with JDK 11 already (class version 55) we get a lot of these
>>> exceptions:
>>>
>>>  java.lang.IllegalArgumentException
>>>     at org.objectweb.asm.ClassReader.(Unknown Source)
>>>     at org.objectweb.asm.ClassReader.(Unknown Source)
>>>     at org.objectweb.asm.ClassReader.(Unknown Source)
>>>     at
>>> org.apache.struts2.convention.DefaultClassFinder.readClassDef(DefaultClassFind
>>> er.java:461)
>>>     at
>>> org.apache.struts2.convention.DefaultClassFinder.(DefaultClassFinder.java:
>>> 93)
>>>     at
>>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildClassFind
>>> er(PackageBasedActionConfigBuilder.java:395)
>>>     at
>>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions(Pa
>>> ckageBasedActionConfigBuilder.java:377)
>>>     at
>>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionCo
>>> nfigs(PackageBasedActionConfigBuilder.java:333)
>>>     at
>>> org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(Classpat
>>> hPackageProvider.java:52)
>>>     at
>>> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(D
>>> efaultConfiguration.java:206)
>>>     at
>>> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(Con
>>> figurationManager.java:66)
>>>     at
>>> org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:957)
>>>     at
>>> org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.j
>>> ava:463)
>>>     at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:496)
>>>     at
>>> org.apache.struts2.dispatcher.InitOperations.initDispatcher(InitOperations.java:7
>>> 3)
>>>     at
>>> org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrep
>>> areAndExecuteFilter.java:61)
>>>     at
>>> eu.inform.servlet.context.URIExcludeFilter.init(URIExcludeFilter.java:37)
>>>     at
>>> org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig
>>> .java:270)
>>>     at
>>> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig
>>> .java:251)
>>>     at
>>> org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.ja
>>> va:102)
>>>     at
>>> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4491)
>>>     at
>>> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:51
>>> 35)
>>>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>>>     at
>>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1432
>>> )
>>>     at
>>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1422
>>> )
>>>     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
>>>     at
>>> org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorServ
>>> ice.java:75)
>>>     at
>>> java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorS
>>> ervice.java:140)
>>>     at
>>> org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
>>

Re: Java 11 support

2019-01-24 Thread Yasser Zamani


On 1/24/2019 10:28 AM, Lukasz Lenart wrote:
> śr., 23 sty 2019 o 15:49 Yasser Zamani  napisał(a):
>> I'm not sure if I get your point correctly but I didn't change `target` in 
>> [1].
>>
>> If you meant the user's itself java 11 compiled classes structure, to double 
>> verify if it works, with [1]'s local branch with a few local changes into 
>> showcase app, I compiled showcase app into a war file with JDK11. Inside the 
>> war file, I verified that showcase classes are compiled with JDK11 and 
>> WEB-INF\lib\struts-convention-plugin.jar classes are compiled with JDK7 (via 
>> viewing their .class files first 8 bytes) i.e. similar to Sebastian case. I 
>> then deployed that war into tomcat starting with java 11. I saw it launched 
>> with no error and I saw it's bean-validation-example.action (a convention 
>> configured action) works fine.
> 
> I think the proper test case scenario is as follow:
> - build Struts with  JDK7 (or JDK8 as we are going to use Java 8 in Struts 
> 2.6)
> - prepare a Convention based Struts app
> - build the app use JDK 11 (with target set to Java 11)
> - start the app and see if all the actions were properly initialised
> 
> Issue isn't with building Struts itself under JDK11 but with using
> Struts in Java 11 based application (where the source is compiled with
> JDK11)

Yes I already got the issue. As I illustrated above, I think I already
done your proposed test scenario. As I illustrated above, I had compiled
Struts showcase app with JDK11 source and target but had compiled the
rest modules (including core and plugins and etc) with JDK7 source and
target. I even had verified this in struts-showcase.war via viewing
.class files raw first 8 bytes. This same struts-showcase.war with
current 2.5 branch logs same errors which Sebastian and Paul reported.
But this same struts-showcase.war with my proposed PR launches with no
error in output and convention-based actions of it works fine.

Regards.


RE: Java 11 support

2019-01-23 Thread Yasser Zamani


>-Original Message-
>From: Lukasz Lenart 
>Sent: Wednesday, January 23, 2019 4:59 PM
>To: Struts Users Mailing List 
>Subject: Re: Java 11 support
>
>śr., 23 sty 2019 o 14:10 Yasser Zamani  napisał(a):
>> >I would start with detecting a proper Java version first. The
>> >additional constant will introduce unneeded burden for users to control it.
>>
>> Fortunately it seems it isn't required. Locally all tests are passing here 
>> with all
>java versions (7,8,9,11) for [1].
>
>The case is that we target JDK7 in pom.xml, once changed to JDK11 a class
>structure will change and having just ASM7 on classpath won't help.

I'm not sure if I get your point correctly but I didn't change `target` in [1].

If you meant the user's itself java 11 compiled classes structure, to double 
verify if it works, with [1]'s local branch with a few local changes into 
showcase app, I compiled showcase app into a war file with JDK11. Inside the 
war file, I verified that showcase classes are compiled with JDK11 and 
WEB-INF\lib\struts-convention-plugin.jar classes are compiled with JDK7 (via 
viewing their .class files first 8 bytes) i.e. similar to Sebastian case. I 
then deployed that war into tomcat starting with java 11. I saw it launched 
with no error and I saw it's bean-validation-example.action (a convention 
configured action) works fine.

Regards.

[1] https://github.com/apache/struts/pull/315


RE: Java 11 support

2019-01-23 Thread Yasser Zamani


>-Original Message-
>From: Lukasz Lenart 
>Sent: Wednesday, January 23, 2019 11:34 AM
>To: Struts Users Mailing List 
>Subject: Re: Java 11 support
>
>śr., 23 sty 2019 o 08:35 Yasser Zamani  napisał(a):
>> I would prefer to allow user to optionally override the default Opcodes.ASM5
>via a constant in struts.xml e.g. value=" Opcodes.ASM7"/>, Or more better, to think if it's possible to 
>determine it
>at runtime via user's runtime context e.g. java version. Wdyt?
>
>I would start with detecting a proper Java version first. The additional 
>constant
>will introduce unneeded burden for users to control it.

Fortunately it seems it isn't required. Locally all tests are passing here with 
all java versions (7,8,9,11) for [1].

Kind Regards.

[1] https://github.com/apache/struts/pull/315
"According to ASM7's source codes, it seems it uses passed api version only to 
check if it should throw an unsupported exception or not (i.e. doesn't have any 
effect on functionality and somehow is just a validation). So, as we upgrade to 
asm.version=7.0 for default then I think it's OK to upgrade Opcodes.ASM5 to 
Opcodes.ASM7 as well. It only breaks when user manually exclude ASM7 dependency 
with an older version which is not usually expected."

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


RE: Java 11 support

2019-01-22 Thread Yasser Zamani


>-Original Message-
>From: Lukasz Lenart 
>Sent: Tuesday, January 22, 2019 12:03 PM
>To: Struts Users Mailing List 
>Subject: Re: Java 11 support
>
>Ok, thanks. I see your point now, but this can be hard to support as we must
>support Java 7 (or Java 8 in case of Struts 2.6) and at the same time Java 11 
>- I
>think we will have to develop a dedicated plugin that will replace ClassFinder 
>in
>the Convention plugin in case of Java 11.
>

Hi Łukasz,

I would prefer to allow user to optionally override the default Opcodes.ASM5 
via a constant in struts.xml e.g. , Or more better, to think if it's possible to determine 
it at runtime via user's runtime context e.g. java version. Wdyt?

Kind Regards.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


RE: Java 11 support

2019-01-22 Thread Yasser Zamani


>-Original Message-
>From: Paul Zepernick 
>Sent: Friday, January 18, 2019 4:24 PM
>To: Struts Users Mailing List 
>Subject: RE: Java 11 support
>
>I can confirm that this was the same error I was seeing when trying Java 11 
>using
>Struts 2.5.18.  It is happening in the convention pluggin on the startup of the
>server when it scans for actions to configure Struts.  It is not a compile 
>issue, but
>happening at runtime.
>

Hi Paul,

Thanks for your time!

Could you please check if any further issue persists with my solution posted in 
previous mail in list (beside the workaround for drop-in ASM7 dependency)? I 
think "This feature requires ASM7" will vanished with it but I'm not 
comprehensively sure if any further issue arises after. If so, it would be nice 
to fix them in 2.5.21 as well (beside asm.version=7.0).

Thanks in advance!

Kind Regards.


RE: Java 11 support

2019-01-22 Thread Yasser Zamani


>-Original Message-
>From: Sebastian Götz 
>Sent: Thursday, January 17, 2019 4:41 PM
>To: user@struts.apache.org
>Subject: Re: Java 11 support
>
>Hi folks,
>
>it appears that there is some work left in the convention plugin. As I can see 
>from
>my IVY resolve process this plugin drags in asm 5.2. From its sources it looks 
>like it
>supports class version up to 1.8 (class version 52).
>As we compile with JDK 11 already (class version 55) we get a lot of these
>exceptions:
>
>  java.lang.IllegalArgumentException
>     at org.objectweb.asm.ClassReader.(Unknown Source)
>     at org.objectweb.asm.ClassReader.(Unknown Source)
>     at org.objectweb.asm.ClassReader.(Unknown Source)
>     at
>org.apache.struts2.convention.DefaultClassFinder.readClassDef(DefaultClassFind
>er.java:461)
>     at
>org.apache.struts2.convention.DefaultClassFinder.(DefaultClassFinder.java:
>93)
>     at
>org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildClassFind
>er(PackageBasedActionConfigBuilder.java:395)
>     at
>org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions(Pa
>ckageBasedActionConfigBuilder.java:377)
>     at
>org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionCo
>nfigs(PackageBasedActionConfigBuilder.java:333)
>     at
>org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(Classpat
>hPackageProvider.java:52)
>     at
>com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(D
>efaultConfiguration.java:206)
>     at
>com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(Con
>figurationManager.java:66)
>     at
>org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:957)
>     at
>org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.j
>ava:463)
>     at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:496)
>     at
>org.apache.struts2.dispatcher.InitOperations.initDispatcher(InitOperations.java:7
>3)
>     at
>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrep
>areAndExecuteFilter.java:61)
>     at
>eu.inform.servlet.context.URIExcludeFilter.init(URIExcludeFilter.java:37)
>     at
>org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig
>.java:270)
>     at
>org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig
>.java:251)
>     at
>org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.ja
>va:102)
>     at
>org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4491)
>     at
>org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:51
>35)
>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>     at
>org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1432
>)
>     at
>org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1422
>)
>     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
>     at
>org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorServ
>ice.java:75)
>     at
>java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorS
>ervice.java:140)
>     at
>org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
>     at
>org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>     at
>org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1432
>)
>     at
>org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1422
>)
>     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
>     at
>org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorServ
>ice.java:75)
>     at
>java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorS
>ervice.java:140)
>     at
>org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
>     at
>org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:261)
>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>     at
>org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>     at
>org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:801)
>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>     at org.apache.catalina.startup.Catalina.start(Catalina.java:695)
>     at
>java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
>Method)
>     at
>java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodA
>ccessorImpl.java:62)
>     at
>java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Delegating
>MethodAccessorImpl.java:43)
>     at java.base/java.lang.reflect.Method.invoke(Method.java:566)

RE: Java 11 support

2019-01-15 Thread Yasser Zamani
Hi Sebastian,

Yes the release will be ready this month hopefully this week already ☺

Kind Regards.


From: Sebastian Götz 
Sent: Tuesday, January 15, 2019 10:51 AM
To: Yasser Zamani 
Subject: Re: Java 11 support

Hi Yasser,

sure! We are not in a hurry :-) but really looking forward to this release. I 
tried with the 2.5.18 yesterday.
But then I will await the 2.5.20 release with pleasure.

I know this sort of question sucks but will the release be ready this month 
already or will it take somewhat longer.

Kind regards,

Sebastian
Am 14.01.2019 um 19:06 schrieb Yasser Zamani:

Hi Sebastian,



I'm pleased to announce it seems we were able to add both java 9 and 11

supports into Struts 2.5.20. Could you please wait a few days for its

release and then test the bits? It currently can pass all tests with all

jdks (see [1]) but it's so great if you will be able to test it in

production also.



Thanks for using Struts!



Kind Regards.



[1] https://travis-ci.org/apache/struts/builds/456910100





On 1/14/2019 11:13 AM, Sebastian Götz wrote:

Hello all.



I searched through the website and the issue tracker to find any roadmap

info concerning Java 11 support.

At the moment I try upgrading our webapp to Tomcat 9 with OpenJDK 11. I

now from past upgrades that we had to use a Java8-support-plugin for a

while.

Now with JDK 11 it looks a bit more complex getting the Java 9 module

stuff together correctly. But I think someone must have a plan for this

migration.



So the question is: how and when is it going to be possible to use

struts2 with Java 11?



Kind regards



Sebastian Götz





-

To unsubscribe, e-mail: 
user-unsubscr...@struts.apache.org<mailto:user-unsubscr...@struts.apache.org>

For additional commands, e-mail: 
user-h...@struts.apache.org<mailto:user-h...@struts.apache.org>

--
Mit freundlichen Grüßen

Sebastian Götz

iNFORM Technology GmbH
Niederlassung Albstadt
Berliner Straße 24
72458 Albstadt-Ebingen

Tel: +49 7431 9816090
Fax: +49 7431 9816092
s.go...@inform-technology.de<mailto:s.go...@inform-technology.de>
http://www.inform-technology.de/

*

Zentrale Stockach:
Bodenseeallee 18
D-78333 Stockach
Tel: +49 7771 9282 494

*

Geschäftsführer: Dipl.-Ing. (FH) Heinz Roth | Handelsregister: HRB 715948, 
Amtsgericht Freiburg | USt-ID Nr.: DE312290945

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. 
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten 
haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. 
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht 
gestattet.

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error) please 
notify the sender immediately and destroy this e-mail. Any unauthorised 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden.


Re: Java 11 support

2019-01-14 Thread Yasser Zamani
Hi Sebastian,

I'm pleased to announce it seems we were able to add both java 9 and 11
supports into Struts 2.5.20. Could you please wait a few days for its
release and then test the bits? It currently can pass all tests with all
jdks (see [1]) but it's so great if you will be able to test it in
production also.

Thanks for using Struts!

Kind Regards.

[1] https://travis-ci.org/apache/struts/builds/456910100


On 1/14/2019 11:13 AM, Sebastian Götz wrote:
> Hello all.
> 
> I searched through the website and the issue tracker to find any roadmap
> info concerning Java 11 support.
> At the moment I try upgrading our webapp to Tomcat 9 with OpenJDK 11. I
> now from past upgrades that we had to use a Java8-support-plugin for a
> while.
> Now with JDK 11 it looks a bit more complex getting the Java 9 module
> stuff together correctly. But I think someone must have a plan for this
> migration.
> 
> So the question is: how and when is it going to be possible to use
> struts2 with Java 11?
> 
> Kind regards
> 
> Sebastian Götz
> 

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


RE: Context parameters not being ignored?

2019-01-05 Thread Yasser Zamani
Hi Micael, Happy New Year :)

With a glance on stack traces, I saw the second isn't an injection but is a 
copy-paste operation from prior action to next action by ChainingInterceptor. 
i.e. it seems you have a cyclic chain result or a chain result between two 
actions that both have fooService. Please consider some analysis on your chain 
results then I think you may find some trifles to fix.

Thanks for using Struts!

Regards.

>-Original Message-
>From: Micael Carreira 
>Sent: Wednesday, January 2, 2019 6:37 PM
>To: user@struts.apache.org
>Subject: Re: Context parameters not being ignored?
>
>Sorry for the delay in replying, I was on holidays. By the way, have a happy 
>new
>year :)
>
>Here is the stack trace of both injections:
>https://pastebin.com/6wMpWK8a
>
>Cheers,
>Micael
>
>On 22/12/18 08:19, Yasser Zamani wrote:
>> Hi Micael,
>>
>> I think putting a breakpoint on OtherAction.setFooService and probing
>> the full stack trace when the execution hits it for second time would
>> help to reveal what and who's the villain of second injection :)
>>
>> Regards.
>>
>>> -Original Message-
>>> From: Micael Carreira 
>>> Sent: Thursday, December 20, 2018 10:55 PM
>>> To: user@struts.apache.org
>>> Subject: Context parameters not being ignored?
>>>
>>> Hello,
>>>
>>> I'm using Struts2 with Spring. I have the following action:
>>>
>>>      SomeAction
>>>        |- FooService
>>>
>>> But in my bean definition I don't have the FooService dependency
>>> because SomeAction doesn't use it:
>>>
>>>      
>>>
>>> (Putting it this way doesn't make much sense, the real configuration
>>> is more complex than this, but this is the simplest example on how
>>> the problem can be
>>> reproduced)
>>>
>>> Then my struts.xml redirects to a jsp result:
>>>
>>>      
>>>          /jsp/some.jsp
>>>      
>>>
>>>
>>> And some.jsp calls other action:
>>>
>>>      >> ignoreContextParams="true">
>>>
>>> But OtherAction actually needs FooService as a dependency, and its
>>> bean definition reflects that:
>>>
>>>      
>>>          
>>>      
>>>
>>> I noticed that when OtherAction gets instantiated through jsp
>>> parsing, it first gets set with the correct fooService dependency.
>>>
>>> However, after that, fooService then gets set with null. So
>>> OtherAction won't be able to correctly run.
>>>
>>> I already assessed that the second injection is the value that is
>>> present in SomeAction.
>>>
>>> But I don't want this value injected. It shouldn't be injected if I'm
>>> running OtherAction with ignoreContextParams="true", right?
>>>
>>> I have been all day around this problem, so any help would be much
>appreciated.
>>>
>>> Cheers,
>>> Micael
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org



RE: How to display both selected key and value of s:select

2018-12-24 Thread Yasser Zamani
Hi Albert,

The simplest method can be something like this:

public class RegisterAction {
...
public Country getSelectedCountryObject() {
foreach (c in countryList) if(c.countryId==selectedCountry) return c;
}
...
}



Thanks for using Struts.

Kind Regards.

>-Original Message-
>From: albert kao 
>Sent: Saturday, December 22, 2018 6:39 PM
>To: Struts Users Mailing List 
>Subject: How to display both selected key and value of s:select
>
>I want to display both selected key and value of s:select.
>e.g. for the following codes, after I select key="2", value="Canada"
>and press the submit button.
>Only the key "Country: 2" is displayed in the registerResult.jsp as desired.
>How to make the value "Canada" to display also in the browser?
>
>public class RegisterAction extends ActionSupport { private String country,
>selectedCountry; private ArrayList countryList;
>
>public RegisterAction() {
>countryList = new ArrayList();
>countryList.add(new Country(1, "India")); countryList.add(new Country(2,
>"Canada")); countryList.add(new Country(3, "US")); return; } }
>
>public class Country {
>private int countryId;
>private String countryName;
>public Country(int countryId, String countryName) { this.countryId = countryId;
>this.countryName = countryName; } public int getCountryId() { return 
>countryId; }
>public void setCountryId(int countryId) { this.countryId = countryId; } public 
>String
>getCountryName() { return countryName; } public void setCountryName(String
>countryName) { this.countryName = countryName; } }
>
>register.jsp
>
>
>listValue="countryName"
>value="selectedCountry"
>headerKey="0" headerValue="Country"
>label="Select a country" />
>
>
>
>
>
>registerResult.jsp
>Country:  selectedCountry:
> CountryListAll: value="getCountryList()" /> CountryListAll2: value="countryList" /> CountryList: value="getCountryList().get(country)" /> CountryList.get value="countryList.get(country)" />
>
>
>http://localhost:8080/Struts2Example/register.action
>Country: 2
>selectedCountry: CountryListAll: [com.test.common.Country@32cdbdf6,
>com.test.common.Country@6cbe3d89, com.test.common.Country@7abf043f]
>CountryListAll2: [com.test.common.Country@32cdbdf6,
>com.test.common.Country@6cbe3d89, com.test.common.Country@7abf043f]
>CountryList: com.test.common.Country@7abf043f CountryList.get
>com.test.common.Country@7abf043f


RE: [ask] How to pass multiple radio button in struts2

2018-12-22 Thread Yasser Zamani
Hi,

As different values are setting into same viewAccess[0], I guess instead 
`private String viewAccess[][];` (array of array) would work.

Regards. 

>-Original Message-
>From: M Huzaifah 
>Sent: Friday, December 21, 2018 11:44 AM
>To: Struts Users Mailing List 
>Subject: [ask] How to pass multiple radio button in struts2
>
>Hi Members,
>
>i would like to ask something about radio button in strtus2.
>
>i have radio button in jsp like this:
>
>
>
>All
>Self
>Custom
>
>
>
>All
>Self
>Custom
>
>
>and in my JavaAction class i add property " private String viewAccess[]; “ 
>also with
>setter and getter.
>
>the problem is, i am not able to get value of radio button in Java Action. i 
>use
>struts 2.3.35
>
>someone could help?
>
>Thank you



RE: Context parameters not being ignored?

2018-12-22 Thread Yasser Zamani
Hi Micael,

I think putting a breakpoint on OtherAction.setFooService and probing the full 
stack trace when the execution hits it for second time would help to reveal 
what and who's the villain of second injection :)

Regards.

>-Original Message-
>From: Micael Carreira 
>Sent: Thursday, December 20, 2018 10:55 PM
>To: user@struts.apache.org
>Subject: Context parameters not being ignored?
>
>Hello,
>
>I'm using Struts2 with Spring. I have the following action:
>
>     SomeAction
>       |- FooService
>
>But in my bean definition I don't have the FooService dependency because
>SomeAction doesn't use it:
>
>     
>
>(Putting it this way doesn't make much sense, the real configuration is more
>complex than this, but this is the simplest example on how the problem can be
>reproduced)
>
>Then my struts.xml redirects to a jsp result:
>
>     
>         /jsp/some.jsp
>     
>
>
>And some.jsp calls other action:
>
>     ignoreContextParams="true">
>
>But OtherAction actually needs FooService as a dependency, and its bean
>definition reflects that:
>
>     
>         
>     
>
>I noticed that when OtherAction gets instantiated through jsp parsing, it 
>first gets
>set with the correct fooService dependency.
>
>However, after that, fooService then gets set with null. So OtherAction won't 
>be
>able to correctly run.
>
>I already assessed that the second injection is the value that is present in
>SomeAction.
>
>But I don't want this value injected. It shouldn't be injected if I'm running
>OtherAction with ignoreContextParams="true", right?
>
>I have been all day around this problem, so any help would be much appreciated.
>
>Cheers,
>Micael
>
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org



RE: default interceptor overriding parent package default interceptor

2018-12-15 Thread Yasser Zamani
Hi Steven,

We have similar config at showcase [1]. I putted a breakpoint at [2]. It works 
as expected i.e. for "index" action it hits break point as not a first 
interceptor but for "skill/save" action it hits it as the first interceptor.

Does issue persist with latest Struts 2.3.x version? Could you check with 
latest 2.5.x version? If in both the issue persists, then you may miss 
something in your app or checking method.

Regards.

[1] 
https://github.com/apache/struts/blob/414719171ae14b215537c1c17f8e0e6d34ec5c19/apps/showcase/src/main/resources/struts.xml#L132
[2] 
https://github.com/apache/struts/blob/414719171ae14b215537c1c17f8e0e6d34ec5c19/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java#L62


>-Original Message-
>From: Steven Yang 
>Sent: Wednesday, December 12, 2018 12:56 PM
>To: Struts Users Mailing List 
>Subject: default interceptor overriding parent package default interceptor
>
>Hi
>I have the following setup of my struts2 xml.
>
>in cus.xml
>
>...no interceptors 
> defined,
>using interceptors form defaultPackage
>
>in cus-cus.xml
>
>   
>   
>  
>new interceptors
>  
>  
>  
>
>
>But all now all the Actions defined in cus.xml uses the newInterceptorStack as 
>the
>default interceptor.
>I only want the Actions defined in cus-cus.xml to use the newInterceptorStack 
>as
>the default interceptor.
>
>Using Struts 2.3.x
>
>Please advice
>
>Thanks


RE: Ask - "Reloading all providers." everytime invoce action.

2018-12-12 Thread Yasser Zamani
Hi,

Sorry this is a bug in 2.5.18 which only occurs in development mode, so, the 
easiest workaround is to set struts.configuration.xml.reload to false.

This bug already has fixed [1] and will be released soon with 2.5.19.

Regards.

[1] https://issues.apache.org/jira/browse/WW-4974

>-Original Message-
>From: M Huzaifah 
>Sent: Wednesday, December 12, 2018 12:37 PM
>To: user@struts.apache.org
>Subject: Ask - "Reloading all providers." everytime invoce action.
>
>Dear All,
>
>I already migrate from struts 2.3 to 2.5.18 successfully, i also integrate 
>struts2
>with spring (autowired capability). i found somethin strange in my console. 
>what i
>found is everytime request action, in console always show this log:
>
> "[INFO  2018-12-12 15:46:29,369]
>com.opensymphony.xwork2.config.ConfigurationManager | Detected container
>provider [Struts XML configuration provider (struts-default.xml)] needs to be
>reloaded. Reloading all providers."
>
>in struts2.3 theres no log like that. this will effect rendering time in 
>browser,
>theres lag when load the result page.
>
>my action use interceptor for authorization, in the interceptor class i use
>
>
> WebApplicationContext wac =
>WebApplicationContextUtils.getWebApplicationContext(request.getServletConte
>xt());
>
>BeanService beanService = wac.getBean(BeanService.class);
>
>
>to get my bean from spring ioc.
>
>theres is explanation about this??
>
>i am using log4j2 for my log. this is the complete log what i’ve got:
>
>
>[INFO  2018-12-12 16:04:37,138]
>com.opensymphony.xwork2.config.ConfigurationManager | Detected container
>provider [Struts XML configuration provider (struts-default.xml)] needs to be
>reloaded. Reloading all providers.
>[INFO  2018-12-12 16:04:37,557]
>org.apache.struts2.spring.StrutsSpringObjectFactory | Initializing 
>Struts-Spring
>integration...
>[INFO  2018-12-12 16:04:37,557]
>com.opensymphony.xwork2.spring.SpringObjectFactory | Setting autowire
>strategy to name [INFO  2018-12-12 16:04:37,558]
>org.apache.struts2.spring.StrutsSpringObjectFactory | ... initialized 
>Struts-Spring
>integration successfully [WARN  2018-12-12 16:04:37,700]
>com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>found for name = enableSMD [WARN  2018-12-12 16:04:37,700]
>com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>found for name = enableSMD [WARN  2018-12-12 16:04:37,700]
>com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>found for name = enableSMD [WARN  2018-12-12 16:04:37,700]
>com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>found for name = enableSMD [WARN  2018-12-12 16:04:37,701]
>com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>found for name = enableSMD [WARN  2018-12-12 16:04:37,701]
>com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>found for name = enableSMD invoke intercept() INFO | [Begin] execute method
>index()  INFO | [end] execute method index() [INFO  2018-12-12 16:04:38,557]
>com.opensymphony.xwork2.config.ConfigurationManager | Detected container
>provider [Struts XML configuration provider (struts-default.xml)] needs to be
>reloaded. Reloading all providers.
>[INFO  2018-12-12 16:04:38,768]
>org.apache.struts2.spring.StrutsSpringObjectFactory | Initializing 
>Struts-Spring
>integration...
>[INFO  2018-12-12 16:04:38,771]
>com.opensymphony.xwork2.spring.SpringObjectFactory | Setting autowire
>strategy to name [INFO  2018-12-12 16:04:38,773]
>org.apache.struts2.spring.StrutsSpringObjectFactory | ... initialized 
>Struts-Spring
>integration successfully [WARN  2018-12-12 16:04:38,895]
>com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>found for name = enableSMD [WARN  2018-12-12 16:04:38,895]
>com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>found for name = enableSMD [WARN  2018-12-12 16:04:38,896]
>com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>found for name = enableSMD [WARN  2018-12-12 16:04:38,896]
>com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>found for name = enableSMD [WARN  2018-12-12 16:04:38,896]
>com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>found for name = enableSMD [WARN  2018-12-12 16:04:38,897]
>com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>found for name = enableSMD [INFO  2018-12-12 16:04:39,028]
>com.opensymphony.xwork2.config.ConfigurationManager | Detected container
>provider [Struts XML configuration provider (struts-default.xml)] needs to be
>reloaded. Reloading all providers.
>[INFO  2018-12-12 16:04:39,186]
>org.apache.struts2.spring.StrutsSpringObjectFactory | Initializing 
>Struts-Spring
>integration...
>[INFO  2018-12-12 16:04:39,186]
>com.opensymphony.xwork2.spring.SpringObjectFactory | Setting autowire
>strategy to name [INFO  2018-12-12 16:04:39,186]

RE: Apache Struts 2.3.x End-Of-Life (EOL) Announcement

2018-12-03 Thread Yasser Zamani
Hi Siva,

Yes you need to upgrade to latest released version and you have six months' 
time to do this. After that, Struts 2.3.x loses any support even security fixes!

Thanks for using Struts!

Regards.

>-Original Message-
>From: Gopal, Siva Prakash (US - Mechanicsburg Delivery)
>
>Sent: Tuesday, December 4, 2018 1:28 AM
>To: Struts Users Mailing List 
>Subject: Apache Struts 2.3.x End-Of-Life (EOL) Announcement
>
>Hi Team,
>
>As per announcement (https://struts.apache.org/struts23-eol-announcement  ) ,
>struts 2.3.X is reaching EOL.
>
>Currently we are using struts version - struts2-core-2.3.35.  Do we need to get
>upgrade to struts 2.5.X version or some other version to get continue struts
>framework and security fix support further.
>
>Thanks,
>Siva
>
>
>This message (including any attachments) contains confidential information
>intended for a specific individual and purpose, and is protected by law. If 
>you are
>not the intended recipient, you should delete this message and any disclosure,
>copying, or distribution of this message, or the taking of any action based on 
>it,
>by you is strictly prohibited.
>
>v.E.1

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts 2.5.x support above Java 8

2018-11-19 Thread Yasser Zamani
Hi Paul,

I'm pleased to announce it seems we were able to add both java 9 and 11 
supports into Struts 2.5.19. Could you please wait for its release and then 
tests the bits? It currently can pass all tests with all jdks (see [1]) but 
it's so great if you will be able to test it in production also.

Regards.

[1] https://travis-ci.org/apache/struts/builds/456910100

>-Original Message-
>From: David Dillard 
>Sent: Monday, November 12, 2018 6:09 PM
>To: Struts Users Mailing List 
>Subject: RE: [EXTERNAL] Re: Struts 2.5.x support above Java 8
>
>True, however just because someone made the choice to use them (knowing that
>they would be supported for six months each) and to continue using them doesn’t
>mean Struts has to support those people.
>
>
>-Original Message-
>From: Dave Newton 
>Sent: Sunday, November 11, 2018 11:17 AM
>To: Struts Users Mailing List 
>Subject: Re: [EXTERNAL] Re: Struts 2.5.x support above Java 8
>
>Determining support is fraught, because people run on all sorts of JVMs, 
>including
>EOLed versions :/
>
>On Sun, Nov 11, 2018 at 10:01 AM David Dillard 
>wrote:
>
>> > We do plan support JDK 9 and JDK 11 as from Struts 2.6 (in
>> > development),
>> maybe we will be able to port those changes into 2.5.x branch but we
>> will see.
>>
>> Really no point in supporting JDK 9 or 10 as they are now EOL.  JDK 11
>> support would be great.
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>
>
>--
>em: davelnew...@gmail.com
>mo: 908-380-8699
>tw: @dave_newton 
>li: dave-newton 
>gh: davelnewton 
>so: Dave Newton 
>bl: Bucky Bits 
>sk: davelnewton_skype
>B
>KK
>KKCB  [  X  ܚX KK[XZ[
>
> \ \ ][  X  ܚX P  ]˘\X K ܙ B  ܈Y][ۘ[  [X[  K[XZ[
>
> \ \ Z[  ]˘\X K ܙ B

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


Re: Not escaping HTML in checkbox Tag

2018-11-17 Thread Yasser Zamani
Hi Marc,

There is a same question at [1]. Does it's answer satisfy your question?

Regards.

[1] 
https://stackoverflow.com/questions/19324332/struts-2-0-allow-html-in-label-of-scheckbox
On Nov 16, 2018, at 3:17 PM, Marc Michele 
mailto:develo...@tiv-consulting.de>> wrote:

Hello list,

my problem is that i have a message resource key defined like this:

message.privacy=Die Datenschutzerklärung

when i use it in text tag like this:



all is ok an html is not escaped

but when i used it in checkbox tag like this:



html is escaped an my link is not working

is there a way to disable escaping on checkbox tag, i search the hole
documentation and i found nothing to disable escaping





To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Question Regarding Recent Security Announcement

2018-11-04 Thread Yasser Zamani
Hi David,

That was a typo which already has fixed and re-announced. We meant 1.3.3. 
Thanks for your email.

Regards.

>-Original Message-
>From: David Dillard 
>Sent: Sunday, November 4, 2018 9:10 PM
>To: user@struts.apache.org
>Subject: Question Regarding Recent Security Announcement
>
>Hi,
>
>An emailannounce/201811.mbox/%3cCAMopvkMgZiJ+ZkT1HmkQt94q7-
>bzNWnZm0Td9vq589vz5YM=m...@mail.gmail.com%3e> was recently sent to the
>Apache Announcements list suggesting that users update to Apache Struts 2.3.36
>in order to update to Apache Commons Fileupload 1.3.3 due to a potential DoS.  
>I
>have a few questions about this:
>
>
>  1.  Per the Maven repository, Struts 2.3.36 recommends Fileupload 1.3.2 be
>usedcore/2.3.36>, not 1.3.3, so I'm confused about what's stated in the email.  
>What's
>recommended doesn't seem to accomplish what the email states it will.
>  2.  The recommendation for Fileupload 1.3.2 can be found in the Maven
>repository since Struts 2.3.30, which was released back in July 2016.
>  3.  This makes sense since the last documented DoS vulnerability in 
> Fileupload
>was fixed in 1.3.2.
>
>So, given all of this, can someone explain why this recommendation was made
>and why now since the noted issues to have been resolved for a couple of years?
>
>
>Thanks,
>
>David


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: A book of Struts

2018-10-29 Thread Yasser Zamani
>From: Lukasz Lenart 
>Sent: Sunday, October 28, 2018 1:42 PM
>To: Struts Users Mailing List 
>Subject: Re: A book of Struts
>
>czw., 25 paź 2018 o 15:03 Dave Newton  napisał(a):
>> I'd probably keep Spring in the first book since basic integration is
>> pretty simple, and a lot of people use the two together.
>>
>> I think the only potentially-missing thing (and I say potentially
>> because it might belong in either basic or the advanced or both) is testing.
>
>Yeah, this is a great idea, unit testing - just added it to the book.
>

+1 I like testing section idea. FYI I have some clean nice interesting 
practices done in it such as:

* Integrating Spring, Struts, Hibernate and DBUnit to work properly together to 
test an application via extending them.
* Having an in-memory from-scratch database for each test to keep tests 
independent from environment.
* How to disable that database foreign keys in tests.
* How to initialize that database with data via XML files for each test.

Regards.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


RE: A book of Struts

2018-10-17 Thread Yasser Zamani
Wow! No idea but please feel free to count on me (if you liked) on any aspect 
of the book where I'm able to assist (if you needed or wished any).

Kind regards.

>-Original Message-
>From: Lukasz Lenart 
>Sent: Wednesday, October 17, 2018 11:08 AM
>To: Struts Users Mailing List 
>Subject: A book of Struts
>
>Hi everyone,
>
>I would like to (finally ;-) write a book about the latest version of the 
>Apache
>Struts, probably targeting Struts 2.6. I wonder what kind of book this should 
>be:
>- an introduction from zero to a full blown app
>- a 101 good practices/examples
>- any other idea
>
>I hope you will give me some positive feedback to start working on this task :)
>
>
>Kind regards
>--
>Łukasz
>+ 48 606 323 122 http://www.lenart.org.pl/
>
>-
>To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>For additional commands, e-mail: user-h...@struts.apache.org



[ANN] Apache Struts 2.3.36 GA

2018-10-15 Thread Yasser Zamani
The Apache Struts group is pleased to announce that Struts 2.3.36 is available 
as a "General Availability" release. The GA designation is our highest quality 
grade.

Apache Struts 2 is an elegant, extensible framework for creating 
enterprise-ready Java web applications. The framework is designed to streamline 
the full development cycle, from building, to deploying, to maintaining 
applications over time.

This release addresses one backward compatibility issue. Below is a full list 
of all changes:
- xml-validation fails since struts 2.5.17
- MD5 and SHA1 should no longer be provided on download pages

Internal Changes:
- XWorkList was moved into a com.opensymphony.xwork2.conversion.impl
package as com.opensymphony.xwork2.util package is excluded by the Internal 
Security Mechanism.

Please read the Version Notes to find more details about performed bug fixes 
and improvements.
https://cwiki.apache.org/confluence/display/WW/Version+Notes+2.3.36

All developers are strongly advised to perform this action.

The 2.3.x series of the Apache Struts framework has a minimum requirement of 
the following specification versions: Servlet API 2.4, JSP API 2.0, and Java 6.

Should any issues arise with your use of any version of the Struts framework, 
please post your comments to the user list, and, if appropriate, file a 
tracking ticket.

You can download this version from our download page.
https://struts.apache.org/download.cgi#struts-23x


Kind regards.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Hidden Field Name for Token For Struts 1.3

2018-10-09 Thread Yasser Zamani



On 2018/09/25 15:41:47, hanzhid...@gmail.com  wrote: 
> Hi,
> Struts version: 1.3
> 
> Currently our web application is using  struts tag  on the jsp 
> page. This tag will generate the html response with the hidden form field 
> org.apache.struts.taglib.html.TOKEN.  This field is used for storing CSRF 
> token. We are concerned that public user accessing our web application will 
> see this field name at the browser side, and able to know that our backend 
> application is using struts. This could lead to security risk.
> 
> We would like to know if struts 1.3 allows developer to change the name of 
> the generated hidden field for storing token, so that we can change the use 
> name to other than org.apache.struts.taglib.html.TOKEN.  
> 

I don't think so as even Struts 2 doesn't have such feature. Struts 1 isn't 
supported due to EOL but thanks a lot for your tip which can being applied on 
Struts 2.

Regards.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Struts2 - multipart/related - HttpServletRequest#getParts not working

2018-10-09 Thread Yasser Zamani
I see Struts REST plugin has a handler for multipart request but it and even 
the whole Struts framework also talks only about multipart/form-data ;) 
Unfortunately it seems Struts doesn't know such content type at all. Anyway, 
some tips can be found in net via googling "UT010016: Not a multi part request".

Regards.

>-Original Message-
>From: Nikhil P Kookkiri 
>Sent: Tuesday, October 9, 2018 10:05 AM
>To: Struts Users Mailing List ; Yasser Zamani
>
>Subject: Re: Struts2 - multipart/related - HttpServletRequest#getParts not
>working
>
>
>Hi Yesser, thanks for your response. Yes, it is the issue with the servlet. I 
>am
>suspecting that MutiPartConfig works only for multipart/form-data and does not
>work with multipart/related. I passed the request directly to HttpServlet 
>instead
>of Sturts mapped Action with @MultiPartConfig configured and I got the
>exception:
>javax.servlet.ServletException: UT010016: Not a multi part request.
>Almost all documentation I saw talks only about multipart/form-data.
>
>I am assuming using Struts rest plugin also will not help in this case.
>Kindly let me know.
>
>Best regards,
>Nikhil P kookkiri
>
>On Tuesday 09 October 2018 11:02 AM, Yasser Zamani wrote:
>> This isn't Struts issue but your underlying servlet message. Anyway, what 
>> about
>trying Struts itself file upload feature. Then ask that another app to http 
>post the
>file to a file upload action.
>>
>> Regards.
>>
>>> -Original Message-
>>> From: Nikhil P Kookkiri 
>>> Sent: Monday, October 8, 2018 12:37 PM
>>> To: user@struts.apache.org
>>> Subject: Struts2 - multipart/related - HttpServletRequest#getParts
>>> not working
>>>
>>> I have request coming from another application which is
>>> 'multipart/related'. In the mutlipart request body, I am receiving
>>> image/jpeg and application/xml. I suppose, I should be iterating over
>>> the http part obtained from getPaths method in the HttpServletRequest
>>> object and read the stream available on each of the parts. When I try doing
>that, I am getting the following error:
>>>
>>> java.lang.IllegalStateException: UT010057: multipart config was not
>>> present on Servlet ERROR [stderr] (default task-2)     at
>>> io.undertow.servlet//io.undertow.servlet.spec.HttpServletRequestImpl.
>>> verifyMul
>>> tipartServlet(HttpServletRequestImpl.java:523)
>>> ERROR [stderr] (default task-2)     at
>>> io.undertow.servlet//io.undertow.servlet.spec.HttpServletRequestImpl.
>>> getParts(
>>> HttpServletRequestImpl.java:512)
>>> ERROR [stderr] (default task-2)     at
>>> javax.servlet.api//javax.servlet.http.HttpServletRequestWrapper.getPa
>>> rts(HttpSer
>>> vletRequestWrapper.java:375)
>>>
>>> Please let me know the best possible solution for this.
>>>
>>> Here is what I am doing in the code:
>>>
>>>      public class TestMultiPart extends ActionSupport implements
>>> ServletRequestAware
>>>      {
>>>          private InputStream inputStream;
>>>          private HttpServletRequest request;
>>>
>>>      public String execute()
>>>      {
>>>          BufferedInputStream bis = null;
>>>          BufferedOutputStream bos = null;
>>>          try
>>>          {
>>>              Collection parts = request.getParts();
>>>              for(Part part : parts)
>>>              {
>>>                  String contentType = part.getContentType();
>>>                  System.out.println("Content type is: " +
>>> contentType);
>>>                  File file =
>>> getFileToDownload(getContentType(contentType));
>>>                  if(file != null)
>>>                  {
>>>                      bis = new
>>> BufferedInputStream(request.getInputStream());
>>>                      bos = new BufferedOutputStream(new
>>> FileOutputStream(file));
>>>                      byte[] bytes = new byte[bis.available()];
>>>                      while(bis.read(bytes) > 0)
>>>                      {
>>>                          bos.write(bytes);
>>>                          bos.flush();
>>>                          bytes = new byte[bis.available()];
>>>                      }
>>>                  }
>>>              }
>>>          } catch (IOException e) {
>>>              // TODO Auto-generated catch block
>>>        

RE: Struts2 - multipart/related - HttpServletRequest#getParts not working

2018-10-08 Thread Yasser Zamani
This isn't Struts issue but your underlying servlet message. Anyway, what about 
trying Struts itself file upload feature. Then ask that another app to http 
post the file to a file upload action.

Regards.

>-Original Message-
>From: Nikhil P Kookkiri 
>Sent: Monday, October 8, 2018 12:37 PM
>To: user@struts.apache.org
>Subject: Struts2 - multipart/related - HttpServletRequest#getParts not working
>
>I have request coming from another application which is 'multipart/related'. In
>the mutlipart request body, I am receiving image/jpeg and application/xml. I
>suppose, I should be iterating over the http part obtained from getPaths method
>in the HttpServletRequest object and read the stream available on each of the
>parts. When I try doing that, I am getting the following error:
>
>java.lang.IllegalStateException: UT010057: multipart config was not present on
>Servlet ERROR [stderr] (default task-2)     at
>io.undertow.servlet//io.undertow.servlet.spec.HttpServletRequestImpl.verifyMul
>tipartServlet(HttpServletRequestImpl.java:523)
>ERROR [stderr] (default task-2)     at
>io.undertow.servlet//io.undertow.servlet.spec.HttpServletRequestImpl.getParts(
>HttpServletRequestImpl.java:512)
>ERROR [stderr] (default task-2)     at
>javax.servlet.api//javax.servlet.http.HttpServletRequestWrapper.getParts(HttpSer
>vletRequestWrapper.java:375)
>
>Please let me know the best possible solution for this.
>
>Here is what I am doing in the code:
>
>     public class TestMultiPart extends ActionSupport implements
>ServletRequestAware
>     {
>         private InputStream inputStream;
>         private HttpServletRequest request;
>
>     public String execute()
>     {
>         BufferedInputStream bis = null;
>         BufferedOutputStream bos = null;
>         try
>         {
>             Collection parts = request.getParts();
>             for(Part part : parts)
>             {
>                 String contentType = part.getContentType();
>                 System.out.println("Content type is: " + contentType);
>                 File file = getFileToDownload(getContentType(contentType));
>                 if(file != null)
>                 {
>                     bis = new
>BufferedInputStream(request.getInputStream());
>                     bos = new BufferedOutputStream(new 
> FileOutputStream(file));
>                     byte[] bytes = new byte[bis.available()];
>                     while(bis.read(bytes) > 0)
>                     {
>                         bos.write(bytes);
>                         bos.flush();
>                         bytes = new byte[bis.available()];
>                     }
>                 }
>             }
>         } catch (IOException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         } catch (ServletException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         } finally {
>             if(bis != null)
>             {
>                 try {
>                     bis.close();
>                 } catch (IOException e) {
>                     // TODO Auto-generated catch block
>                     e.printStackTrace();
>                 }
>             }
>             if(bos != null)
>             {
>                 try {
>                     bos.close();
>                 } catch (IOException e) {
>                     // TODO Auto-generated catch block
>                     e.printStackTrace();
>                 }
>             }
>         }
>
>         inputStream = new
>ByteArrayInputStream("200".getBytes(StandardCharsets.UTF_8));
>         return SUCCESS;
>     }
>
>     public InputStream getInputStream() {
>         return inputStream;
>     }
>
>     public void setInputStream(InputStream inputStream) {
>         this.inputStream = inputStream;
>     }
>
>     @Override
>     public void setServletRequest(HttpServletRequest requestObject)
>     {
>         this.request = requestObject;
>     }
>
>}
>
>--
>Best regards,
>Nikhil P kookkiri
>
>Gtalk: nikhil.pk81
>Skype: nikhil.pk81


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


RE: Issue with migration 2.3.34 to 2.5.17

2018-09-30 Thread Yasser Zamani
Please ask such questions at 
user@struts.apache.org

It seems Struts internal CDI has failed due to miss configuration. Please 
increase log level to debug and look for `textProviderFactory` and 
`AnnotationActionValidatorManager` in output.
Please continue at user@struts.apache.org with 
your new findings.

Regards.

From: Mahendra Srivastava (mahsriva) 
Sent: Monday, October 1, 2018 8:33 AM
To: iss...@struts.apache.org
Subject: Re: Issue with migration 2.3.34 to 2.5.17

An Expected error has occurred. The component(s) may or may not have been saved
properly. Check the log named Websetup log at \icm\logs or if you are ruuning an
 Administration Client at \icm\adminclient\logs\ for more information

=>Technical Details

java.lang.NullPointerException at com.opensysmphoney.xwork2.validator.Delegation
gValidator.Context.makeTextProvider(DelegatingValidatingValidatorContext.java 
212) at



On 2018/10/01 04:35:43, "Mahendra Srivastava (mahsriva)" 
mailto:mahsr...@cisco.com>> wrote:
> HI,
>
> I am doing the migration from 2.3.34 to 2.5.17. I am getting following error 
> during login page of my application. Sometimes it is able to logging but not 
> always. Not sure, what is the error here. I am following the below migration 
> document for this.
>
> https://cwiki-test.apache.org/confluence/display/WW/Struts+2.3+to+2.5+migration
>
> Below is the screen shot which I am getting.
>
> Any idea or clue why this is happening. I am using Tomcat 7.0.90 version f= 
> or this.
>
> Regards,
> Mahendra
> [cid:image001.png@01D4596E.4EED34B0]
>


RE: Quick question on the patch for CVE-2018-11776

2018-09-03 Thread Yasser Zamani
>From: Kiran Ananthpur Bacche (kbacche) 
>Sent: Friday, August 31, 2018 7:27 AM
>To: user@struts.apache.org
>Subject: Quick question on the patch for CVE-2018-11776
>
>Hi Team,
>
>Version 2.3.35 is the official patch for this vulnerability. However v2.3.35 
>has a
>bunch of other fixes too.
>
>So if we want the patch for only "CVE-2018-11776", what are the options
>available?
>
>Is the fix for "CVE-2018-11776" contained completely in
>DefaultActionMapper.java?
>
>Given that there was a backward compatibility issue seen with upgrade from
>2.3.34 to 2.3.35 (ref: https://www.mail-
>archive.com/us...@maven.apache.org/msg140838.html), we are checking to
>see if there is a way to have a patch that fixes only "CVE-2018-11776".


Hi, 
We are so sorry for inconvenience :( 
We have fixed it and a new small release will be available soon. 
Regards.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: [ANN] Apache Struts 2.3.35 GA with Security Fixes Release

2018-08-22 Thread Yasser Zamani
Hi there, thank you for posting,

As far as I see, it should be already available. For example see [1].

What is the repository URL you wish see Struts 2.3.35 there, please?

Regards.

[1] http://repo1.maven.org/maven2/org/apache/struts/struts2-core/2.3.35/

On 8/22/2018 6:37 PM, FAGES, Amaury wrote:
> Hi Struts team, thank you.
> 
> We are currently upgrading our flawed apps. Some are 2.3.x, any ETA on 2.3.35 
> availability through Maven Central or we are forced for now to add dependency 
> manually on inner repository ?
> 
> Thank you.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


Re: [ANN] Apache Struts 2.3.35 GA with Security Fixes Release

2018-08-22 Thread Yasser Zamani

On 8/22/2018 4:19 PM, Martin Gainty wrote:
> Yasser
> 
> which CVE or group of CVEs does this address?

Thanks for your posting Martin,

This addresses CVE-2018-11776 as I mentioned in it's S2-057's link and
announced into user list at [1].

Regards.

[1]
https://lists.apache.org/thread.html/759817f0a0156cebe24b2ad9502fb26a1d03cf3d7cecb5d75f0c66ea@%3Cuser.struts.apache.org%3E


[ANN] CVE-2018-11776 Apache Struts 2.3 to 2.3.34 and 2.5 to 2.5.16

2018-08-22 Thread Yasser Zamani
[CVEID]:CVE-2018-11776
[PRODUCT]:Apache Struts
[VERSION]:Apache Struts 2.3 to 2.3.34 and 2.5 to 2.5.16
[PROBLEMTYPE]:Remote Code Execution
[REFERENCES]:https://cwiki.apache.org/confluence/display/WW/S2-057
[DESCRIPTION]:Man Yue Mo from the Semmle Security Research team was
noticed that Apache Struts versions 2.3 to 2.3.34 and 2.5 to 2.5.16
suffer from possible Remote Code Execution when using results with no
namespace and in same time, its upper action(s) have no or wildcard
namespace. Same possibility when using url tag which doesn’t have value
and action set and in same time, its upper action(s) have no or wildcard
namespace.


[ANN] Apache Struts 2.5.17 GA with Security Fixes Release

2018-08-22 Thread Yasser Zamani
The Apache Struts group is pleased to announce that Struts 2.5.17 is
available as a “General Availability” release. The GA designation is
our highest quality grade.

In addition to critical overall proactive security improvements, this
release addresses one potential security vulnerability:
- Possible Remote Code Execution when using results with no namespace
and in same time, its upper action(s) have no or wildcard namespace.
Same possibility when using url tag which doesn’t have value and action
set - S2-057 -
http://struts.apache.org/docs/s2-057.html

Apache Struts 2 is an elegant, extensible framework for creating
enterprise-ready Java web applications. The framework is designed to
streamline the full development cycle, from building, to deploying, to
maintaining applications over time.

All developers are strongly advised to perform this action.

The 2.5.x series of the Apache Struts framework has a minimum
requirement of the following specification versions: Servlet API 2.4,
JSP API 2.0, and Java 7.

Should any issues arise with your use of any version of the Struts
framework, please post your comments to the user list, and, if
appropriate, file a tracking ticket.

You can download this version from our download page.
http://struts.apache.org/download.cgi#struts2517


Regards.


[ANN] Apache Struts 2.3.35 GA with Security Fixes Release

2018-08-22 Thread Yasser Zamani
The Apache Struts group is pleased to announce that Struts 2.3.35 is
available as a “General Availability” release. The GA designation is
our highest quality grade.

In addition to critical overall proactive security improvements, this
release addresses one potential security vulnerability:
- Possible Remote Code Execution when using results with no namespace
and in same time, its upper action(s) have no or wildcard namespace.
Same possibility when using url tag which doesn’t have value and action
set. - S2-057 -
http://struts.apache.org/docs/s2-057.html

Apache Struts 2 is an elegant, extensible framework for creating
enterprise-ready Java web applications. The framework is designed to
streamline the full development cycle, from building, to deploying, to
maintaining applications over time.

All developers are strongly advised to perform this action.

The 2.3.x series of the Apache Struts framework has a minimum
requirement of the following specification versions: Servlet API 2.4,
JSP API 2.0, and Java 6.

Should any issues arise with your use of any version of the Struts
framework, please post your comments to the user list, and, if
appropriate, file a tracking ticket.

You can download this version from our download page.
http://struts.apache.org/download.cgi#struts-23x


Regards.


RE: Struts 2.5 S:Select tag with Multiple True

2018-07-15 Thread Yasser Zamani
I wonder why HTML needs CTRL key when we enable multiple! Anyway, I think it's 
out of Struts business as an HTML issue. Unfortunately Struts Select tag 
doesn't provide an optional fix for this HTML issue and you've to fix it 
manually via some javascript coding e.g. save current selected items on each 
click and reselect all of them on each click too.

Regards.

>-Original Message-
>From: Kiran Kongala 
>Sent: Saturday, July 14, 2018 3:32 PM
>To: Struts Users Mailing List 
>Subject: Struts 2.5 S:Select tag with Multiple True
>
>Hi Guys,
>
>We are using Struts 2.5.13 in our Enterprise Java Application and one of the 
>jsp
>page has many Struts Select tags with multiple=true(s:select
>multiple=true) .
>
>I know that for selecting/deselecting multiple items in the list, we have to 
>hold
>the Ctrl Key.
>
>But for the Users who are using our application, they have an issue.
>
>Suppose the User selected 5 items out of 20 in a multi select drop down by
>holding Ctrl Key and saved the page in the Add flow.
>
>In the Edit flow, the User wants to select 6th item in the existing multi 
>select drop
>down and if the user forgets to hold the Ctrl key while selecting the 6th 
>item, then
>all the other 5 items are deselected and only the 6th item is selected.
>
>Without even realizing that they deselected the other items in the list they 
>save
>the page. By mistake they don't want that to happen.
>
>So they asked is there a way to work with the multi select by 
>selecting/desecting
>multiple items in the list without holding the Ctrl Key or to stop this 
>happening
>with the Select tag.
>
>So we added the below jquery script so that they can select/deselect without
>holding the Ctrl Key.
>
>jQuery('option').mousedown(function(e) { e.preventDefault(); var selector =
>this.parentElement.id; jQuery(this).prop('selected', 
>!jQuery(this).prop('selected'));
>jQuery('#' + selector).trigger('change'); return false; });
>
>But this script only works in Chrome and may be FF but it doesn't work in IE.
>
>Because most of our Users uses the IE as the default browser and most of the
>application is tested on IE only, Is there any work around with this problem 
>or is
>there any property in the S:SELECT which will solve this issue?
>
>Please help.
>
>Thanks

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


Re: http://mybox:8080/struts/hello.action gets HTTP Status 404 - Not Found

2018-06-30 Thread Yasser Zamani


On 6/30/2018 4:23 PM, ssmtpmailtesting ssmtpmailtesting wrote:
> web.xml =>
> 
>   "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>  "http://java.sun.com/dtd/web-app_2_3.dtd; >
> 
> 
> Archetype Created Web Application
> 
> struts2
> org.apache.struts2.dispatcher.FilterDispatcher
> 

The maven pom.xml is using Struts 2.5.16 but web.xml is using Struts
2.3.x either DTD and filter. The FilterDispatcher is used in the early
Struts2 development, and it’s deprecated since Struts 2.1.3. it’s always
recommended to upgrade the new filter class – StrutsPrepareAndExecuteFilter.

Regards.



Re: Struts 2

2018-06-22 Thread Yasser Zamani
Hello, try browser's developer tools. Open it's network and console tab and 
then click your add button. Then see if any JavaScript error is in console. 
Then check network tab and see what's the response for your server action call. 
I hope these help ☺

Regards.
On Jun 22, 2018, at 2:25 AM, Deborah White 
mailto:deborah.wh...@doj.ca.gov>> wrote:

Hello, I'm hoping someone with more experience can help me with this.  When I 
do the file upload, it uploads the file and returns to the page (but it looks 
like it breaks out of the view it was in) but then the Add button does not 
work.  I believe I need to be able to post data to my action class that is 
handling the file upload?  Please see my jsp code:

<%@taglib uri="/struts-tags" prefix="s" %>




function addBulkSellerAgent() {
   var registrationId = '';
var sellerId = '';
var fileFileName = '';
var fromPage = 'sellerAgent';
var postData = "registrationId="+registrationId+
  "&sellerAgentData.sellerId=" + sellerId+
  "&fromPage=" + fromPage +
  "&fileFileName=" + fileFileName;
processRegistrationDetails('', postData);
return false;
}


Select File to Upload






   
  

 
   
 
 

  
 Add Seller Agents
 



 
 
   
  
 
 <%%>
 ');" />
 
 
  
   
 
 
  
   


CONFIDENTIALITY NOTICE: This communication with its contents may contain 
confidential and/or legally privileged information. It is solely for the use of 
the intended recipient(s). Unauthorized interception, review, use or disclosure 
is prohibited and may violate applicable laws including the Electronic 
Communications Privacy Act. If you are not the intended recipient, please 
contact the sender and destroy all copies of the communication.


Re: s:fielderror not working in Java 8, WebSphere

2018-05-24 Thread Yasser Zamani


On 5/24/2018 6:43 PM, Doug Breaux wrote:
> I'm not sure if I misunderstood the threading here, or just missed this test 
> case, but this one does seem to run the same on IBM Java 8:
> 
> java TestForStruts2
> COPY ME 1: class java.util.LinkedHashMap$LinkedKeySet
> COPY ME 2: public abstract int java.util.AbstractCollection.size()
> COPY ME 3: 0
> 

But freemarker claims "Java method "AbstractCollection.size()" threw an
exception when invoked on LinkedHashMap$LinkedKeySet object "[]"; see
cause exception in the Java stack trace" and Java stack trace in JSP
exception says "Caused by: java.lang.AbstractMethodError:
java/util/AbstractCollection.size()I". Maybe that JSP exception isn't
for that freemarker exception but it's an unlikely guess from me.

> I do have some IBM Java folks able to look at the issue, BTW. At least one of 
> them pointed at this a potentially related, but beyond me to know if it could 
> be:
> 
> https://github.com/eclipse/openj9/pull/1892

Maybe. I see freemarker search superclasses for methods because class
LinkedHashMap$LinkedKeySet is private. I'm not sure or check if it
always find more specific method!

Regards.


Re: s:fielderror not working in Java 8, WebSphere

2018-05-24 Thread Yasser Zamani


On 5/22/2018 10:54 PM, breaux@ wrote:
> 2018-05-22 12:43:24,384 ERROR [freemarker.runtime]: error - Error executing 
> FreeMarker template
> FreeMarker template error:
> Java method "AbstractCollection.size()" threw an exception when invoked on 
> LinkedHashMap$LinkedKeySet object "[]"; see cause exception in the Java stack 
> trace.
> Caused by: java.lang.AbstractMethodError: java/util/AbstractCollection.size()I
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
> at java.lang.reflect.Method.invoke(Method.java:508)
> at 
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1487)

It seems IBM JDK 8 has different behavior than Oracle or OpenJDK 8. Your
exception claims that JDK is not able to call abstract method size on
LinkedKeySet but here, Oracle and OpenJDK 8 are able to run:

LinkedHashMap lhm = new LinkedHashMap();
Object ks = LinkedHashMap.class.getMethod("keySet").invoke(lhm);
System.out.println("COPY ME 1: " + ks.getClass());
Method m = AbstractCollection.class.getMethod("size");
System.out.println("COPY ME 2: " + m);
Object s = m.invoke(ks);
System.out.println("COPY ME 3: " + s);

They prints:

COPY ME 1: class java.util.LinkedHashMap$LinkedKeySet
COPY ME 2: public abstract int java.util.AbstractCollection.size()
COPY ME 3: 0

which means they're able! I don't know if IBM violates Java
Specification here or Oracle and OpenJDK do. Are you able to ask IBM why
above piece of code fails on their JDK 8 and pass on 7?

Thanks in advance!

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


Re: s:fielderror not working in Java 8, WebSphere

2018-05-23 Thread Yasser Zamani


On 5/23/2018 11:29 PM, Doug Breaux wrote:
> Looks the same:
> 
> java TestForStruts
> COPY ME 1: public abstract int java.util.Set.size()
> COPY ME 2: 0

Thanks. Sorry, for last one, could you check:

java.util.Map lhm = new java.util.LinkedHashMap<>();
Class c = lhm.getClass();
java.lang.reflect.Method m = c.getMethod("keySet");
Object ks = m.invoke(lhm);
Class c2 = ks.getClass();
java.lang.reflect.Method m2 = c2.getMethod("size");
System.out.println("COPY ME 1: " + m2);
Object s = m2.invoke(ks);
System.out.println("COPY ME 2: " + s);

and if were successful, then check in your action method if:

java.util.Map lhm = this.getFieldErrors()
Class c = lhm.getClass();
java.lang.reflect.Method m = c.getMethod("keySet");
Object ks = m.invoke(lhm);
Class c2 = ks.getClass();
java.lang.reflect.Method m2 = c2.getMethod("size");
System.out.println("COPY ME 1: " + m2);
Object s = m2.invoke(ks);
System.out.println("COPY ME 2: " + s);

is also successful.


Re: s:fielderror not working in Java 8, WebSphere

2018-05-23 Thread Yasser Zamani
Sorry. Could you please check this updated one which is OK here:

  public static void main(String[] args) throws Exception
  {
java.util.Map lhm = new java.util.LinkedHashMap<>();
Class c = lhm.getClass();
java.lang.reflect.Method m = c.getMethod("keySet");
Object ks = m.invoke(lhm);
java.lang.reflect.Method m2 = m.getReturnType().getMethod("size");
System.out.println("COPY ME 1: " + m2);
Object s = m2.invoke(ks);
System.out.println("COPY ME 2: " + s);
  }

then reply back COPY MEs values please. Here I get:

COPY ME 1: public abstract int java.util.Set.size()
COPY ME 2: 0


On 5/23/2018 11:01 PM, Doug Breaux wrote:
> 
> 
> On 2018/05/23 18:11:34, Yasser Zamani <yasserzam...@apache.org> wrote: 
> 
>> Thanks. Could you also check if your IBM JDK 8 is able to run this:
>>
>> java.util.Map<String, List> lhm = new
>> java.util.LinkedHashMap<>();
>> Class c = lhm.getClass();
>> Method m = c.getMethod("keySet");
>> Object ks = m.invoke(lhm);
>> Method m2 = m.getReturnType().getMethod("size");
>> Object s = m2.invoke(ks);
>>
>> System.out.println("COPY ME: " + s);
>>
> 
> That actually produces a compile error:
> 
> TestForStruts.java:10: error: incompatible types: Class<CAP#1> cannot be 
> converted to Class
> Class c = lhm.getClass();
>^
>   where CAP#1 is a fresh type-variable:
> CAP#1 extends Map from capture of ? extends Map
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 


Re: s:fielderror not working in Java 8, WebSphere

2018-05-23 Thread Yasser Zamani


On 5/23/2018 8:56 PM, Doug Breaux wrote:
> This is the latest IBM JDK 8. Or at least the latest that works with our 
> version WebSphere, but it's very recent. The build date is 20180214. And this 
> WebSphere cannot use Oracle or OpenJDK.

Thanks. Could you also check if your IBM JDK 8 is able to run this:

java.util.Map lhm = new
java.util.LinkedHashMap<>();
Class c = lhm.getClass();
Method m = c.getMethod("keySet");
Object ks = m.invoke(lhm);
Method m2 = m.getReturnType().getMethod("size");
Object s = m2.invoke(ks);

System.out.println("COPY ME: " + s);

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


Re: s:fielderror not working in Java 8, WebSphere

2018-05-23 Thread Yasser Zamani


On 5/23/2018 5:38 PM, Doug Breaux wrote:
> Quite possibly. Hoping somebody here will be able to confirm or give some 
> additional hints.

Could you check with latest version of IBM JDK 8? And are you maybe able
to check also with Oracle and OpenJDK 8?


Re: Struts2 login action class seems to be reused

2018-05-17 Thread Yasser Zamani


On 5/16/2018 11:51 PM, Prasanth wrote:
> Would struts2 call this setRequest method even if the class is implementing 
> just ServletRequestAware?

No. Additionally Struts RequestAware method signature is
setRequest(Map request); i.e. it's parameter is Map not
ServletRequest.

> Any insights as to why this additional setRequest method causes the problem? 

Yes. It's same as your issue with username/password copy from previous
action. Your previous action is in value stack (I don't know why! see
[1]) ChainingInterceptor thinks it's a chain result, so, calls
getRequest on previous action and then calls setRequest on your current
action with returned value (i.e. copies this value from previous action
and overrides your private request field inside your action).

You can fix this also by removing getRequest method which disables
ChainingInterceptor to copies this.

But you may encounter several same issues when you have both setX and
getX methods on your actions.

[1] So, as I mentioned before, could you please rewrite all of your
FORWARDs with Struts ServletRedirect or PostBack results (also revert
back all removed getter methods)? this shows us if FORWARDs are root
cause of these issues or not. Then we can investigate more on other
possible causes.

Regards.


Re: Struts2 login action class seems to be reused

2018-05-16 Thread Yasser Zamani


On 5/16/2018 7:23 PM, Prasanth Pasala wrote:
>  Exception: java.lang.IllegalStateException: UT10: Session is invalid 
> r4yb7BtBx7fwmGbzMhgeyhvSFb3sAp6FhW6m-5Op
> at 
> io.undertow.server.session.InMemorySessionManager$SessionImpl.getAttribute(InMemorySessionManager.java:481
> at 
> io.undertow.servlet.spec.HttpSessionImpl.getAttribute(HttpSessionImpl.java:122
> at com.xx.xx.LoginAction.execute(LoginAction.java:76

Could you see if "Best Practices: Cross-Context Dispatching and Session
Handling" [1] fixes your issue? However, it's about Servlets not Struts.

Regards.

[1] http://satworks.blogspot.com/2011/07/best-practices-cross-context.html

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


  1   2   3   >