You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Gmail <re...@gmail.com> on 2013/03/06 04:30:36 UTC

How can I transfer parameters as Map type from jsp to action?

My code is blow,

action.java:
public class RoleAction extends BaseAction {
private Map<String, RoleFunctionRel> roleFunctionMap;

public Map<String, RoleFunctionRel> getRoleFunctionMap() {
return roleFunctionMap;
}

public void setRoleFunctionMap(Map<String, RoleFunctionRel> roleFunctionMap) {
this.roleFunctionMap = roleFunctionMap;
}
}
    
jsp:
<s:iterator value="roleFunctions" var="functionItem" status="status">
<input name="roleFunctionMap[${functionItem.functionId}].roleId" type="hidden" value="${roleInfo.roleId}">
</s:iterator>


when ${functionItem.functionId} is a int type number, the value can put into the map in action, but when it's a string can't.

what's the problem?




Gmail

Re: Re: How can I transfer parameters as Map type from jsp to action?

Posted by Gmail <re...@gmail.com>.
Thanks a lot for your seggestion.
Because it works when ${functionItem.functionId} is a int value. So I make sure that the parameters are all int values. And my problem has been resolved.
Maybe, I should use a List.





Gmail

From: Lukasz Lenart
Date: 2013-03-06 14:18
To: Struts Users Mailing List
Subject: Re: Re: How can I transfer parameters as Map type from jsp to action?
2013/3/6 Gmail <re...@gmail.com>:
> I have input quotes around the string map key. But it does not work still.
>
> <s:iterator value="roleFunctions" var="functionItem" status="status">
> <input name='roleFunctionMap["${functionItem.functionId}"].roleId' type="hidden" value="${roleInfo.roleId}">
> </s:iterator>

Did you try to use %{} and <s:hidden/> ? How source of the page looks like?


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

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

Re: Re: How can I transfer parameters as Map type from jsp to action?

Posted by Lukasz Lenart <lu...@apache.org>.
2013/3/6 Gmail <re...@gmail.com>:
> I have input quotes around the string map key. But it does not work still.
>
> <s:iterator value="roleFunctions" var="functionItem" status="status">
> <input name='roleFunctionMap["${functionItem.functionId}"].roleId' type="hidden" value="${roleInfo.roleId}">
> </s:iterator>

Did you try to use %{} and <s:hidden/> ? How source of the page looks like?


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

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


Re: Re: How can I transfer parameters as Map type from jsp to action?

Posted by Lukasz Lenart <lu...@apache.org>.
2013/3/6 Gmail <re...@gmail.com>:
> The logs infomation is below:
>
> DEBUG [http-apr-8080-exec-6] - Setting static parameters {}
> DEBUG [http-apr-8080-exec-6] - Setting params NONE
> DEBUG [http-apr-8080-exec-6] - Setting params
> roleFunctionMap['a-a'].functionId => [ 1 ] roleInfo.roleId => [ 1 ]
> DEBUG [http-apr-8080-exec-6] - Entering nullPropertyValue
> [target=[com.teradata.sxmon.role.action.RoleAction@17ff3e4,
> com.opensymphony.xwork2.DefaultTextProvider@1dc16a], property=roleInfo]
> DEBUG [http-apr-8080-exec-6] - Property: roleId
> DEBUG [http-apr-8080-exec-6] - Class: mybatis.dto.Role
> DEBUG [http-apr-8080-exec-6] - field-level type converter for property
> [roleId] = none found
> DEBUG [http-apr-8080-exec-6] - Property: roleInfo.roleId
> DEBUG [http-apr-8080-exec-6] - Class:
> com.teradata.sxmon.role.action.RoleAction
> DEBUG [http-apr-8080-exec-6] - global-level type converter for property
> [roleId] = none found
> DEBUG [http-apr-8080-exec-6] - falling back to default type converter
> [com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter@5b9cff]
> DEBUG [http-apr-8080-exec-6] - Creating converter with name [string]
> DEBUG [http-apr-8080-exec-6] - Converter of Type
> [com.opensymphony.xwork2.conversion.impl.StringConverter] with name
> [string], created!

