tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chuck Amadi <chuck.am...@breconbeacons.org>
Subject indexed property type ie String [] for handling my checkboxes is converting the String to another value
Date Tue, 30 Apr 2002 08:37:54 GMT
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:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message