how to give hyperlink for sql server fields in jsp
Hi all,
I am pulling some datas from the database and displaying on a report.
One of the fields in that report is the DATA.
How can I give Hyperlink to that data value and then when I click on that DATA one of the form to be triggered.
(for example if the data value is "red" it should link "page1.jsp" and if it is blue "page2.jsp")
My question is ,
how to create an hyperlink on that particular column value DATA and how to make it action
according to my requirement mentioned above when user clicked on that value.
could anybody help me...Thanks in advance
Regards,
Radhi
[645 byte] By [
a1ba] at [2007-11-26 20:11:10]

# 1
Hi!
You can try to bind property "url" of hyperlink to some string parameter.
For this rightclick your hyperlink and choose "Property Bindings" and then bind "url" property to some parameter.
For example You can store this parameter in SessionBean.
public String getURL() {
if (condition which you can get from DB) return url1;
else return url2;
}
Thanks,
Roman.
# 2
Hi,
Thanks for ur response..
When i click the 1st field its working fine(going to required URL1) and then when i click the 2nd field(going to URL2)..No problem..
Now comes the issue..When i again click the 1st field its going to URL2(not to URL1). Means the last clicking URL is only linking for all values.
This is my code,
//the page where i click the field
<a href="somepage.jsp?event=onclick"><%= fieldname %></a>
//jsp page
String fieldvalue=(String)session.getAttribute("fieldvalue");
String condition1="red"
if(fieldvalue.equals(condition1))
{
<jsp:forward page="URL1" />
}
else{
<jsp:forward page="URL2" />
}
Waiting for ur reply,
Regards,
Radhi
a1ba at 2007-7-9 23:15:46 >
