Two Laptop Bag*
The moose likes JSP and the fly likes how to call a jsp function with in a hyperlink Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to call a jsp function with in a hyperlink" Watch "how to call a jsp function with in a hyperlink" New topic
Author

how to call a jsp function with in a hyperlink

k kousalya
Greenhorn

Joined: Jun 09, 2009
Posts: 12
hai all,
Can anyone help me??
Can we call a jsp function from a hyperlink in jsp page ?? I am developing one small web application. In that application, i
have to display the id numbers of all employees. If I click on one employee id, i have to display details of that employee.
My data bse is aceess database. I could display the details of employee id s in a table with hyperlinks to employee ids. How to
display the details of that employee. I have tried with jsp functions and java script function. But no use. Could anyone one please help me out.
thanks in advance.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14278
    
  21

A JSP represents a web page, exactly the same as any other HTML web page. You can just put the address of the JSP in the link - if you click on the link, your JSP will be executed. For example:

<a href="http://somewebsite.com/hello/customerdetails.jsp">Click here for details</a>

Usually, you'd want to pass some parameter to the JSP, so that it knows of which customer the details should be displayed. For example:

<a href="http://somewebsite.com/hello/customerdetails.jsp?cust_id=123">Click here for details of customer 123</a>


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
k kousalya
Greenhorn

Joined: Jun 09, 2009
Posts: 12
Thanks Jesper ,

But i have to display the details of employees in the same jsp page. how to do this ?? What thought is, divide the jsp page into two frames. I ll display id numbers in one frame, if i click on the employee id, details of that employee should be display in the second frame. How to do this. Please help me.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
Too difficult a question for us beginners. Moving.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61448
    
  67

Investigate the target attribute of the tag.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Andy Crane
Greenhorn

Joined: Dec 30, 2008
Posts: 17
Use ajax.

- user clicks id
- you make ajax call to jsp page to get the info for that id
- return that info in a json object
- use a dialog box or display a hidden div to display the returned data in an organized fashion

This enables you to only pull and display the list of ids on page load, which makes the page faster. And provided your hardware is at least average and your server is set up correctly your users won't see much of a delay if any delay at all with the ajax call.

- andy c

- andy c
"Pseudo code first. If you can pseudo code accurately, when you start writing code, you're just applying syntax to the pseudo code. It separates the two most complicated pieces of programming into manageable bites. You create your app's workflow without worrying about syntax. Then you code without worrying about your app's workflow."
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to call a jsp function with in a hyperlink