I have the following code, can you please help me to figure out how I could access the f_seat_status variable outside the if loop? Thank you. <% int l_session_seats_available =3; if (l_session_seats_available > 0) { String f_seat_status = "enrolled"; } else if (l_session_seats_available <= 0) { String f_seat_status = "waiting list"; } %> <%=f_seat_status %> <--- How do I get the f_seat_status outside the IF loop??
Andres Gonzalez
Ranch Hand
Joined: Nov 27, 2001
Posts: 1561
posted
0
You can't. The scope of the variable is visible only in the block you declared it. Why don't you declare it outside?
I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Despite the fact that this appears within a JSP, it's really a basic Java question, so I'm going to move this off to Java in General (beginner). bear [ October 21, 2003: Message edited by: Bear Bibeault ]