This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JSP and the fly likes Sending variable values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Sending variable values" Watch "Sending variable values" New topic

Sending variable values

Bon Gun

Joined: May 30, 2013
Posts: 8
I know how to send a post request using html input tags but is it possible to send a variable value to the server?
I have this variable:

<%!String name="gon";%>

I want to send the variable value ( gon ) using post request, can i? How?

d v lokesh venkata

Joined: Aug 09, 2013
Posts: 16

Try using hidden fields
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63348

No. In fact, there should be no Java variables, or Java code of any kind, in a modern JSP.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Frederik Nielsen

Joined: Aug 25, 2013
Posts: 14
Yes it is possible, and you can do it in many ways.

What is your requirements?
what is gon? it is something static? if so make it a hidden field. is it not static? what is it then? how does it change? what makes it change?

should gon be send when you hit a submit button in a form ?

It is hard to say what the best solution is for you without the excact requirements.
I agree. Here's the link:
subject: Sending variable values
It's not a secret anymore!