aspose file tools*
The moose likes Servlets and the fly likes Reading html form values using java script. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Reading html form values using java script. " Watch "Reading html form values using java script. " New topic
Author

Reading html form values using java script.

Bonagiri UmaMaheshwar Rao
Greenhorn

Joined: Mar 27, 2005
Posts: 12
how can i read the form values using only java script. Because i cannot name my file other than *.html extension.
Still i need to retrieve the form values. Is it possible?

eg.
String formparam1 = request.getParameter("param1");

I want the above functionality to be achieved using javascript.
[ March 30, 2005: Message edited by: Bonagiri UmaMaheshwar Rao ]
pradeep bommakanti
Greenhorn

Joined: Mar 29, 2005
Posts: 5
lets take an example:
<form name="frm1">
<input type="text" name="login">
....
</form>
U can get this text filed value by:
document.frm1.login.value;

PS: frm1 -> your form name,
login -> text field name
value -> corresponding form element value
Bonagiri UmaMaheshwar Rao
Greenhorn

Joined: Mar 27, 2005
Posts: 12
actually i want to read the request parameters. when the form submitted.
like The way we use the request object to read the request parameters.
<br>
<p>
String param1 =request.getParameter("param1");

<p>
The same functionality should be acheived thorugh java script.
String param1 =someJavascriptobject.getParameter("param1");
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by Bonagiri UmaMaheshwar Rao:
actually i want to read the request parameters. when the form submitted.
like The way we use the request object to read the request parameters.
<br>
<p>
String param1 =request.getParameter("param1");

<p>
The same functionality should be acheived thorugh java script.
String param1 =someJavascriptobject.getParameter("param1");


No.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

how can i read the form values using only java script. Because i cannot name my file other than *.html extension.
Still i need to retrieve the form values. Is it possible?


Why can't you name your files anything other than *.html?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
If it's a .html file, then it's not Java anymore, much less servlets. And I don't know if there's such thing as a web server that uses html/javascript for server-side scripting.

On the other hand, if you only want the user to think that he's accessing a plain old .html file, you could probably map "filename.html" to the servlet in web.xml.

-Yuriy
[ March 30, 2005: Message edited by: Yuriy Zilbergleyt ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading html form values using java script.
 
Similar Threads
Pass Array from servlet program to JavaScript
How can I pass html form element values to applet?
bean: write tag,, simple but Big prob :( please help
forms values lost
how to use jsp variables in javascript