Solved

Search by keyword-Organization name displayed in links

Posted on 2003-11-08
13
267 Views
Last Modified: 2010-04-01
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
0
Comment
Question by:Jasbir21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 3
  • 2
13 Comments
 
LVL 14

Expert Comment

by:kennethxu
ID: 9709817
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
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 250 total points
ID: 9712260
<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
 

Author Comment

by:Jasbir21
ID: 9712425
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Jasbir21
ID: 9712826
.....
<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
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 9713141
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
 

Author Comment

by:Jasbir21
ID: 9713287
..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
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 9713550
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
 
LVL 14

Assisted Solution

by:kennethxu
kennethxu earned 100 total points
ID: 9715434
>> <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
 

Author Comment

by:Jasbir21
ID: 9721055
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
 

Author Comment

by:Jasbir21
ID: 9721057
..pls give me a bit more time..
Thanks
0
 

Author Comment

by:Jasbir21
ID: 9744487
..I am very sorry for posting the points late.I would close this question first ,  i think i understand the idea..

..thanks
0
 

Author Comment

by:Jasbir21
ID: 9744939
hi,
  I splitted the points becoz but answers are correct.
Thanks
0
 

Author Comment

by:Jasbir21
ID: 9745104
..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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article outlines some of the reasons why an email message gets flagged as spam on a recipient's end.
Let’s face it: one of the reasons your organization chose a SaaS solution (whether Microsoft Dynamics 365, Netsuite or SAP) is that it is subscription-based. The upkeep is done. Or so you think.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question