String array

I declared an arraystatus[] to keep my radio button values. But it seem like those codes does not work. Please help me!

<form action="controller.jsp" method="post">

<TABLE BORDER="1" width ="250" cellspacing="0" cellpadding ="2" align ="center">

<TR><TH colspan="2">Living Room</TH></tr>

<tr><TH align="center">Device</TH> <TH align="center">Status</tH></tr>

<%

String query ="SELECT * FROM device where locationID='"+0+"' order by device_name";

dbselect.rs = dbselect.executeQuery(query);

int i=0;

while ( (dbselect.rs).next() ){

String device = dbselect.rs.getString("device_name");

String status = dbselect.rs.getString("status");

String check1 ="";

String check2 ="";

if(status.equalsIgnoreCase("ON")){

check1="checked";

}

if(status.equalsIgnoreCase("OFF")){

check2="checked";

}

%>

<tr><TD><%= device %>

<input type="hidden" name="device<%= i%>" value="<%=device%>">

</TD>

<TD align="center">

<input type="hidden" name="status<%= i%>" value="<%= status%>">

<input type="radio" name="button<%= i%>" value="ON" ><%=check1%> >0n

<input type="radio" name="button<%=i%>" value="OFF" ><%=check2%> >Off

</TD>

</TR>

<%

i++

}// end while loop

%>

</table>

<center>

<input type="submit" name="ChangeStatus" value="Save Change">

<input type="Reset" name="Reset" value="Don't Save">

</center>

</form>

</div>

<% String change= request.getParameter("ChangeStatus");

String [] status=new String[i];

if (change!=null)

{

out.println("Save change has click\n");

for (int n=0; n<i; n++){

status[n] = request.getParameter("button<%= n%>");

String queryUp ="UPDATE device order by device_name SET status = '"+status[n]+"' WHERE locationID='"+0+"' ";

dbselect.rs = dbselect.executeQuery(queryUp);

}// end for

}// end if 1

%>

[4105 byte] By [yupngoclam@yahoo.com.sga] at [2007-10-2 10:14:45]
# 1
Haiiwhat sort of error are u getting? Any exception?regardsShanu
mshanua at 2007-7-13 1:38:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Hi Shanu,

thankx for you reply

This is the error message when I tried to run it

[javac] Since fork is true, ignoring compiler setting.

[javac] Compiling 1 source file

[javac] Since fork is true, ignoring compiler setting.

[javac] C:\tomcat41\work\Standalone\localhost\MyFYP\controller_jsp.java:162: unclosed string literal

[javac] status[n] = request.getParameter("button \r\n\r\n");

[javac]^

[javac] C:\tomcat41\work\Standalone\localhost\MyFYP\controller_jsp.java:173: 'catch' without 'try'

[javac]} catch (Throwable t) {

[javac]^

[javac] C:\tomcat41\work\Standalone\localhost\MyFYP\controller_jsp.java:30: 'try' without 'catch' or 'finally'

[javac]try {

[javac]^

[javac] C:\tomcat41\work\Standalone\localhost\MyFYP\controller_jsp.java:183: '}' expected

[javac] ^

[javac] 5 errors

yupngoclam@yahoo.com.sga at 2007-7-13 1:38:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
This error u got when u accessed your jsp? is this came in your ie?
mshanua at 2007-7-13 1:38:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
yeap shanu, That error I got when trying on IEBut honestly, I think something wrong with my Array, cause I tried to print out the status[] but it even cant print out.
yupngoclam@yahoo.com.sga at 2007-7-13 1:38:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
You are mixing up jsp and scriptlet code.You can't use <%= %> inside <% %>.trystatus[n] = request.getParameter("button" + n);
evnafetsa at 2007-7-13 1:38:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...