File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Hidden Variables and Hyper Link Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Hidden Variables and Hyper Link " Watch "Hidden Variables and Hyper Link " New topic

Hidden Variables and Hyper Link

Maneesh Chauahn
Ranch Hand

Joined: Mar 06, 2006
Posts: 48
Hi All,
I have a question on the hidden variables . I have a simple JSP page

<form name = "XXXX" method = "POST" action "">

< input type = "hidden" name = "a" value = "a"
<td align="right"><a href="/nams/svc/myaccount/save/ealert"><img src="/templates/nams/images/btn_close.gif" width="83" height="22" border="0"></a></td>


As in the above the action is empty so when i link on the hyper link . will the hidden variable also pass with the request.

Means can i pass the hidden variables by click on the hyper - link and this hyper link point to action defined in the strust-config.xml

Thanks in advance for your prompt answer

Maneesh Chauhan
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13035
What happened when you tried it?
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
Clicking on a hyper link will always use HTTP GET (not POST).

MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Clicking on the link is redirecting to that URL. If you want your form fields on the server you need to submit the page/form. Other option would be make your hidden fields part of the link's URL.
I agree. Here's the link:
subject: Hidden Variables and Hyper Link
It's not a secret anymore!