Hello,
I’m a newbie with IT Mill. I try to do a window, where I could select via link an item and show the item’s id in a another window. In html it would be as simple as:
<a href=secondwin.jsp?item=123>click here and secondwin.jsp would do <%=request.getParameter(“item”)%>.
In It Mill I have done a ParameterHandler example, but I don’t understand how that should work. I get the correct answer, if I use Label as result, but if I take the answer to String, I don’t get result. Here’s what I mean.
I call this example like: https://weblogic:7020/test/test?test=123
And the result is :
'123’this from handle parameters
nullthis is from str
System.out says: test=‘123’
And the code is:
public class Test extends com.itmill.toolkit.Application implements ParameterHandler {
private final Label context = new Label();
private String text =null;
public void init() {
final Window main = new Window("ITMILL");
setMainWindow(main);
main.addParameterHandler(this);
main.addComponent(context);
Label textlb = new Label(this.text+"this is from str");
main.addComponent(textlb);
}
public void handleParameters(Map parameters) {
for (final Iterator i = parameters.keySet().iterator(); i.hasNext();) {
final String name = (String) i.next();
final String[] values = (String[]
) parameters.get(name);
String v = "";
for (int j = 0; j < values.length; j++) {
if (v.length() > 0) {
v += ", ";
}
v += "'" + values[j]
+ "'";
}
System.out.println(name+"="+v);
if (name.compareTo("test")==0){
this.text=v;
context.setValue(v+"this from handle parameters");
}
}
}
}
What didn’t I get or what should be the right way to do this?
Thanks !