And that's all? Maybe enable debugging level just for
ParametersInterceptor. Struts version?


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

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


Re: Re: How can I transfer parameters as Map type from jsp to action?

Posted by Gmail <re...@gmail.com>.
The logs infomation is below:

DEBUG [http-apr-8080-exec-6] - Setting static parameters {}
DEBUG [http-apr-8080-exec-6] - Setting params NONE
DEBUG [http-apr-8080-exec-6] - Setting params roleFunctionMap['a-a'].functionId => [ 1 ] roleInfo.roleId => [ 1 ] 
DEBUG [http-apr-8080-exec-6] - Entering nullPropertyValue [target=[com.teradata.sxmon.role.action.RoleAction@17ff3e4, com.opensymphony.xwork2.DefaultTextProvider@1dc16a], property=roleInfo]
DEBUG [http-apr-8080-exec-6] - Property: roleId
DEBUG [http-apr-8080-exec-6] - Class: mybatis.dto.Role
DEBUG [http-apr-8080-exec-6] - field-level type converter for property [roleId] = none found
DEBUG [http-apr-8080-exec-6] - Property: roleInfo.roleId
DEBUG [http-apr-8080-exec-6] - Class: com.teradata.sxmon.role.action.RoleAction
DEBUG [http-apr-8080-exec-6] - global-level type converter for property [roleId] = none found
DEBUG [http-apr-8080-exec-6] - falling back to default type converter [com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter@5b9cff]
DEBUG [http-apr-8080-exec-6] - Creating converter with name [string]
DEBUG [http-apr-8080-exec-6] - Converter of Type [com.opensymphony.xwork2.conversion.impl.StringConverter] with name [string], created!




Gmail

From: Lukasz Lenart
Date: 2013-03-06 17:50
To: Struts Users Mailing List
Subject: Re: Re: How can I transfer parameters as Map type from jsp to action?
2013/3/6 Gmail <re...@gmail.com>:
> I know what's the problem, but I don't know why and how to resolve.
>
> 1. <input name="roleFunctionMap['aaa'].roleId" type="hidden" value="1">
> 2. <input name="roleFunctionMap['a-aa'].roleId" type="hidden" value="1">
>
> The first can works, but the second fail.
> The difference between the firs and the second is a minus.

It can be related to excludeParamNames pattern in
ParametersInterceptor, you should see a warning/debug message in the
logs.


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

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

Re: Re: How can I transfer parameters as Map type from jsp to action?

Posted by Lukasz Lenart <lu...@apache.org>.
2013/3/6 Gmail <re...@gmail.com>:
> I know what's the problem, but I don't know why and how to resolve.
>
> 1. <input name="roleFunctionMap['aaa'].roleId" type="hidden" value="1">
> 2. <input name="roleFunctionMap['a-aa'].roleId" type="hidden" value="1">
>
> The first can works, but the second fail.
> The difference between the firs and the second is a minus.

It can be related to excludeParamNames pattern in
ParametersInterceptor, you should see a warning/debug message in the
logs.


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

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


Re: Re: How can I transfer parameters as Map type from jsp to action?

Posted by Gmail <re...@gmail.com>.
I know what's the problem, but I don't know why and how to resolve.

1. <input name="roleFunctionMap['aaa'].roleId" type="hidden" value="1">
2. <input name="roleFunctionMap['a-aa'].roleId" type="hidden" value="1">

The first can works, but the second fail.
The difference between the firs and the second is a minus.




Gmail

From: Gmail
Date: 2013-03-06 13:47
To: user@struts.apache.org
Subject: Re: Re: How can I transfer parameters as Map type from jsp to action?
Thanks for your reply.

I have input quotes around the string map key. But it does not work still.

<s:iterator value="roleFunctions" var="functionItem" status="status"> 
<input name='roleFunctionMap["${functionItem.functionId}"].roleId' type="hidden" value="${roleInfo.roleId}">
</s:iterator>




