Please help with this java agent

This should be complete this time.

Repost:

I am writing a java agent that does a rich text search on a document collection then puts the results in a folder. I then open the folder from a return field in the form. This is for a web based application. The folder displays all available documents when it opens instead of just the search results. Any ideas?

Here is the java code:

/*

  • Created on Jun 23, 2005

  • To change the template for this generated file go to

  • Window>Preferences>Java>Code Generation>Code and Comments

*/

package com.tlcc.notes;

import lotus.domino.*;

/**

  • @author kbrewer

  • To change the template for this generated type comment go to

  • Window>Preferences>Java>Code Generation>Code and Comments

*/

public class RichTextSearch extends AgentBase {

public void NotesMain() {

try {

Session session;

DocumentCollection dc;

AgentContext agentContext;

Database db;

String title;

Document curdoc;

String srchtext;

String srch;

session = getSession();

System.out.println(session.toString());

agentContext = session.getAgentContext();

System.out.println(agentContext.toString());

db = agentContext.getCurrentDatabase();

System.out.println(db.toString());

title = db.getTitle();

System.out.println(title.toString());

curdoc = agentContext.getDocumentContext();

System.out.println(curdoc.toString());

srchtext = curdoc.getItemValueString(“Search”);

srch = srchtext;

System.out.println(srch);

View view = db.getView(“SrchFolders\Test”);

dc = db.FTSearch(srch,0);

Document doc = dc.getFirstDocument();

while (doc != null) {

doc.putInFolder(“SrchFolders\Test”);

doc = dc.getNextDocument(doc); }

view.refresh();

//view.clear();

/*dc.putAllInFolder(“SrchFolders\Test”, false);

view.refresh();

String url = view.getHttpURL();*/

} catch(Exception e) {

e.printStackTrace();

}

}

}