Solved

Link not displaying properly

Posted on 2003-11-14
7
219 Views
Last Modified: 2010-04-01
hi,
  I have a link like this:

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

I don't know why the link is not being displayed, i get this as errors:
<a target='mypopup' href='popup.jsp?organizationid=Mercy&skill=Teacher>Mercy <a target='mypopup' href='popup.jsp?organizationid=Mercy&skill=Teacher>Mercy <a target='mypopup' href='popup.jsp?organizationid=Mercy.....

but the link is close but i don't know why,

Thanks
0
Comment
Question by:Jasbir21
  • 4
  • 2
7 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 9747147
Can you post the code around the link?

I think there must be a problem with your code that you didn't paste here...

Tim.
0
 
LVL 50

Accepted Solution

by:
Ryan Chong earned 200 total points
ID: 9747177
Try:

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

0
 
LVL 35

Expert Comment

by:TimYates
ID: 9747183
Ahhhhhhhhhh....

Yup  that will probably be it...
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

Author Comment

by:Jasbir21
ID: 9747184
<%@ 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">

<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">
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 Search by Skill :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <select name="choose">
   <option value="">Select a skill</option>
   <option value="*">All</option>


<%
 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 myskill="select * from skill";
   stmt=connection.createStatement();
   rs=stmt.executeQuery(myskill);

   while(rs.next())
   {
%>
   <option value=<%= rs.getString("skillid") %>><%= rs.getString("skillid") %></option>
<%
   }

   // close this!!
   rs.close() ;
%>
</select>
</p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Search by Organization :&nbsp;&nbsp;
<select name="project">
   <option value="">Select an Organization</option>
   <option value="*">All</option>
<%
String myproj="select * from organ";
      rs=stmt.executeQuery(myproj);

   while(rs.next())
   {
%>
   <option value=<%= rs.getString("organname") %>><%= rs.getString("organname") %></option>
<%
   }

   // close this!!
   rs.close() ;

   rs = null ;
    stmt.close() ;
   stmt = null ;
%>

 </select>
 </p>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 Search by keyword :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <input type="text" name="keyword" size=30/>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <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("project");
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("*")&&project.equals("*"))
          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.createStatement();
     rs = stmt.executeQuery( query ) ;
 //This is the place where result is printed out


if( rs.next() )
     {


         do
         {
 
   
%>

<a target='mypopup' href='popup.jsp?organizationid=<%=rs.getString( "organname") %>&skill=<%=rs.getString("skillid")%>><%=rs.getString("organname")%></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>
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9747279
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...)
0
 

Author Comment

by:Jasbir21
ID: 9747350
oh, sorry i didn't realize the ' .


Thanks
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9747376
:-)
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jersey maven project error 7 141
problem with  angularjs dropdwon search at object property (name) level 2 99
login jsp example 24 50
jsp login check 12 32
Knowing where your website is hosted is as important as the features you receive, the monthly fee, and the support you receive. Due diligence should be done when choosing your next hosting provider.
Each year, investment in cloud platforms grows more than 20% (https://www.immun.io/hubfs/Immunio_2016/Content/Marketing/Cloud-Security-Report-2016.pdf?submissionGuid=a8d80a00-6fee-4b85-81db-a4e28f681762) as an increasing number of companies begin to…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 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