You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Torsten Krah (JIRA)" <ji...@apache.org> on 2008/10/21 16:40:37 UTC

[jira] Created: (WW-2846) s:url Tag with parameters does not work or results in ClassCastException

s:url Tag with parameters does not work or results in ClassCastException
------------------------------------------------------------------------

                 Key: WW-2846
                 URL: https://issues.apache.org/struts/browse/WW-2846
             Project: Struts 2
          Issue Type: Bug
          Components: Plugin - Portlet, Plugin - Tags
    Affects Versions: 2.0.11.2
         Environment: Pluto 1.1.6, Java5
            Reporter: Torsten Krah


Using Example 1 from s:url Tag

http://struts.apache.org/2.0.11.2/struts2-core/apidocs/org/apache/struts2/components/URL.html

does not work in an PortletEnvironment. Only the url is generated.
Debugging to PortletUrlHelper the params map is empty.

 <s:url value="editGadget.action">
     <s:param name="id" value="%{selected}" />
 </s:url>

does not work. The params map is empty

 <s:url value="editGadget.action">
     <s:param name="id" value="abc" />
 </s:url>

does not work. The params map is empty.

 <s:url value="editGadget.action">
     <s:param name="id" value="40" />
 </s:url>

does not work. The param is in the Map, but its not a String, its an Integer - which results in a ClassCastException at:

  String key = (String)it.next();
  String val = (String)params.get(key);

Portlet Spec mentions to use Servlet for resource streaming and other things you can't do with portlets.
I need to generate servlet URLs containing parameters - but it seems i can't create them with struts.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2846) s:url Tag with parameters does not work or results in ClassCastException

Posted by "Nils-Helge Garli (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2846?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44854#action_44854 ] 

Nils-Helge Garli commented on WW-2846:
--------------------------------------

I've managed to reproduce and understand the problem with the ClassCastException, which affects the first and third of your examples. The second example won't work unless you have an object on the stack with the property abc. If you try

 <s:url value="editGadget.action">
     <s:param name="id" value="'abc'" />
 </s:url> 

(notice the extra ' ' in the value)

which probably results in what you would expect.

So to summarize how I see the problem:

Nested params doesn't work with non-string values. But nested params with String values does work as expected.

A temporary workaround is to construct your non-portlet urls "by hand" or use some other tag library to create them.

> s:url Tag with parameters does not work or results in ClassCastException
> ------------------------------------------------------------------------
>
>                 Key: WW-2846
>                 URL: https://issues.apache.org/struts/browse/WW-2846
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Portlet, Plugin - Tags
>    Affects Versions: 2.0.11.2
>         Environment: Pluto 1.1.6, Java5
>            Reporter: Torsten Krah
>         Attachments: Param.diff
>
>
> Using Example 1 from s:url Tag
> http://struts.apache.org/2.0.11.2/struts2-core/apidocs/org/apache/struts2/components/URL.html
> does not work in an PortletEnvironment. Only the url is generated.
> Debugging to PortletUrlHelper the params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="%{selected}" />
>  </s:url>
> does not work. The params map is empty
>  <s:url value="editGadget.action">
>      <s:param name="id" value="abc" />
>  </s:url>
> does not work. The params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="40" />
>  </s:url>
> does not work. The param is in the Map, but its not a String, its an Integer - which results in a ClassCastException at:
>   String key = (String)it.next();
>   String val = (String)params.get(key);
> Portlet Spec mentions to use Servlet for resource streaming and other things you can't do with portlets.
> I need to generate servlet URLs containing parameters - but it seems i can't create them with struts.
> Using "includeParams=ALL" (which you may use to get extraparams included), does result in
> [Ljava.lang.String; cannot be cast to java.lang.String
> because PortletUrlHelper gots a method called: ensureParamsAreStringArrays which is called when constructing the surrounding form ...
> which does convert the entire map to hold string arrays - but than buildResourceUrl must fail everytime.
> Using get and %{ognlvaluexpr} it does work nearly, only the CCE is making things worse.
> The fault is 
>                 Object value = findValue(this.value);
>                 component.addParameter(name, value);
> in the param Tag. findValue does return actually an Integer instance which is put to the parameter Map.
> This should be converted to String before inserting it to the map.
> Besides this, using All the above things still apply.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2846) s:url Tag with parameters does not work or results in ClassCastException

