Jasbir21
asked on
Link not displaying properly
hi,
I have a link like this:
<a target='mypopup' href='popup.jsp?organizati onid=<%=rs .getString ( "organname") %>&skill=<%=rs.getString(" skillid")% >><%=rs.ge tString("o rganname") %></a>
I don't know why the link is not being displayed, i get this as errors:
<a target='mypopup' href='popup.jsp?organizati onid=Mercy &skill=Tea cher>Mercy <a target='mypopup' href='popup.jsp?organizati onid=Mercy &skill=Tea cher>Mercy <a target='mypopup' href='popup.jsp?organizati onid=Mercy .....
but the link is close but i don't know why,
Thanks
I have a link like this:
<a target='mypopup' href='popup.jsp?organizati
I don't know why the link is not being displayed, i get this as errors:
<a target='mypopup' href='popup.jsp?organizati
but the link is close but i don't know why,
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ahhhhhhhhhh....
Yup that will probably be it...
Yup that will probably be it...
ASKER
<%@ page import="java.sql.* ,com.dhal.*"%>
<%@ page import="java.util.StringTo kenizer, java.lang.*"%>
<jsp:useBean id="s" class="com.dhal.skil" scope="session"/>
<jsp:setProperty name="s" property="*"/>
<html>
<body BGColor="#FFFFF0">
<table border="4" BGColor="#FFF8DC" width="100%" CELLPADDING="4">
<tr>
<td>
<Font Color="#000000" Face="Garamond" Size="4">
<b>View Organizations</b>
</Font>
</td>
</tr>
</table>
<br>
<form action="update.jsp" name="form1">
&n bsp; &nbs p; &n bsp; &nbs p;
&n bsp; &nbs p;
Search by Skill : & nbsp;  ; &nb sp; & nbsp;  ; &nb sp;
<select name="choose">
<option value="">Select a skill</option>
<option value="*">All</option>
<%
String connectionURL = "jdbc:mysql://localhost:33 06/mydatab ase?user=; password=" ;
Connection connection = null;
Statement stmt=null;
ResultSet rs=null;
try
{
Class.forName("com.mysql.j dbc.Driver ").newInst ance();
connection = DriverManager.getConnectio n(connecti onURL, "", "");
String myskill="select * from skill";
stmt=connection.createStat ement();
rs=stmt.executeQuery(myski ll);
while(rs.next())
{
%>
<option value=<%= rs.getString("skillid") %>><%= rs.getString("skillid") %></option>
<%
}
// close this!!
rs.close() ;
%>
</select>
</p>
&n bsp; &nbs p; &n bsp; &nbs p; &n bsp; &nbs p;
Search by Organization :
<select name="project">
<option value="">Select an Organization</option>
<option value="*">All</option>
<%
String myproj="select * from organ";
rs=stmt.executeQuery(mypro j);
while(rs.next())
{
%>
<option value=<%= rs.getString("organname") %>><%= rs.getString("organname") %></option>
<%
}
// close this!!
rs.close() ;
rs = null ;
stmt.close() ;
stmt = null ;
%>
</select>
</p>
&n bsp; &nbs p; &n bsp; &nbs p;
&n bsp; &nbs p;
Search by keyword : & nbsp;  ; &nb sp;
<input type="text" name="keyword" size=30/>
&n bsp;
<input type="submit" value="Go">
<br><br><hr>
<%
//this is for search by keyword where the user can enter anything
String keyword = request.getParameter( "keyword" ) ;
System.out.println(keyword );
String where = "" ;
if( keyword != null && keyword.trim().length()!= 0 )
{
StringTokenizer st = new StringTokenizer( keyword ) ;
while( st.hasMoreTokens() )
{
if( where.length() == 0 )
where = " ( " ;
String word = st.nextToken() ;
//it searches the keyword with description field and skillid which is in the skill table..
where += "( skillid LIKE '%" + word +"%'OR projectid LIKE '%" + word +"%' OR description LIKE '%" + word +"%'OR start LIKE '%" + word +"%'OR end LIKE '%" + word +"%'OR organname LIKE '%" + word +"%')" ;
if( st.hasMoreTokens() )
where += " OR " ;
else
where += " ) " ;
}
}
//This takes the chose chosen by the user from the combo
//currently the query is stored in the where string and now you combine the where with the new query of the choose from combo...
String choose = request.getParameter( "choose" );
if( choose != null && choose.trim().length() != 0 )
{
if( where.length() > 0 )
where += " OR" ;
where += "( skillid = '" + choose + "' )" ;
}
String project = request.getParameter("proj ect");
if( project != null && project.trim().length() != 0 && !project.equals("*"))
{
if( where.length() > 0 )
where += " OR" ;
where += "( organname = '" + project + "' )" ;
}
if( where.length() > 0 )
{
%>
<table border="1"BGColor="#FFFFF0 " width="60%" CELLPADDING="4" style="margin-left:190px;" >
<%
String query=null;
where = " WHERE " + where ;
if(choose.equals("*")&&pro ject.equal s("*"))
query="Select * from project";
else
query= "Select distinct * from project " + where ;
// PRINT OUT THE QUERY FOR DEBUG PURPOSES
// out.println( "<b>Executing " + query + "</b>" ) ;
stmt=connection.createStat ement();
rs = stmt.executeQuery( query ) ;
//This is the place where result is printed out
if( rs.next() )
{
do
{
%>
<a target='mypopup' href='popup.jsp?organizati onid=<%=rs .getString ( "organname") %>&skill=<%=rs.getString(" skillid")% >><%=rs.ge tString("o rganname") %></a>
<%
} while( rs.next() ) ;
}
else
{
%>
<tr>
<td colspan="2" align=center>Sorry, no results found</td>
</tr>
<%
}
%>
<%
rs.close() ;
rs = null ;
stmt.close() ;
stmt = null ;
connection.close() ;
connection = null ;
%>
</table>
<%
}
}
catch( SQLException ex )
{
ex.printStackTrace() ;
}
catch( ClassNotFoundException ex )
{
ex.printStackTrace() ;
}
finally
{
// MAKE SURE ALL DB THINGS ARE CLOSED
try { if( rs != null ) rs.close() ; } catch( Exception ex ) { }
try { if( stmt != null ) stmt.close() ; } catch( Exception ex ) { }
try { if( connection != null ) connection.close() ; } catch( Exception ex ) { }
}
%>
</form>
</body>
</html>
<%@ page import="java.util.StringTo
<jsp:useBean id="s" class="com.dhal.skil" scope="session"/>
<jsp:setProperty name="s" property="*"/>
<html>
<body BGColor="#FFFFF0">
<table border="4" BGColor="#FFF8DC" width="100%" CELLPADDING="4">
<tr>
<td>
<Font Color="#000000" Face="Garamond" Size="4">
<b>View Organizations</b>
</Font>
</td>
</tr>
</table>
<br>
<form action="update.jsp" name="form1">
&n
&n
Search by Skill : &
<select name="choose">
<option value="">Select a skill</option>
<option value="*">All</option>
<%
String connectionURL = "jdbc:mysql://localhost:33
Connection connection = null;
Statement stmt=null;
ResultSet rs=null;
try
{
Class.forName("com.mysql.j
connection = DriverManager.getConnectio
String myskill="select * from skill";
stmt=connection.createStat
rs=stmt.executeQuery(myski
while(rs.next())
{
%>
<option value=<%= rs.getString("skillid") %>><%= rs.getString("skillid") %></option>
<%
}
// close this!!
rs.close() ;
%>
</select>
</p>
&n
Search by Organization :
<select name="project">
<option value="">Select an Organization</option>
<option value="*">All</option>
<%
String myproj="select * from organ";
rs=stmt.executeQuery(mypro
while(rs.next())
{
%>
<option value=<%= rs.getString("organname") %>><%= rs.getString("organname") %></option>
<%
}
// close this!!
rs.close() ;
rs = null ;
stmt.close() ;
stmt = null ;
%>
</select>
</p>
&n
&n
Search by keyword : &
<input type="text" name="keyword" size=30/>
&n
<input type="submit" value="Go">
<br><br><hr>
<%
//this is for search by keyword where the user can enter anything
String keyword = request.getParameter( "keyword" ) ;
System.out.println(keyword
String where = "" ;
if( keyword != null && keyword.trim().length()!= 0 )
{
StringTokenizer st = new StringTokenizer( keyword ) ;
while( st.hasMoreTokens() )
{
if( where.length() == 0 )
where = " ( " ;
String word = st.nextToken() ;
//it searches the keyword with description field and skillid which is in the skill table..
where += "( skillid LIKE '%" + word +"%'OR projectid LIKE '%" + word +"%' OR description LIKE '%" + word +"%'OR start LIKE '%" + word +"%'OR end LIKE '%" + word +"%'OR organname LIKE '%" + word +"%')" ;
if( st.hasMoreTokens() )
where += " OR " ;
else
where += " ) " ;
}
}
//This takes the chose chosen by the user from the combo
//currently the query is stored in the where string and now you combine the where with the new query of the choose from combo...
String choose = request.getParameter( "choose" );
if( choose != null && choose.trim().length() != 0 )
{
if( where.length() > 0 )
where += " OR" ;
where += "( skillid = '" + choose + "' )" ;
}
String project = request.getParameter("proj
if( project != null && project.trim().length() != 0 && !project.equals("*"))
{
if( where.length() > 0 )
where += " OR" ;
where += "( organname = '" + project + "' )" ;
}
if( where.length() > 0 )
{
%>
<table border="1"BGColor="#FFFFF0
<%
String query=null;
where = " WHERE " + where ;
if(choose.equals("*")&&pro
query="Select * from project";
else
query= "Select distinct * from project " + where ;
// PRINT OUT THE QUERY FOR DEBUG PURPOSES
// out.println( "<b>Executing " + query + "</b>" ) ;
stmt=connection.createStat
rs = stmt.executeQuery( query ) ;
//This is the place where result is printed out
if( rs.next() )
{
do
{
%>
<a target='mypopup' href='popup.jsp?organizati
<%
} while( rs.next() ) ;
}
else
{
%>
<tr>
<td colspan="2" align=center>Sorry, no results found</td>
</tr>
<%
}
%>
<%
rs.close() ;
rs = null ;
stmt.close() ;
stmt = null ;
connection.close() ;
connection = null ;
%>
</table>
<%
}
}
catch( SQLException ex )
{
ex.printStackTrace() ;
}
catch( ClassNotFoundException ex )
{
ex.printStackTrace() ;
}
finally
{
// MAKE SURE ALL DB THINGS ARE CLOSED
try { if( rs != null ) rs.close() ; } catch( Exception ex ) { }
try { if( stmt != null ) stmt.close() ; } catch( Exception ex ) { }
try { if( connection != null ) connection.close() ; } catch( Exception ex ) { }
}
%>
</form>
</body>
</html>
Have you tried putting in the missing ' character like ryancys suggested?
...&skill=<%=rs.getString( "skillid") %>'><%=r.. .
.......................... .......... .......... .......... .......... ^^ here
(not sure that will look right....wish there was a way of specifying fixed width on this thing...)
...&skill=<%=rs.getString(
..........................
(not sure that will look right....wish there was a way of specifying fixed width on this thing...)
ASKER
oh, sorry i didn't realize the ' .
Thanks
Thanks
:-)
I think there must be a problem with your code that you didn't paste here...
Tim.