Well, I'm working on it and I collected all the information I need. Now it's
time to put them together in a unique, possibly fully functional solution.

What I'm realizing is a search facility which shows the user links to
actions which forward to the jsp of interest. This is possible by retrieving
the configuration information both on the struts-config.xml file (mapping
between action and JSPs), and on the tiles-defs.xml file (Yes, I'm using
Tiles). I've been desperate for a while, but then someone from the struts
mailing list illuminated me with the following trick:

 <definition name="tiles.administer" extends="xmlLayout">
      <put name="title" value="Jemos Administation page"/>
      <put name="security" value="/shared/adminSecurityTest.jsp"/>
      <put name="body" value="/site/bodies/administer-body.jsp"/>
      <put name="definition.location.tiles.administer"
value="administer.jsp" />

Basically, it seems (because I haven't tried yet) that it's possible to
define an additional property in a Tiles definition, without it being
actually present in any JSP. If we immagine to put a property which tells,
for each JSP which really contains the content, which is the JSP defined in
the struts configuration file, from there it's possible to get the map
between an action and this JSP, therefore (even if the road is quite long)
the mapping is possible. Here's how it works:

1) An administrator function (in my case a Struts action) creates an index,
given a specific folder (in my case the webapp/myapp folder) as input, a
desired folder as output, and specifying one or more file extensions to
consider for the search (Search facility realized with a steteless session
bean deployed under Jboss). The result is a database with the following
fields:

2) A user submits a query: a component will retrieve from the index all the
content-matching JSPs paths and thanks to another facility I developed, it
will remove the system-relative-path (let's say D:\Tomcat\webapps because
I'm running on Windows) from the JSP (returning the context relative path,
let's say myapp/content-body.jsp). All the matching JSPs will be returned as
a collection (or something similar...).

3) For each path, another component will look in the Tiles defs the matching
JSP (thanks to the above trick!); with this information the Struts
configuration file will be queried and the matching action retrieved: from
here it's quite simple to create a web-fully-context-path to show to the
user...

Result? The user will be shown with links to the actions which map to the
JSPs which contain what she searched for...

Limit? Initially this application will work for Tiles (even if I'll try to
apply some design patterns to allow different implementation) but my goal is
to design a general solution which could work with basic JSPs, include JSPs
and so on...

Hope this will help,

Marco


----- Original Message ----- 
From: "Robert Taylor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 12, 2003 4:51 PM
Subject: Lucene and Struts


> I have a web application developed with Struts and I wish to add the
ability
> for users to search the web application content.
>
> Some of the web application pages are directly accessible via a URL and
> others are only accessible via a Struts action mapping URL.
>
> All of the web application pages are composite pages (similar to Tiles)
> where
> each page includes and populates a template with content. The content may
> come from various locations but the runtime result is a complete page.
>
> After downloading Lucene and working with the demo applications I quickly
> realized the problems voiced by Marco Tedone  in this archived message:
>
> http://www.mail-archive.com/[EMAIL PROTECTED]/msg04656.html
>
>
> I read through the thread and it didn't appear that there was a
> simple/elegant solution.
>
> I was wondering if anyone has come up with a simple/elegant solution for
> using Lucene
> with Struts/Tiles.
>
>
> robert
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to