Posted by "Torsten Krah (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2846?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Torsten Krah updated WW-2846:
-----------------------------

    Description: 
Using Example 1 from s:url Tag

http://struts.apache.org/2.0.11.2/struts2-core/apidocs/org/apache/struts2/components/URL.html

does not work in an PortletEnvironment. Only the url is generated.
Debugging to PortletUrlHelper the params map is empty.

 <s:url value="editGadget.action">
     <s:param name="id" value="%{selected}" />
 </s:url>

does not work. The params map is empty

 <s:url value="editGadget.action">
     <s:param name="id" value="abc" />
 </s:url>

does not work. The params map is empty.

 <s:url value="editGadget.action">
     <s:param name="id" value="40" />
 </s:url>

does not work. The param is in the Map, but its not a String, its an Integer - which results in a ClassCastException at:

  String key = (String)it.next();
  String val = (String)params.get(key);

Portlet Spec mentions to use Servlet for resource streaming and other things you can't do with portlets.
I need to generate servlet URLs containing parameters - but it seems i can't create them with struts.


Using "includeParams=ALL" (which you may use to get extraparams included), does result in

[Ljava.lang.String; cannot be cast to java.lang.String

because PortletUrlHelper gots a method called: ensureParamsAreStringArrays which is called when constructing the surrounding form ...

which does convert the entire map to hold string arrays - but than buildResourceUrl must fail everytime.


Using get and %{ognlvaluexpr} it does work nearly, only the CCE is making things worse.
The fault is 

                Object value = findValue(this.value);
                component.addParameter(name, value);

in the param Tag. findValue does return actually an Integer instance which is put to the parameter Map.
This should be converted to String before inserting it to the map.

Besides this, using All the above things still apply.


  was:
Using Example 1 from s:url Tag

http://struts.apache.org/2.0.11.2/struts2-core/apidocs/org/apache/struts2/components/URL.html

does not work in an PortletEnvironment. Only the url is generated.
Debugging to PortletUrlHelper the params map is empty.

 <s:url value="editGadget.action">
     <s:param name="id" value="%{selected}" />
 </s:url>

does not work. The params map is empty

 <s:url value="editGadget.action">
     <s:param name="id" value="abc" />
 </s:url>

does not work. The params map is empty.

 <s:url value="editGadget.action">
     <s:param name="id" value="40" />
 </s:url>

does not work. The param is in the Map, but its not a String, its an Integer - which results in a ClassCastException at:

  String key = (String)it.next();
  String val = (String)params.get(key);

Portlet Spec mentions to use Servlet for resource streaming and other things you can't do with portlets.
I need to generate servlet URLs containing parameters - but it seems i can't create them with struts.


Using "includeParams=ALL" (which you may use to get extraparams included), does result in

[Ljava.lang.String; cannot be cast to java.lang.String

because PortletUrlHelper gots a method called: ensureParamsAreStringArrays which is called when constructing the surrounding form ...

which does convert the entire map to hold string arrays - but than buildResourceUrl must fail everytime.



Added GET vs ALL difference.

> s:url Tag with parameters does not work or results in ClassCastException
> ------------------------------------------------------------------------
>
>                 Key: WW-2846
>                 URL: https://issues.apache.org/struts/browse/WW-2846
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Portlet, Plugin - Tags
>    Affects Versions: 2.0.11.2
>         Environment: Pluto 1.1.6, Java5
>            Reporter: Torsten Krah
>
> Using Example 1 from s:url Tag
> http://struts.apache.org/2.0.11.2/struts2-core/apidocs/org/apache/struts2/components/URL.html
> does not work in an PortletEnvironment. Only the url is generated.
> Debugging to PortletUrlHelper the params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="%{selected}" />
>  </s:url>
> does not work. The params map is empty
>  <s:url value="editGadget.action">
>      <s:param name="id" value="abc" />
>  </s:url>
> does not work. The params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="40" />
>  </s:url>
> does not work. The param is in the Map, but its not a String, its an Integer - which results in a ClassCastException at:
>   String key = (String)it.next();
>   String val = (String)params.get(key);
> Portlet Spec mentions to use Servlet for resource streaming and other things you can't do with portlets.
> I need to generate servlet URLs containing parameters - but it seems i can't create them with struts.
> Using "includeParams=ALL" (which you may use to get extraparams included), does result in
> [Ljava.lang.String; cannot be cast to java.lang.String
> because PortletUrlHelper gots a method called: ensureParamsAreStringArrays which is called when constructing the surrounding form ...
> which does convert the entire map to hold string arrays - but than buildResourceUrl must fail everytime.
> Using get and %{ognlvaluexpr} it does work nearly, only the CCE is making things worse.
> The fault is 
>                 Object value = findValue(this.value);
>                 component.addParameter(name, value);
> in the param Tag. findValue does return actually an Integer instance which is put to the parameter Map.
> This should be converted to String before inserting it to the map.
> Besides this, using All the above things still apply.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2846) s:url Tag with parameters does not work or results in ClassCastException

Posted by "Torsten Krah (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2846?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Torsten Krah updated WW-2846:
-----------------------------

    Description: 
Using Example 1 from s:url Tag

http://struts.apache.org/2.0.11.2/struts2-core/apidocs/org/apache/struts2/components/URL.html

does not work in an PortletEnvironment. Only the url is generated.
Debugging to PortletUrlHelper the params map is empty.

 <s:url value="editGadget.action">
     <s:param name="id" value="%{selected}" />
 </s:url>

does not work. The params map is empty

 <s:url value="editGadget.action">
     <s:param name="id" value="abc" />
 </s:url>

does not work. The params map is empty.

 <s:url value="editGadget.action">
     <s:param name="id" value="40" />
 </s:url>

does not work. The param is in the Map, but its not a String, its an Integer - which results in a ClassCastException at:

  String key = (String)it.next();
  String val = (String)params.get(key);

Portlet Spec mentions to use Servlet for resource streaming and other things you can't do with portlets.
I need to generate servlet URLs containing parameters - but it seems i can't create them with struts.


Using "includeParams=ALL" (which you may use to get extraparams included), does result in

[Ljava.lang.String; cannot be cast to java.lang.String

because PortletUrlHelper gots a method called: ensureParamsAreStringArrays which is called when constructing the surrounding form ...

which does convert the entire map to hold string arrays - but than buildResourceUrl must fail everytime.


  was:
Using Example 1 from s:url Tag

http://struts.apache.org/2.0.11.2/struts2-core/apidocs/org/apache/struts2/components/URL.html

does not work in an PortletEnvironment. Only the url is generated.
Debugging to PortletUrlHelper the params map is empty.

 <s:url value="editGadget.action">
     <s:param name="id" value="%{selected}" />
 </s:url>

does not work. The params map is empty

 <s:url value="editGadget.action">
     <s:param name="id" value="abc" />
 </s:url>

does not work. The params map is empty.

 <s:url value="editGadget.action">
     <s:param name="id" value="40" />
 </s:url>

does not work. The param is in the Map, but its not a String, its an Integer - which results in a ClassCastException at:

  String key = (String)it.next();
  String val = (String)params.get(key);

Portlet Spec mentions to use Servlet for resource streaming and other things you can't do with portlets.
I need to generate servlet URLs containing parameters - but it seems i can't create them with struts.




> s:url Tag with parameters does not work or results in ClassCastException
> ------------------------------------------------------------------------
>
>                 Key: WW-2846
>                 URL: https://issues.apache.org/struts/browse/WW-2846
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Portlet, Plugin - Tags
>    Affects Versions: 2.0.11.2
>         Environment: Pluto 1.1.6, Java5
>            Reporter: Torsten Krah
>
> Using Example 1 from s:url Tag
> http://struts.apache.org/2.0.11.2/struts2-core/apidocs/org/apache/struts2/components/URL.html
> does not work in an PortletEnvironment. Only the url is generated.
> Debugging to PortletUrlHelper the params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="%{selected}" />
>  </s:url>
> does not work. The params map is empty
>  <s:url value="editGadget.action">
>      <s:param name="id" value="abc" />
>  </s:url>
> does not work. The params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="40" />
>  </s:url>
> does not work. The param is in the Map, but its not a String, its an Integer - which results in a ClassCastException at:
>   String key = (String)it.next();
>   String val = (String)params.get(key);
> Portlet Spec mentions to use Servlet for resource streaming and other things you can't do with portlets.
> I need to generate servlet URLs containing parameters - but it seems i can't create them with struts.
> Using "includeParams=ALL" (which you may use to get extraparams included), does result in
> [Ljava.lang.String; cannot be cast to java.lang.String
> because PortletUrlHelper gots a method called: ensureParamsAreStringArrays which is called when constructing the surrounding form ...
> which does convert the entire map to hold string arrays - but than buildResourceUrl must fail everytime.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2846) s:url Tag with parameters does not work or results in ClassCastException

Posted by "Nils-Helge Garli (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2846?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45006#action_45006 ] 

Nils-Helge Garli commented on WW-2846:
--------------------------------------

Could you try to build trunk and see if this still is an issue?

> s:url Tag with parameters does not work or results in ClassCastException
> ------------------------------------------------------------------------
>
>                 Key: WW-2846
>                 URL: https://issues.apache.org/struts/browse/WW-2846
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Portlet, Plugin - Tags
>    Affects Versions: 2.0.11.2
>         Environment: Pluto 1.1.6, Java5
>            Reporter: Torsten Krah
>            Assignee: Nils-Helge Garli
>         Attachments: Param.diff, PortletUrlHelper.diff
>
>
> Using Example 1 from s:url Tag
> http://struts.apache.org/2.0.11.2/struts2-core/apidocs/org/apache/struts2/components/URL.html
> does not work in an PortletEnvironment. Only the url is generated.
> Debugging to PortletUrlHelper the params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="%{selected}" />
>  </s:url>
> does not work. The params map is empty
>  <s:url value="editGadget.action">
>      <s:param name="id" value="abc" />
>  </s:url>
> does not work. The params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="40" />
>  </s:url>
> does not work. The param is in the Map, but its not a String, its an Integer - which results in a ClassCastException at:
>   String key = (String)it.next();
>   String val = (String)params.get(key);
> Portlet Spec mentions to use Servlet for resource streaming and other things you can't do with portlets.
> I need to generate servlet URLs containing parameters - but it seems i can't create them with struts.
> Using "includeParams=ALL" (which you may use to get extraparams included), does result in
> [Ljava.lang.String; cannot be cast to java.lang.String
> because PortletUrlHelper gots a method called: ensureParamsAreStringArrays which is called when constructing the surrounding form ...
> which does convert the entire map to hold string arrays - but than buildResourceUrl must fail everytime.
> Using get and %{ognlvaluexpr} it does work nearly, only the CCE is making things worse.
> The fault is 
>                 Object value = findValue(this.value);
>                 component.addParameter(name, value);
> in the param Tag. findValue does return actually an Integer instance which is put to the parameter Map.
> This should be converted to String before inserting it to the map.
> Besides this, using All the above things still apply.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2846) s:url Tag with parameters does not work or results in ClassCastException

Posted by "Torsten Krah (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2846?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Torsten Krah updated WW-2846:
-----------------------------

    Attachment: Param.diff

Diff to make sure "Strings" are added to the parameters.

> s:url Tag with parameters does not work or results in ClassCastException
> ------------------------------------------------------------------------
>
>                 Key: WW-2846
>                 URL: https://issues.apache.org/struts/browse/WW-2846
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Portlet, Plugin - Tags
>    Affects Versions: 2.0.11.2
>         Environment: Pluto 1.1.6, Java5
>            Reporter: Torsten Krah
>         Attachments: Param.diff
>
>
> Using Example 1 from s:url Tag
> http://struts.apache.org/2.0.11.2/struts2-core/apidocs/org/apache/struts2/components/URL.html
> does not work in an PortletEnvironment. Only the url is generated.
> Debugging to PortletUrlHelper the params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="%{selected}" />
>  </s:url>
> does not work. The params map is empty
>  <s:url value="editGadget.action">
>      <s:param name="id" value="abc" />
>  </s:url>
> does not work. The params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="40" />
>  </s:url>
> does not work. The param is in the Map, but its not a String, its an Integer - which results in a ClassCastException at:
>   String key = (String)it.next();
>   String val = (String)params.get(key);
> Portlet Spec mentions to use Servlet for resource streaming and other things you can't do with portlets.
> I need to generate servlet URLs containing parameters - but it seems i can't create them with struts.
> Using "includeParams=ALL" (which you may use to get extraparams included), does result in
> [Ljava.lang.String; cannot be cast to java.lang.String
> because PortletUrlHelper gots a method called: ensureParamsAreStringArrays which is called when constructing the surrounding form ...
> which does convert the entire map to hold string arrays - but than buildResourceUrl must fail everytime.
> Using get and %{ognlvaluexpr} it does work nearly, only the CCE is making things worse.
> The fault is 
>                 Object value = findValue(this.value);
>                 component.addParameter(name, value);
> in the param Tag. findValue does return actually an Integer instance which is put to the parameter Map.
> This should be converted to String before inserting it to the map.
> Besides this, using All the above things still apply.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WW-2846) s:url Tag with parameters does not work or results in ClassCastException

Posted by "Nils-Helge Garli (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2846?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nils-Helge Garli resolved WW-2846.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.3

> s:url Tag with parameters does not work or results in ClassCastException
> ------------------------------------------------------------------------
>
>                 Key: WW-2846
>                 URL: https://issues.apache.org/struts/browse/WW-2846
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Portlet, Plugin - Tags
>    Affects Versions: 2.0.11.2
>         Environment: Pluto 1.1.6, Java5
>            Reporter: Torsten Krah
>            Assignee: Nils-Helge Garli
>             Fix For: 2.1.3
>
>         Attachments: Param.diff, PortletUrlHelper.diff
>
>
> Using Example 1 from s:url Tag
> http://struts.apache.org/2.0.11.2/struts2-core/apidocs/org/apache/struts2/components/URL.html
> does not work in an PortletEnvironment. Only the url is generated.
> Debugging to PortletUrlHelper the params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="%{selected}" />
>  </s:url>
> does not work. The params map is empty
>  <s:url value="editGadget.action">
>      <s:param name="id" value="abc" />
>  </s:url>
> does not work. The params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="40" />
>  </s:url>
> does not work. The param is in the Map, but its not a String, its an Integer - which results in a ClassCastException at:
>   String key = (String)it.next();
>   String val = (String)params.get(key);
> Portlet Spec mentions to use Servlet for resource streaming and other things you can't do with portlets.
> I need to generate servlet URLs containing parameters - but it seems i can't create them with struts.
> Using "includeParams=ALL" (which you may use to get extraparams included), does result in
> [Ljava.lang.String; cannot be cast to java.lang.String
> because PortletUrlHelper gots a method called: ensureParamsAreStringArrays which is called when constructing the surrounding form ...
> which does convert the entire map to hold string arrays - but than buildResourceUrl must fail everytime.
> Using get and %{ognlvaluexpr} it does work nearly, only the CCE is making things worse.
> The fault is 
>                 Object value = findValue(this.value);
>                 component.addParameter(name, value);
> in the param Tag. findValue does return actually an Integer instance which is put to the parameter Map.
> This should be converted to String before inserting it to the map.
> Besides this, using All the above things still apply.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2846) s:url Tag with parameters does not work or results in ClassCastException

Posted by "Nils-Helge Garli (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2846?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44855#action_44855 ] 

Nils-Helge Garli commented on WW-2846:
--------------------------------------

I'm not sure I understand the issue with includeParams=ALL. Do you have an example?

> s:url Tag with parameters does not work or results in ClassCastException
> ------------------------------------------------------------------------
>
>                 Key: WW-2846
>                 URL: https://issues.apache.org/struts/browse/WW-2846
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Portlet, Plugin - Tags
>    Affects Versions: 2.0.11.2
>         Environment: Pluto 1.1.6, Java5
>            Reporter: Torsten Krah
>         Attachments: Param.diff
>
>
> Using Example 1 from s:url Tag
> http://struts.apache.org/2.0.11.2/struts2-core/apidocs/org/apache/struts2/components/URL.html
> does not work in an PortletEnvironment. Only the url is generated.
> Debugging to PortletUrlHelper the params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="%{selected}" />
>  </s:url>
> does not work. The params map is empty
>  <s:url value="editGadget.action">
>      <s:param name="id" value="abc" />
>  </s:url>
> does not work. The params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="40" />
>  </s:url>
> does not work. The param is in the Map, but its not a String, its an Integer - which results in a ClassCastException at:
>   String key = (String)it.next();
>   String val = (String)params.get(key);
> Portlet Spec mentions to use Servlet for resource streaming and other things you can't do with portlets.
> I need to generate servlet URLs containing parameters - but it seems i can't create them with struts.
> Using "includeParams=ALL" (which you may use to get extraparams included), does result in
> [Ljava.lang.String; cannot be cast to java.lang.String
> because PortletUrlHelper gots a method called: ensureParamsAreStringArrays which is called when constructing the surrounding form ...
> which does convert the entire map to hold string arrays - but than buildResourceUrl must fail everytime.
> Using get and %{ognlvaluexpr} it does work nearly, only the CCE is making things worse.
> The fault is 
>                 Object value = findValue(this.value);
>                 component.addParameter(name, value);
> in the param Tag. findValue does return actually an Integer instance which is put to the parameter Map.
> This should be converted to String before inserting it to the map.
> Besides this, using All the above things still apply.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2846) s:url Tag with parameters does not work or results in ClassCastException

Posted by "Torsten Krah (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2846?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Torsten Krah updated WW-2846:
-----------------------------

    Attachment: PortletUrlHelper.diff

Diff to make ResourceUrls working with non String parameters.
The only thing which is missing yet, the injected encoding parameter is "null" although i did specify it in struts.properties - so the default UTF-8 encoding is used everytime - but thats like the same as without the patch, so its doesn't matter.
This one makes the Param Patch obsolete.

> s:url Tag with parameters does not work or results in ClassCastException
> ------------------------------------------------------------------------
>
>                 Key: WW-2846
>                 URL: https://issues.apache.org/struts/browse/WW-2846
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Portlet, Plugin - Tags
>    Affects Versions: 2.0.11.2
>         Environment: Pluto 1.1.6, Java5
>            Reporter: Torsten Krah
>            Assignee: Nils-Helge Garli
>         Attachments: Param.diff, PortletUrlHelper.diff
>
>
> Using Example 1 from s:url Tag
> http://struts.apache.org/2.0.11.2/struts2-core/apidocs/org/apache/struts2/components/URL.html
> does not work in an PortletEnvironment. Only the url is generated.
> Debugging to PortletUrlHelper the params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="%{selected}" />
>  </s:url>
> does not work. The params map is empty
>  <s:url value="editGadget.action">
>      <s:param name="id" value="abc" />
>  </s:url>
> does not work. The params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="40" />
>  </s:url>
> does not work. The param is in the Map, but its not a String, its an Integer - which results in a ClassCastException at:
>   String key = (String)it.next();
>   String val = (String)params.get(key);
> Portlet Spec mentions to use Servlet for resource streaming and other things you can't do with portlets.
> I need to generate servlet URLs containing parameters - but it seems i can't create them with struts.
> Using "includeParams=ALL" (which you may use to get extraparams included), does result in
> [Ljava.lang.String; cannot be cast to java.lang.String
> because PortletUrlHelper gots a method called: ensureParamsAreStringArrays which is called when constructing the surrounding form ...
> which does convert the entire map to hold string arrays - but than buildResourceUrl must fail everytime.
> Using get and %{ognlvaluexpr} it does work nearly, only the CCE is making things worse.
> The fault is 
>                 Object value = findValue(this.value);
>                 component.addParameter(name, value);
> in the param Tag. findValue does return actually an Integer instance which is put to the parameter Map.
> This should be converted to String before inserting it to the map.
> Besides this, using All the above things still apply.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2846) s:url Tag with parameters does not work or results in ClassCastException

Posted by "Torsten Krah (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2846?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44857#action_44857 ] 

Torsten Krah commented on WW-2846:
----------------------------------

The issue with ALL is, that "all" parameters are included in the map, including the struts.portlet.mode ones etc., which are converted to string arrays (ensureParansAreStringarrays) - which does result again in the CCE.
@Example 2: You are right, it must be %{'abc'} to get the String. 1 and 3 are broken.

My workaround is a patch to PortletUrlHelper to get this working, see the attached file (thanks to maven a patched core build is done without big problems). This patch makes the Param patch obsolete and does things like its done in UrlHelper. Hope this one may be useful and is correct.


> s:url Tag with parameters does not work or results in ClassCastException
> ------------------------------------------------------------------------
>
>                 Key: WW-2846
>                 URL: https://issues.apache.org/struts/browse/WW-2846
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Portlet, Plugin - Tags
>    Affects Versions: 2.0.11.2
>         Environment: Pluto 1.1.6, Java5
>            Reporter: Torsten Krah
>            Assignee: Nils-Helge Garli
>         Attachments: Param.diff
>
>
> Using Example 1 from s:url Tag
> http://struts.apache.org/2.0.11.2/struts2-core/apidocs/org/apache/struts2/components/URL.html
> does not work in an PortletEnvironment. Only the url is generated.
> Debugging to PortletUrlHelper the params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="%{selected}" />
>  </s:url>
> does not work. The params map is empty
>  <s:url value="editGadget.action">
>      <s:param name="id" value="abc" />
>  </s:url>
> does not work. The params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="40" />
>  </s:url>
> does not work. The param is in the Map, but its not a String, its an Integer - which results in a ClassCastException at:
>   String key = (String)it.next();
>   String val = (String)params.get(key);
> Portlet Spec mentions to use Servlet for resource streaming and other things you can't do with portlets.
> I need to generate servlet URLs containing parameters - but it seems i can't create them with struts.
> Using "includeParams=ALL" (which you may use to get extraparams included), does result in
> [Ljava.lang.String; cannot be cast to java.lang.String
> because PortletUrlHelper gots a method called: ensureParamsAreStringArrays which is called when constructing the surrounding form ...
> which does convert the entire map to hold string arrays - but than buildResourceUrl must fail everytime.
> Using get and %{ognlvaluexpr} it does work nearly, only the CCE is making things worse.
> The fault is 
>                 Object value = findValue(this.value);
>                 component.addParameter(name, value);
> in the param Tag. findValue does return actually an Integer instance which is put to the parameter Map.
> This should be converted to String before inserting it to the map.
> Besides this, using All the above things still apply.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WW-2846) s:url Tag with parameters does not work or results in ClassCastException

Posted by "Nils-Helge Garli (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2846?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nils-Helge Garli reassigned WW-2846:
------------------------------------

    Assignee: Nils-Helge Garli

> s:url Tag with parameters does not work or results in ClassCastException
> ------------------------------------------------------------------------
>
>                 Key: WW-2846
>                 URL: https://issues.apache.org/struts/browse/WW-2846
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Portlet, Plugin - Tags
>    Affects Versions: 2.0.11.2
>         Environment: Pluto 1.1.6, Java5
>            Reporter: Torsten Krah
>            Assignee: Nils-Helge Garli
>         Attachments: Param.diff
>
>
> Using Example 1 from s:url Tag
> http://struts.apache.org/2.0.11.2/struts2-core/apidocs/org/apache/struts2/components/URL.html
> does not work in an PortletEnvironment. Only the url is generated.
> Debugging to PortletUrlHelper the params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="%{selected}" />
>  </s:url>
> does not work. The params map is empty
>  <s:url value="editGadget.action">
>      <s:param name="id" value="abc" />
>  </s:url>
> does not work. The params map is empty.
>  <s:url value="editGadget.action">
>      <s:param name="id" value="40" />
>  </s:url>
> does not work. The param is in the Map, but its not a String, its an Integer - which results in a ClassCastException at:
>   String key = (String)it.next();
>   String val = (String)params.get(key);
> Portlet Spec mentions to use Servlet for resource streaming and other things you can't do with portlets.
> I need to generate servlet URLs containing parameters - but it seems i can't create them with struts.
> Using "includeParams=ALL" (which you may use to get extraparams included), does result in
> [Ljava.lang.String; cannot be cast to java.lang.String
> because PortletUrlHelper gots a method called: ensureParamsAreStringArrays which is called when constructing the surrounding form ...
> which does convert the entire map to hold string arrays - but than buildResourceUrl must fail everytime.
> Using get and %{ognlvaluexpr} it does work nearly, only the CCE is making things worse.
> The fault is 
>                 Object value = findValue(this.value);
>                 component.addParameter(name, value);
> in the param Tag. findValue does return actually an Integer instance which is put to the parameter Map.
> This should be converted to String before inserting it to the map.
> Besides this, using All the above things still apply.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.