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.