Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

CoreInputText instanceOf error

 
Adrian Ahmed
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying to create an interface for a questionnaire where to use a tr:selectManyCheckBox and tr:inputText.
Bellow i give you the relevant code and at the end I'll address the question.

[questionPanel.jspx]
...
<tr:selectManyCheckbox id="#{concat('question')">
<f:selectItems value="#{question.optionItems}">
</tr:selectManyCheckbox>

<tr:inputText id="#{concat('question')"/>
...
[/questionPanel.jspx]

[Function.java]
public static int COUNTER = 0;
public static String concat(String str){
COUNTER = COUNTER++;
str = str+COUNTER;
return str;
}
[/Function.java]

[Question.java]
public SelectItem[] getOptionItems{
return optionItems;
}
[/Question.java]

[QAMgdBean.java]
...
public String next(){
javax.faces.component.UIViewRoot root = FacesContext.getCurrentInstance() .getViewRoot() ;
Map requestMap = FacesContext.getExternalContext().getRequestParameterMap() ;
Iterator it = map.entrySet().iterator();
String str = null;
while(iter.hasNext()){
str =iter.next();
Object ob=null;
if(str.indexOf("question")>0){
ob = root.findComponent(str);
}

if(ob instanceOf CoreSelectManyCheckbox){
log.debug("coreselectManyCheckbox " + str);
CoreSelectManyCheckbox checkBoxes = (CoreSelectManyCheckbox) ob;
log.debug("coreselectManyCheckbox values " + checkBoxes.getValue());
}else if(ob instanceOf CoreInputText){
log.debug("coreinputtext " +str);
CoreInputText coreinputtext = (CoreInputText) ob;
log.debug("coreinputtext values " + coreinputtext.getValue());
}
}



}
[/QAMgdBean.java]




The problem is the logger writes:
coreselectManyCheckbox question1
coreselectManyCheckbox values [1,2,3,5]
coreselectManyCheckbox question2
coreselectManyCheckbox values null

I don't understand why I get this logs? In my opinion I should get:

coreselectManyCheckbox question1
coreselectManyCheckbox values [1,2,3,5]
coreinputtext question2
coreinputtext values test

Please help me to understand what is wrong with instanceOf test


Thanks
 
Always! Wait. Never. Shut up. Look at this tiny ad.
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!