[jboss-user] [JBoss jBPM] - Re: Combo Box in Form

karstendausb do-not-reply at jboss.com
Fri Sep 7 09:40:51 EDT 2007


Hi Ronald,

I just found some time to try it out.

"kukeltje" wrote :  
  | I'm  curious though what would happen if you changed 
  | 
  | System.out.println("first.node-enter: directly after setting variable: instanceof selectitem:"+(test.get(0) instanceof javax.faces.model.SelectItem));
  | 
  | to 
  | 
  | System.out.println("first.node-enter: directly after setting variable: instanceof selectitem:"+(executionContext.getContextInstance().getVariable("selectitems").get(0) instanceof javax.faces.model.SelectItem));
  | 
  | 

It returns true.  Just adding them doesn't persist them, so this has to work.

anonymous wrote : I also wonder is something like this would work or if it would throw a classcastexception...
  |        
  |   |          public List getItems() {
  |   |                 List elements =  executionContext.getContextInstance().getVariable("selectitems");
  |   |                 Iterator i = elements.iterator();
  |   |                 List retVal = new LinkedList();
  |   | 
  |   |                 while(i.hasNext()) {
  |   |                         javax.faces.model.SelectItem element = (javax.faces.model.SelectItem) i.next();
  |   |                         javax.faces.model.SelectItem item = new javax.faces.model.SelectItem(element.getId(),element.getValue());
  |   |                         retVal.add(item);
  |   |                 }
  |   |                 return retVal;
  | 
  | I'll keep thinking/searching/...


That causes a ClassCastExcpetion:

  | 15:24:08,213 WARN  [Script] exception during evaluation of script expression
  | Sourced file: inline evaluation of: ``List elements = executionContext.getContextInstance().getVariable("selectitems") . . . '' : Typed variable declaration : null : at Line: 1 : in file: inline evaluation of: ``List elements = executionContext.getContextInstance().getVariable("selectitems") . . . '' : ( javax .faces .model .SelectItem ) i .next ( ) 
  | 
  | Target exception: java.lang.ClassCastException: Illegal cast. Cannot cast javax.faces.model.SelectItem to javax.faces.model.SelectItem
  | 
  |         at bsh.UtilTargetError.toEvalError(Unknown Source)
  |         at bsh.UtilEvalError.toEvalError(Unknown Source)
  |         at bsh.BSHCastExpression.eval(Unknown Source)
  |         at bsh.BSHVariableDeclarator.eval(Unknown Source)
  |         at bsh.BSHTypedVariableDeclaration.eval(Unknown Source)
  |         at bsh.BSHBlock.evalBlock(Unknown Source)
  |         at bsh.BSHBlock.eval(Unknown Source)
  |         at bsh.BSHBlock.eval(Unknown Source)
  |         at bsh.BSHWhileStatement.eval(Unknown Source)
  |         at bsh.Interpreter.eval(Unknown Source)
  |         at bsh.Interpreter.eval(Unknown Source)
  |         at bsh.Interpreter.eval(Unknown Source)
  |         at org.jbpm.graph.action.Script.eval(Script.java:129)
  |         at org.jbpm.graph.action.Script.eval(Script.java:72)
  | 

Very strange. What is  happening  here? I have a workaround (maps) for my proto and am thinking about Seam and other solutions, so this is not to urgent for me. 
But persistence layer being broken will probably cause bad problems along the way?

Karsten


 



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082163#4082163

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082163



More information about the jboss-user mailing list