Prince
02-12-2002, 03:02 AM
How can I read the values of a TEXT FIELD within a JSP? What is the code that can access the text field?
I don't want to pass the values by session to itself.
I don't want to pass the values by session to itself.
|
Click to See Complete Forum and Search --> : Simple JSP question Prince 02-12-2002, 03:02 AM How can I read the values of a TEXT FIELD within a JSP? What is the code that can access the text field? I don't want to pass the values by session to itself. mefisto3 02-13-2002, 06:11 PM I am not exactly sure what you want to do. You cant access the text field from a JSP. If you need to access the text field you should probably use JavaScript. Could you give more info? rock 02-14-2002, 09:49 AM Prince, I guess our conversation died in the conversion. Have you looked at examples in a tomcat 3.3 install under webapps/examples/jsp? For the record, the syntax is something like: calling html: <INPUT NAME=USER TYPE=TEXT VALUE=bob> target jsp: <%= request.getAttribute("USER") %> but the method can depend on your servlet. Prince 02-14-2002, 11:53 PM I didn't want to pass the variables to a page and then evaluate value . I wanted to evaluate value, on-the-fly in JSP. I guess i am going to have to use Javascript and combine with JSP. I am somewhat new to Java. Don't like it so much. It has its strong points, but it is a pain because no really really good IDE out there for it yet. After trying as many as i can, Jbuilder is the only one i can cope with. But even with Jbuilder, there are some things that you just have to its way, or it gives you stupid errors. Don't like Java interface, so used to Microsoft GUI that hard to get used to it. Java does look the same, but its feel is different (not to mention the reaction time), i am running a 500Mhz. It should be just fine on faster machines, but this 500Mhz is all i got rite now. mefisto3 02-15-2002, 12:01 AM Yeah, the Java IDE definitely sucks. I use JBuilder too at work and at home, and it is so bloody slow (i have a celery 600 at work and a pIII at home). Everytime i run JBuilder my computer does a lot of swapping (i have 128 MB at work). At home its not too bad (512 MB). Anywya, if you want to access the Text Field, u need to use JavaScript. JSP (being server side) have no access to the texf field. rock 02-15-2002, 02:46 PM You could force the jsp to call itself if the object comes back NULL: <% if ( request.getAttribute("USER") == null ) { %> <script language="JavaScript1.1"> location.replace('/webapps/servlet/Servlet?jsp=/jsp/target.jsp&user=<%= request.getAttribute("USER") %> ') </script> <% } %> Or something like that - I just pieced that together on the fly and doesn't look quite right to me.... SharkyExtreme.com
Copyright Internet.com Inc. All Rights Reserved. |