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


Vivek Shrivastava
Ranch Hand

Joined: Jun 03, 2000
Posts: 277
I am creating a dynamic html table using jsp. First column of each row is a link (supposed to be). So if user click on that link I want to show the detail for that record.
Is there any way so that I can call a javascript method before opening that link then open link with modified version of link. Basically I have to pass some parameter to that link. That is why I am thinking like that.
Can be submitt a form ( with all hidden field) on click on a link.
can I create <href=�value�> portion dynamically for a link with four or five parameter using jsp.
can I create <OnClick=�value�> portion dynamically for a javascript function call.

If u have some other great idea please please let me know.
Please do reply. Your quick reply will be heartily appreciated.

[This message has been edited by Vivek Shrivastava (edited October 17, 2000).]
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Anything you can write as an HTML page can be written by a servlet or jsp. However, servlets and (especially) jsp are a real pain to debug. I suggest that you first make a plain HTML page to experiment with the various Javascript/Form/etc. options - just plug in arbitrary data where your final product will insert custom data.
Once you have that working, it will be a LOT easier to write the servlet or JSP required to generate it.

Joined: Aug 21, 2000
Posts: 19
u can achive this using by opening the remote window i mean to say window opener . By doing this u can pass the parameter u wish to a querystring to the seperate page(trough the window opener) in java script .

hope it is a easy way to achieve ur objective

Butch C

Joined: Oct 18, 2000
Posts: 7
> can I create <href=�value�> portion dynamically
We accomplish this by dynamically building the link parameters
in the JSP necessary to get at the detail record and tack the
parms onto the URL. For example the necesary parms could be
the key value(s) to access a column in a database.
e.g. <href="/SomeServlet?id=<%=object.getId()%>" would produce
The URL would point to a servlet. The servlet will get the
parms from the HttpServletRequest object, make the database
call and finally retrieve the object representing the detail
record which you want to display. The servlet puts the display object back in the Request object via the setAttribute("detail", object )
and forwards to the JSP which will display the detail record.
The detail JSP gets object from the request scope via
<jsp:useBean name="detail" ... scope="request"/> and displays the
data to the user.
Hope this helps...
Vivek Shrivastava
Ranch Hand

Joined: Jun 03, 2000
Posts: 277
Thanks Butch.
i am really appreciate this. it will really help me.
I agree. Here's the link:
subject: Help
It's not a secret anymore!