Why I can't use static for constant in JSP

Hi,

I use the static final for all the constant in my readUploadfile function :

private void readUploadfile(String uploadfileP, String tempfileP)

{

String linestr, linestr2;

int linenum, closelinenum;

static final String openschemaA="schema.a";

static final String openschemaB="schema.b";

static final String openschemaC="schema.c";

static final String openschemaD="schema.d";

===================================

but I got the following error :

jsp:44: Error: static is not a valid local variable or parameter modifier.

jsp:45: Error: static is not a valid local variable or parameter modifier.

jsp:46: Error: static is not a valid local variable or parameter modifier.

jsp:47: Error: static is not a valid local variable or parameter modifier.

when I remove the static, it works fine, why I can't use static for the constants in JSP?

Thanks,

ED

[977 byte] By [ED008OK] at [2007-9-26 21:11:16]
# 1

I don't see where JSP comes into this, but the rule in Java is that you can't declare static variables inside a method, which is what you are doing there. If this code is embedded in a JSP, then try using a JSP declaration:

<%! static final String openschemaA="schema.a"; %>

And if "static" doesn't work here either, don't worry too much about it. You should only have one instance of the JSP in any case.

DrClap at 2007-7-3 20:36:29 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...