Mailing List Archive

error regarding opening the search results
Hi all,

I have written the code which gives me the url of searched results and that
url I am converting to the anchors. But the the problem is after clicking on
the link, I should be able to go and open the file it is referring, but
instead of that I am getting error as "Page can not be found".

My code is:
<%
/**
**search is the instance of the bean that I am using and
startSearch returns me a vector filed up with path of hits
*/

search.init();
Vector
v1=search.startSearch("\\disscusion_forum","formname");

for(int i=0;i<v1.size();i++){
try{
String item=((String)v1.elementAt(i));
out.println("val: "+item);
URL u=new URL("http",null,item);
String url=u.toString();
out.println("<a href="+item+">"+url+"</a>");
}catch (Exception e){
out.println("Error in forming URL");
out.println(e.getMessage());
}
}
%>

I should be able to open files return from the search.

Can anybody help me?
Thanx in advance.

Regards
parag
RE: error regarding opening the search results [ In reply to ]
Can you show the values of item and url? Are those correctly retrieved?
Also you are missing an extra set of quotes around the item. The proper
syntax is:

<a href="URL">string</a>

Note the there are quotes around the URL... You need something like this:
out.println("<a href=\""+item+"\">"+url+"</a>");

There is not enough information to diagnose the problem...
-AP_


-----Original Message-----
From: Parag Dharmadhikari [mailto:parag@bsil.com]
Sent: Thursday, October 25, 2001 3:37 AM
To: lucene-user
Subject: error regarding opening the search results


Hi all,

I have written the code which gives me the url of searched results and that
url I am converting to the anchors. But the the problem is after clicking on
the link, I should be able to go and open the file it is referring, but
instead of that I am getting error as "Page can not be found".

My code is:
<%
/**
**search is the instance of the bean that I am using and
startSearch returns me a vector filed up with path of hits
*/

search.init();
Vector
v1=search.startSearch("\\disscusion_forum","formname");

for(int i=0;i<v1.size();i++){
try{
String item=((String)v1.elementAt(i));
out.println("val: "+item);
URL u=new URL("http",null,item);
String url=u.toString();
out.println("<a href="+item+">"+url+"</a>");
}catch (Exception e){
out.println("Error in forming URL");
out.println(e.getMessage());
}
}
%>

I should be able to open files return from the search.

Can anybody help me?
Thanx in advance.

Regards
parag