Gmail

From: Dave Newton
Date: 2013-03-06 11:35
To: Struts Users Mailing List
Subject: Re: How can I transfer parameters as Map type from jsp to action?
No quotes around the string map key?
 On Mar 5, 2013 10:32 PM, "Gmail" <re...@gmail.com> wrote:

> My code is blow,
>
> action.java:
> public class RoleAction extends BaseAction {
> private Map<String, RoleFunctionRel> roleFunctionMap;
>
> public Map<String, RoleFunctionRel> getRoleFunctionMap() {
> return roleFunctionMap;
> }
>
> public void setRoleFunctionMap(Map<String, RoleFunctionRel>
> roleFunctionMap) {
> this.roleFunctionMap = roleFunctionMap;
> }
> }
>
> jsp:
> <s:iterator value="roleFunctions" var="functionItem" status="status">
> <input name="roleFunctionMap[${functionItem.functionId}].roleId"
> type="hidden" value="${roleInfo.roleId}">
> </s:iterator>
>
>
> when ${functionItem.functionId} is a int type number, the value can put
> into the map in action, but when it's a string can't.
>
> what's the problem?
>
>
>
>
> Gmail

Re: Re: How can I transfer parameters as Map type from jsp to action?

Posted by Gmail <re...@gmail.com>.
Thanks for your reply.

I have input quotes around the string map key. But it does not work still.

<s:iterator value="roleFunctions" var="functionItem" status="status">
<input name='roleFunctionMap["${functionItem.functionId}"].roleId' type="hidden" value="${roleInfo.roleId}">
</s:iterator>




Gmail

From: Dave Newton
Date: 2013-03-06 11:35
To: Struts Users Mailing List
Subject: Re: How can I transfer parameters as Map type from jsp to action?
No quotes around the string map key?
 On Mar 5, 2013 10:32 PM, "Gmail" <re...@gmail.com> wrote:

> My code is blow,
>
> action.java:
> public class RoleAction extends BaseAction {
> private Map<String, RoleFunctionRel> roleFunctionMap;
>
> public Map<String, RoleFunctionRel> getRoleFunctionMap() {
> return roleFunctionMap;
> }
>
> public void setRoleFunctionMap(Map<String, RoleFunctionRel>
> roleFunctionMap) {
> this.roleFunctionMap = roleFunctionMap;
> }
> }
>
> jsp:
> <s:iterator value="roleFunctions" var="functionItem" status="status">
> <input name="roleFunctionMap[${functionItem.functionId}].roleId"
> type="hidden" value="${roleInfo.roleId}">
> </s:iterator>
>
>
> when ${functionItem.functionId} is a int type number, the value can put
> into the map in action, but when it's a string can't.
>
> what's the problem?
>
>
>
>
> Gmail

Re: How can I transfer parameters as Map type from jsp to action?

Posted by Dave Newton <da...@gmail.com>.
No quotes around the string map key?
 On Mar 5, 2013 10:32 PM, "Gmail" <re...@gmail.com> wrote:

> My code is blow,
>
> action.java:
> public class RoleAction extends BaseAction {
> private Map<String, RoleFunctionRel> roleFunctionMap;
>
> public Map<String, RoleFunctionRel> getRoleFunctionMap() {
> return roleFunctionMap;
> }
>
> public void setRoleFunctionMap(Map<String, RoleFunctionRel>
> roleFunctionMap) {
> this.roleFunctionMap = roleFunctionMap;
> }
> }
>
> jsp:
> <s:iterator value="roleFunctions" var="functionItem" status="status">
> <input name="roleFunctionMap[${functionItem.functionId}].roleId"
> type="hidden" value="${roleInfo.roleId}">
> </s:iterator>
>
>
> when ${functionItem.functionId} is a int type number, the value can put
> into the map in action, but when it's a string can't.
>
> what's the problem?
>
>
>
>
> Gmail