Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help

 
Vivek Shrivastava
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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.
Or
Can be submitt a form ( with all hidden field) on click on a link.
Or
can I create <href=�value�> portion dynamically for a link with four or five parameter using jsp.
Or
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.
vivek

[This message has been edited by Vivek Shrivastava (edited October 17, 2000).]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Bill
 
thejus/mahesh
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
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

regd
thejus/mahesh
 
Butch C
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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
<href="/SomeServlet?id=23%>"
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...
BC
 
Vivek Shrivastava
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Butch.
i am really appreciate this. it will really help me.
vivek
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic