| | |
How to use a Hyperlink to send info to a servlet
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved
![]() |
what you have to do is design a bean which will hold what ever information you want to and pass to any other page on your site
this can be done before a link was clicked or when you click link you run process which set-up bean for you, then on other side you just call bean and pull your info from it
there is plenty of tutorials on google
this can be done before a link was clicked or when you click link you run process which set-up bean for you, then on other side you just call bean and pull your info from it
there is plenty of tutorials on google
Last edited by peter_budo; Jul 27th, 2006 at 1:17 pm.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
Join Date: Jul 2006
Posts: 6
Reputation:
Solved Threads: 0
Hi, peter
thanks for your reply
I see some tutorial on net about javabean, but I found it's a bit complicated for me now.
Can I just simply use a hyperlink like this <a href="linktosomepage" onclick="whatever"></a> to do it?
I search the net and it seems got kind of way to do it, but I can't find the exactly code. Does anyone know this?
thanks for your reply
I see some tutorial on net about javabean, but I found it's a bit complicated for me now.
Can I just simply use a hyperlink like this <a href="linktosomepage" onclick="whatever"></a> to do it?
I search the net and it seems got kind of way to do it, but I can't find the exactly code. Does anyone know this?
Last edited by KilluaX; Jul 27th, 2006 at 2:27 pm.
Can you please tell me what exactly you are trying to do so I can help you more efficiently?
Just collect some info from user and display it on other page or you want to store it somewhere and use on different palces on your site?
Just collect some info from user and display it on other page or you want to store it somewhere and use on different palces on your site?
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
Join Date: Jul 2006
Posts: 6
Reputation:
Solved Threads: 0
ok
generelly, what i'm trying to do is to set up a simple mail server using java servlet as well as jsp
Now, my program can already show the subjects of all the mails in the inbox(this page call inbox.jsp)
I want to do that, when I click on the subject of any mail, will come to a new page that shows the content of the mail(come to content.jsp and show the content of certain mail).
My servlet already collect all information and pass them to the inbox.jsp
The problem is that content.jsp don't which mail to display when i click the link.So i want the hyperlink to send something to tell content.jsp which page i want and what is the content of it.
generelly, what i'm trying to do is to set up a simple mail server using java servlet as well as jsp
Now, my program can already show the subjects of all the mails in the inbox(this page call inbox.jsp)
I want to do that, when I click on the subject of any mail, will come to a new page that shows the content of the mail(come to content.jsp and show the content of certain mail).
My servlet already collect all information and pass them to the inbox.jsp
The problem is that content.jsp don't which mail to display when i click the link.So i want the hyperlink to send something to tell content.jsp which page i want and what is the content of it.
•
•
Join Date: Jul 2006
Posts: 6
Reputation:
Solved Threads: 0
Thanks for your help, guy
I think I already find the solution.
first, create a form with a hidden input like this
then, add a hyperlink with a submit function
ok, that's it
I hope it will be helpful if anyone got the same problem with me
and thank you again, peter
I think I already find the solution.
first, create a form with a hidden input like this
JSP Syntax (Toggle Plain Text)
<form name=form method=post action=anypage><input type=hidden value=xxx name=getit></form>
then, add a hyperlink with a submit function
JSP Syntax (Toggle Plain Text)
<a href='javascript:document.form[0].submit()'>send it!</a>
ok, that's it
I hope it will be helpful if anyone got the same problem with me
and thank you again, peter
•
•
Join Date: Oct 2003
Posts: 2
Reputation:
Solved Threads: 1
you could also create a regular link and pass the paramters as follows:
<a href="www.yoursite.com/yourservlet?param=value">link</a> Last edited by DeAdPaCe; Aug 1st, 2006 at 2:49 pm.
•
•
Join Date: Dec 2008
Posts: 1
Reputation:
Solved Threads: 1
•
•
•
•
you could also create a regular link and pass the paramters as follows:
<a href="www.yoursite.com/yourservlet?param=value">link</a>
JSP Syntax (Toggle Plain Text)
<input type="hidden" name="param" value="a number" />
JSP Syntax (Toggle Plain Text)
<a href='javascript:document.form[0].submit()'>send it!</a>
It turns out I did something wrong(I don't know what, because I don't know JavaScript yet), each time a clicked the link, the right servlet went into action, but with the wrong parameter.
Each time it was only the parameter from the first hidden input. The rest was ignored.
When using the second option,
JSP Syntax (Toggle Plain Text)
<a href="www.yoursite.com/yourservlet?param=value">link</a>
![]() |
Similar Threads
- How to send an action to servlet through hyperlink and display the data on to jsp. (JSP)
- Having roblems using PHP to send info as text file (PHP)
Other Threads in the JSP Forum
- Previous Thread: security authentification using JDBCRealm under tomcat 6 and postgresql
- Next Thread: jsp with ajax
| Thread Tools | Search this Thread |
apache backbutton combobox connection database development directorystructure dynamicpagetitles eclipse frames glassfish imagetodatabse imageupload internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 network parameters passing ping printinserverinsteadofclient redirect request.getparameter response servlet servletdopost()readxml sessions software ssl state_saving_method stocks sun tomcat tutorial video web






