Solved

Search by keyword-Organization name displayed in links

Posted on 2003-11-08
13
263 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
  • 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Javascript onclick event 4 107
constuctor calling other constructor 2 76
some methods private some are not 8 212
Java Exception example issues 11 84
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
The question appears often enough, how do I transfer my data from my old server to the new server while preserving file shares, share permissions, and NTFS permisions.  Here are my tips for handling such a transfer.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

803 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