| Author |
Receiving a value from servlet
|
tatiana erm
Greenhorn
Joined: Jul 11, 2012
Posts: 5
|
|
Hello!
I'm trying to receive the "result" attribute (wich is equal to expression) to my jsp, but i always get "nul" there
actually it should be like that :
1. insert some expression
2. click Calculate
3. see the "expression" in the "result" field
could anyone spot my mistake?
thank you very much!
regards, tania.
servlet:
JSP:
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
just clarification: <input type="text" readonly="readonly" value= <%= request.getAttribute("result") %> /> why is this?
[EDIT] Ok, understand to display result .
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
|
one doubt: how do you submitting the form?
|
 |
tatiana erm
Greenhorn
Joined: Jul 11, 2012
Posts: 5
|
|
|
I click "Calculate" button :)
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
tatiana erm wrote:I click "Calculate" button :)
interesting dude :) . is tere any work around in javascript or how is it submitting form to servlet?
|
 |
tatiana erm
Greenhorn
Joined: Jul 11, 2012
Posts: 5
|
|
i get parameter
String action = request.getParameter("action");
and if it is calculate, i do the job
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
|
Ok, actually <button/> tag is new to me... :wink:
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
Ah,
Tips and Notes
Note: If you use the <button> element in an HTML form, different browsers may submit different values. Use <input> to create buttons in an HTML form.
Source:Here
Thanks dude. now I know <button> :thumbup:
|
 |
tatiana erm
Greenhorn
Joined: Jul 11, 2012
Posts: 5
|
|
|
I'm afraid THIS does not help me anyhow
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
Sounds like you are using more than one form.
</form>
<form action=""> ?
what is the action url?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56192
|
|
|
Is this about submitting the form, or getting the value of the scoped variable "result"? If the latter, the form is irrelevant.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: Receiving a value from servlet
|
|
|