Hi, I just wanted to share with you a couple of considerations I made while
implementing the struts-search facility I mentioned in one of my previous
emails.

As you will probably recall, I had the idea to create files with the same
name as the struts-actions (i.e. [EMAIL PROTECTED]). Today I
discovered an inconvenient resulting from this approach: the struts-index
creation will be for most users an 'Administrator' tool, run on the local
server, and we know that a local server where a website is stored, has a
local name, rather than www.myserver.org, for instance myserver, or
prodserver, and so on.

With the above approach, I was creating files with the following name:

[EMAIL PROTECTED]

So far so good. The problem is that if than we want to show the file name as
a link where the user can click (wisely re-translated into
http://myserver/myapp.... reversing the initial pattern) users who will run
a search from the 'external' word, will be shown with links like:

http://myserver/myapp/Login.do

which obviously won't work. Here we could have many solutions: we could
translate myserver into the domain name, we could substring the URL
substituting the server name with the domain name, but at the end I realized
that the best solution is to use relative URLs. Therefore, at index
creation, when we must say to the application to create the files with the
content retrieved by an openStream() method, we could simply extract the
relative url by invoking the URL.getFile() method on the URL.

This way, we'll have file like: _myapp_Login.do, _myapp_Intro.do and so on.
Giving those names to the <html:link> element in Struts, will result in the
absolute URL being composed, therefore the link will work both from internal
and external users...

Regards,

Marco




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

Reply via email to