Yes, an upload is obviously the right way, but not in a JSP. God's write an actual Servlet, for Christ's sake. This scriptlet stuff is becoming a real scourge. Let me guess, you got this from roseindia, right?
Also, I assume that "/usr/programs/apache-tomcat-6.0.16/webapps/Pinnacle" is the directory in which your application is found? I.E. the Context Root. There are better ways of getting that information than hardcoding it.
Also, using "\n" in that "indexOf" stuff is also a bad idea. What happens if the client doing the upload is a MAC (which uses only \r for the line endings)?
root = tkinter.Tk()
buttons=[i for i in range(10)]
#If specific button is pressed, output "YES"
for num in buttons: