User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 397,798 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,345 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 5675 | Replies: 6
Reply
Join Date: Jul 2006
Posts: 6
Reputation: KilluaX is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
KilluaX KilluaX is offline Offline
Newbie Poster

How to use a Hyperlink to send info to a servlet

  #1  
Jul 27th, 2006
Hi, all

What I am trying to do is to put a hyperlink on my jsp page. Then, when I click on the link, I will come to the linked page and as well the page can get some info from the jsp page.

How is the code like?

thanks.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,183
Reputation: peter_budo has a spectacular aura about peter_budo has a spectacular aura about peter_budo has a spectacular aura about 
Rep Power: 10
Solved Threads: 265
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: How to use a Hyperlink to send info to a servlet

  #2  
Jul 27th, 2006
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
Last edited by peter_budo : Jul 27th, 2006 at 12:17 pm.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Reply With Quote  
Join Date: Jul 2006
Posts: 6
Reputation: KilluaX is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
KilluaX KilluaX is offline Offline
Newbie Poster

Re: How to use a Hyperlink to send info to a servlet

  #3  
Jul 27th, 2006
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?
Last edited by KilluaX : Jul 27th, 2006 at 1:27 pm.
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,183
Reputation: peter_budo has a spectacular aura about peter_budo has a spectacular aura about peter_budo has a spectacular aura about 
Rep Power: 10
Solved Threads: 265
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: How to use a Hyperlink to send info to a servlet

  #4  
Jul 27th, 2006
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?
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Reply With Quote  
Join Date: Jul 2006
Posts: 6
Reputation: KilluaX is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
KilluaX KilluaX is offline Offline
Newbie Poster

Re: How to use a Hyperlink to send info to a servlet

  #5  
Jul 27th, 2006
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.
Reply With Quote  
Join Date: Jul 2006
Posts: 6
Reputation: KilluaX is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
KilluaX KilluaX is offline Offline
Newbie Poster

Re: How to use a Hyperlink to send info to a servlet

  #6  
Jul 28th, 2006
Thanks for your help, guy

I think I already find the solution.

first, create a form with a hidden input like this

<form name=form method=post action=anypage><input type=hidden value=xxx  name=getit></form>

then, add a hyperlink with a submit function

<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
Reply With Quote  
Join Date: Oct 2003
Location: New York
Posts: 2
Reputation: DeAdPaCe is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
DeAdPaCe DeAdPaCe is offline Offline
Newbie Poster

Solution Re: How to use a Hyperlink to send info to a servlet

  #7  
Aug 1st, 2006
you could also create a regular link and pass the paramters as follows:

Last edited by DeAdPaCe : Aug 1st, 2006 at 1:49 pm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JSP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 5:49 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC