Search by keyword-Organization name displayed in links

Hi,

  I  posted a question at
 http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_20789534.html
and i understood.Now my problem is that when the table gets' displayed it is too croweded.
It would be much better if after the search, if the organization name could be displayed as links, for example, when the user enter old folk home, lamb home, the name or the project name or anything, the name of the organization gets displayed in links and when the user click the link, a pop-up window that displays the table get displayed.

Can it be done,  i tried modiying the code but i made it worse.

I really need this urgently but unfortunately my pc crash so i am using a cybercafe, and there might be late in response.

Thanks
Jasbir21Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kennethxuCommented:
if you display a link like this:
<a target='mypopup' href='yourdisplaytable.jsp?organizationid=<%=rs.getString("organizationid")%><%=rs.getString("organization")%></a>

and in the yourdisplaytable.jsp, you retrieve organizationid from parameter and render the table in popup window.
0
KuldeepchaturvediCommented:
<a target='mypopup' href='popup.jsp?organizationid=<%=rs.getString("organizationid")%><%=rs.getString("organization")%></a>

In this case you will have to read the database again in your pop up window...
i.e. in popup.jsp you will write like...

<%@ page import="java.sql.* ,com.dhal.*"%>
<%@ page import="java.util.StringTokenizer, java.lang.*"%>
<jsp:useBean id="s" class="com.dhal.skil" scope="session"/>
<jsp:setProperty name="s" property="*"/>
<html>
<body BGColor="#FFFFF0">
<%
String org=request.getParameter(organizationid");
String connectionURL = "jdbc:mysql://localhost:3306/mydatabase?user=;password=";
  Connection connection = null;
  Statement stmt=null;
  ResultSet rs=null;
 
  try
  {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    connection = DriverManager.getConnection(connectionURL, "", "");
   
    String getOrg="select * from organ where organizationid='"+org+"'";
    stmt=connection.createStatement();
    rs=stmt.executeQuery(getOrg);
if(rs.next())
{
%>
<FORM>
//Here you can write your HTML in whatever way you want to write it up. All the data can be fecthed by doing <%=rs.getString(1)%> or whatever column number you are trying to retrieve.
</FORM>

<%}%>

>>>>>>>>>>>>> Another possible way is to pass all the data as parameters.. something like

<a target='mypopup' href='popup.jsp?organizationid=<%=rs.getString("organizationid")%>&oggname=<%rs.getString("orgname")%>&skill=<%=rs.getString("skill")%>...........(and so on for all the values)<%=rs.getString("organization")%></a>

now inside the popup.jsp all you will have to do is
request.getParameter("skill");
request.getParameter("orgname");

and so on...
and then make the HTML out of it.

Hope this helps.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jasbir21Author Commented:
hi, i am unable to try it out, because my pc crash, would be ok in a days time.
Sorry for the late response,
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Jasbir21Author Commented:
.....
<a target='mypopup' href='popup.jsp?organizationid=<%=rs.getString("organizationid")%><%=rs.getString("organization")%></a>
...
I think i understood but my problem is if in there are 5 projects that belong to little lamb,

i think the output would be
Little lamb(link)
Little lamb(link)

How to modify it , if the link is already there, there is no need to repeat the link.

...
0
KuldeepchaturvediCommented:
Hmm............ Thats where it gets interesting....... may be you can enclose your link creation code inside a if condition....
This if condition will look if the link with this name is already created or not, if yes then it will skip the creation other wise it will create the link..
Now the problem is that you can do this on a ResultSet.....:-)
so the easyway out is to put them in a vector/Hashtable/Set or any itereator of your choice...

a rough code sniplet will look something like this..

Set s = new Set();
while(rs.next()) //your loop of resultset
{
String val=rs.getString("organization");
if(!s.contains(val))
{
//create the link
s.add(val)
}//end if
}//end while
This way you will not create the duplicate link...

One possible way may be to put DISTINCT clause in your query that will also solve the problem..
Hope this helps
0
Jasbir21Author Commented:
..one more confusion, sorry, in the previous question, the user would be able to use skill, organization name, or keyword,

The only difference would be that the eventhough , the user could type in project,skill,or keyword, the organization name would be displayed.

Sorry, i am unable to try it out at the moment, coz of pc crash,so, i am still able to use the previous code, right, ..
from top to
select query where +=id,
so this id would need to be sent to pop-up,is this right,
thanks
0
KuldeepchaturvediCommented:
You lost me completely...:-) I am sorry I am not able to get what you are saying in above comment..
I think you should be sending the keys of your table to pop-up. and these ids will come down to your result sets anyways so you should be able to send them from there.
0
kennethxuCommented:
>> <a target='mypopup' href='popup.jsp?organizationid=<%=rs.getString("organizationid")%><%=rs.getString("organization")%></a>
isn't it the same thing that I had suggested ? :-)

>> my problem is if in there are 5 projects that belong to little lamb
you can use:

select distinct organizationid, organization from .... where ....

so you only get one line per organization.
0
Jasbir21Author Commented:
no,it's ok,it was my fault. i am sorry for the late response...I haven't got my pc still,would get it in a day's time.

thanks
0
Jasbir21Author Commented:
..pls give me a bit more time..
Thanks
0
Jasbir21Author Commented:
..I am very sorry for posting the points late.I would close this question first ,  i think i understand the idea..

..thanks
0
Jasbir21Author Commented:
hi,
  I splitted the points becoz but answers are correct.
Thanks
0
Jasbir21Author Commented:
..when i put this:

<a target='mypopup' href='popup.jsp?organizationid=<%=rs.getString( "organname") %>&skill=<%=rs.getString("skillid")%>>

</a>


there is no link being displayed but this:

<a target='mypopup' href='popup.jsp?organizationid=Mercy&skill=Teacher> <a target='mypopup' href='popup.jsp?organizationid=Mercy&skill=Doc> <a target='mypopup' href='popup.jsp?organizationid=Mercy&skill=Teacher> <a target='mypopup' href='popup.jsp?organizationid=Mercy&skill=Doc> <a target='mypopup' href='popup.jsp?organizationid=Mercy&skill=Doc> <a target='mypopup' href='popup.jsp?organizationid=Mercy&skill=Doc> <a target='mypopup' href='popup.jsp?organizationid=Mercy&skill=Teacher> <a target='mypopup' href='popup.jsp?organizationid=Mercy&skill=fff , bb> <a target='mypopup' href='popup.jsp?organizationid=Mercy&skill=Teacher, Doc>

thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.