You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Uttam Patil (JIRA)" <ji...@apache.org> on 2008/11/25 07:44:37 UTC

[jira] Created: (WW-2894) How to get parameter values from request in the custom interceptor

How to get parameter values from request in the custom interceptor
------------------------------------------------------------------

                 Key: WW-2894
                 URL: https://issues.apache.org/struts/browse/WW-2894
             Project: Struts 2
          Issue Type: Bug
    Affects Versions: 2.0.0
         Environment: Struts 2
            Reporter: Uttam Patil


Hi
  Following code is giving the parameter values as object. How to get it as String?

  Output of following code is like this----------

                08/11/25 12:12:12 Name - customerId - Value - [Ljava.lang.String;@1882554



public String intercept(ActionInvocation invocation) throws Exception {
		try{
			Map parameters = invocation.getInvocationContext().getParameters();
			if (parameters != null) {
				Iterator iterator = parameters.entrySet().iterator();
				do {
					if (!iterator.hasNext()) {
						break;
					}
					Entry entry = (Entry) iterator.next();
					String name = entry.getKey().toString();
					Object value = entry.getValue();
					if(value instanceof String){
						String bStr = (String)value;
						System.out.println("Name - " + name + " - Value - "+ bStr);
					}else{
						System.out.println("Name - " + name + " - Value - "+ value);
					}
				} while (true);
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		return invocation.invoke();
	}

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


[jira] Resolved: (WW-2894) How to get parameter values from request in the custom interceptor

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

Philip Luppens resolved WW-2894.
--------------------------------

    Resolution: Not A Problem

Please ask user questions on the the Struts user mailing list. 

> How to get parameter values from request in the custom interceptor
> ------------------------------------------------------------------
>
>                 Key: WW-2894
>                 URL: https://issues.apache.org/struts/browse/WW-2894
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>         Environment: Struts 2
>            Reporter: Uttam Patil
>
> Hi
>   Following code is giving the parameter values as object. How to get it as String?
>   Output of following code is like this----------
>                 08/11/25 12:12:12 Name - customerId - Value - [Ljava.lang.String;@1882554
> public String intercept(ActionInvocation invocation) throws Exception {
> 		try{
> 			Map parameters = invocation.getInvocationContext().getParameters();
> 			if (parameters != null) {
> 				Iterator iterator = parameters.entrySet().iterator();
> 				do {
> 					if (!iterator.hasNext()) {
> 						break;
> 					}
> 					Entry entry = (Entry) iterator.next();
> 					String name = entry.getKey().toString();
> 					Object value = entry.getValue();
> 					if(value instanceof String){
> 						String bStr = (String)value;
> 						System.out.println("Name - " + name + " - Value - "+ bStr);
> 					}else{
> 						System.out.println("Name - " + name + " - Value - "+ value);
> 					}
> 				} while (true);
> 			}
> 		}catch(Exception e){
> 			e.printStackTrace();
> 		}
> 		return invocation.invoke();
> 	}

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