my dog learned polymorphism*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Help" Watch "Help" New topic
Author

Help

Vivek Shrivastava
Ranch Hand

Joined: Jun 03, 2000
Posts: 277
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

Joined: Mar 22, 2000
Posts: 12761
    
    5
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

Joined: Aug 21, 2000
Posts: 19
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

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
<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

Joined: Jun 03, 2000
Posts: 277
Thanks Butch.
i am really appreciate this. it will really help me.
vivek
 
 
subject: Help
 
Similar Threads
Struts question
Ajax.InPlaceEditor and manual enterEditMode
JSP and javascript
Tomcat Database Connection Pooling Error
Problem displaying link content in a perticular page using Struts