jQuery in Action, 2nd edition*
The moose likes Servlets and the fly likes Accessing HTML values in JSP without submitting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Accessing HTML values in JSP without submitting" Watch "Accessing HTML values in JSP without submitting" New topic
Author

Accessing HTML values in JSP without submitting

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I'm trying to access a value in a textbox through JSP without submitting the page. Any suggestions? There doesn't seem to be a mechanism for it, as request.getParameter() only gets values from the requesting page. Also, in a scriptlet, all statements must be complete, so can't do something like this:
<%
String s = new String("
%>
<script type="text/javascript" defer="defer">
document.getElementById("textfieldname");
</script>
<%
");
//do something with String s
%>
Any suggestions? Thanks.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
I think you should start with a plain HTML file containing the Javascript that works the way you want, then turn that into a JSP page.
I think you are confusing the roles of Javascript on the client and server-side programming. JSP can only work with a browser request.
Bill

------------------
author of:
 
Don't get me started about those stupid light bulbs.
 
subject: Accessing HTML values in JSP without submitting
 
Similar Threads
JSP with JavaScript and Comments
Can't get first JSTL to work
passing a variable from html/jsp to javascript
passing object from JSP to Javascript
Error handling in JSp's