Solved

Linking to other website

Posted on 2004-04-07
6
193 Views
Last Modified: 2010-04-01
inside my database, i have a column for the website url.. i was able to retreive it and use it as a hyperlink.. but there is a problem..
it says : The requested resource (/myFolder/www.yahoo.com) is not available.
thats is not what i wanted..it shouldn't go to myFolder to find the webiste..what i want is direct linking to the yahoo webpage..
pls help..thank you..

*the codes are done inside a servlet..
0
Comment
Question by:hyaku
  • 4
  • 2
6 Comments
 
LVL 92

Expert Comment

by:objects
ID: 10780470
can you post the code that is giving the error
0
 

Author Comment

by:hyaku
ID: 10780535
ok.
--------------------------------------
package com.search;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
//import com.register.*;

public class SearchServlet extends HttpServlet
{      
public void doPost(HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException
{
      response.setContentType("text/html");
      PrintWriter out = response.getWriter();
      StringBuffer result = new StringBuffer(2048);

      SearchBean searchBean = new SearchBean();
            
      String s = request.getParameter("searchCategory");
      String d = request.getParameter("searchDescription");

      Vector shopName = new Vector();
      shopName = searchBean.searchResultsName(s, d);
            
      Vector shopWebsite = new Vector();
      shopWebsite= searchBean.searchResultsWebsite(s, d);
            
      if(shopName.size()!=0)
      {      
            out.println("<html>");
            out.println("<head>");
            out.println("<title>Search Results</title>");
            out.println("</head>");
            out.println("<body>");
            out.println("<center>");
            out.println("<font size = 5>");
            out.println("<strong>Search Results</strong>");
            out.println("</font>");
            out.println("<HR></HR>");
            for(int i = 0; i<shopName.size();i++)
            {
            String shop = (String)shopName.get(i);
            out.println("<p align = left>");
            out.println("<B><U>");
            out.println(shop);
            out.println("</B></U>");
            out.println("<BR>");
                        
            String website = (String)shopWebsite.get(i);

            if(shopWebsite.get(i) == null)
            {
                  out.print("Website: ");
                  out.println("N/A");
                  out.println("<BR>");
            }
            else
            {
            out.print("Website: ");
            out.println("<a target=_blank href = "+website+">"+website+""); <--this part
            out.println("<BR>");
            }
                        
            out.println("</a>");
            out.println("</p>");
            }
            out.println("<DIV ID = back>");
            out.println("<A HREF = /myFolder/home.jsp>");
            out.println("<FONT SIZE = 2>");
            out.println("<STRONG>[Back to home page]</STRONG>");
            out.println("</FONT>");
            out.println("</A>");
            out.println("</DIV>");
            out.println("<br>");
            out.println("</center>");
            out.println("</body>");
            out.println("</html>");
      }
    }
}
0
 
LVL 92

Expert Comment

by:objects
ID: 10780538
looks like the value of website is incorrect, it should be an absolute url such as:
http://www.yahoo.com/
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 92

Accepted Solution

by:
objects earned 50 total points
ID: 10780541
perhaps u just need to prepend it with http://
0
 

Author Comment

by:hyaku
ID: 10780568
why i didn't think of that..it works
thank you objects.
0
 
LVL 92

Expert Comment

by:objects
ID: 10780587
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Note: This is the second blog post in a series on email clearinghouses (https://www.xmatters.com/alert-management/blog-email-has-failed-us?utm_campaign=70138000000ydLoAAI&utm_source=exex&utm_medium=article&utm_content=blog-post).   Every month t…
When we talk about DevOps toolchains, I sometimes wonder how many people really get what we’re talking about. I don’t know if it’s just semantics or tone or something else, but sometimes I think it just sounds like buzzword sausage. So it’s always …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 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

24 Experts available now in Live!

Get 1:1 Help Now