Solved

Search by keyword-Organization name displayed in links

Posted on 2003-11-08
13
261 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
 

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
logging jar 1 104
trouble with PDF encryption using itext-1.3.1 17 77
maven webservice projet error 6 79
struts spring hibernate example 12 85
A procedure for exporting installed hotfix details of remote computers using powershell
We have come a long way with backup and data protection — from backing up to floppies, external drives, CDs, Blu-ray, flash drives, SSD drives, and now to the cloud.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now