Hi  I have a indexed property type ie String [] for handling my checkboxes.

 I have provided a suitable getter & setter method as below
 I have also declared the variable  a private String [] opportunity;
and a constructor opportunity = new String [] {"1"};


public String[] getOpportunity(){
            retun opportunity;
}

public void setOpportunity(String [] opportunity ) {
                opportunity = opportunity;
}

public String isCbSelected (String s) {
    boolean found=false;
    if (!opportunity[0].equals("1")){
    for (int i = 0; i <opportunity.length;i++){
    if (opportunity[i].equals(s)){
    found=true;
    break
}
}
if (found) return "checked";
}
return "";
}

Thus i have scriplet code in my jsp for displaying the indexed property 
type but on checking my database it is populating it with another value
as the jsp:setProperty> is converting the String to another value ie 
[Ljava.lang.String;@13a9bc77 in the database table's (opportunity)column 
field .

My array elements are obviously being converted , so i can i ensure that 
the array returns the predefined name attributes as below

<input tupe="checkbox" name="opportunity" value="Contact"
<%formHandler.isCbSelected("contact")%>>

<input tupe="checkbox" name="opportunity" value="viewpoint"
<%formHandler.isCbSelected("viewpoint")%>>

I am aware that there is a custom tag alternative but im hoping to 
utilise the memento pattern for form  processing .
Any suggestions

Cheers Chuck Amadi
System Programmer

Rhaglennydd Systemai



--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to