> On Dec 17, 2023, at 10:04 AM, Lukasz Lenart <lukaszlen...@apache.org> wrote:
>
> sob., 16 gru 2023 o 19:10 Ralph Grove <rfgr...@icloud.com.invalid> napisał(a):
>> The setup action declares it this way:
>>
>> private HashMap<Character, String> statuses;
>>
>> statuses = User.getStatusMap();
>>
>>
>> And in the User class it’s created in the get method:
>>
>> public static HashMap<Character, String> getStatusMap() {
>> HashMap<Character, String> statusMap = new HashMap<>();
>> statusMap.put(User.ACTIVE, "Active");
>> statusMap.put(User.INACTIVE, "Inactive");
>> return statusMap;
>> }
>
> Do you use a custom template? Maybe you have your own radiomap.ftl? I
> just tested the Showcase app and didn't notice such problems.
> Basically you shouldn't notice such warning as it means someone is
> trying to access a protected property of your bean
>
>
> Cheers
> Łukasz
>
Here’s a stripped-down version of the code that still generates the warning
messages. Maybe you could try this and see if you get the same messages:
[WARN ] 2023-12-18 13:40:24 [https-jsse-nio-8443-exec-81] SecurityMemberAccess
- Access to non-public [protected java.lang.String
org.apache.struts2.components.UIBean.disabled] is blocked!
[WARN ] 2023-12-18 13:40:24 [https-jsse-nio-8443-exec-81] SecurityMemberAccess
- Access to non-public [protected java.lang.String
org.apache.struts2.components.UIBean.disabled] is blocked!
[WARN ] 2023-12-18 13:40:24 [https-jsse-nio-8443-exec-81] SecurityMemberAccess
- Access to non-public [protected java.lang.String
org.apache.struts2.components.UIBean.disabled] is blocked!
[WARN ] 2023-12-18 13:40:24 [https-jsse-nio-8443-exec-81] SecurityMemberAccess
- Access to non-public [protected java.lang.String
org.apache.struts2.components.UIBean.disabled] is blocked!
In struts.xml:
<action name="TestSetupAction"
class="org.personalitypad.action.TestSetupAction">
<result>/WEB-INF/jsp/test.jsp</result>
</action>
TestSetupAction.java:
import static com.opensymphony.xwork2.Action.ERROR;
import static com.opensymphony.xwork2.Action.SUCCESS;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import java.util.Map;
import java.sql.SQLException;
import java.util.HashMap;
import static java.util.Map.entry;
public class TestSetupAction extends ActionSupport {
private static final Logger logger =
LogManager.getLogger(UserSetupAction.class);
private Map<Character, String> statuses;
@Override
public String execute() throws SQLException {
try {
statuses = Map.ofEntries(
entry('A', "Active"),
entry('I', "Inactive")
);
return SUCCESS;
} catch (Exception e) {
logger.error("TSA.execute(): ", e);
return ERROR;
}
}
public Map<Character, String> getStatuses() {
return statuses;
}
}
test.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<%@taglib prefix="sj" uri="/struts-jquery-tags" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>User Update</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<!-- Struts2 includes -->
<s:head />
<sj:head />
<sb:head includeScripts="true" />
</head>
<body>
<div id="container">
<div id="content">
<h1>User Update</h1>
<br/>
<s:form action="TestSetupAction" theme="bootstrap"
cssClass="form-vertical">
<s:radio
name="status"
label="Status"
list="statuses" />
<s:submit value="Submit Changes" class="btn
btn-outline-primary"/>
</s:form>
</div>
</div>
</body>
</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org