Allen Charlton wrote:
You can use a wildcard mapping for this

Okay, I'll try that out. Actually I just don't know where to set wildcard
mappings.

They get set in struts-config.xml.  It's just an action mapping.

Yes, here "???" is the query string, and the directory
"/search/???", obviously, does not exist at all.

Ok... you won't even need wildcards then. The path you request ends with the /search part then. The query string gets tacked on, if its a GET request, and doesn't factor in to the path you will request.

One thing that might make this all slightly easier to understand, if you have the choice, is to switch to extension mapping. I think it's fair to say that most people use extension mapping as opposed to path mapping. It tends to make things slightly more obvious and I think even a bit more flexible. Take a look here:

http://struts.apache.org/struts-doc-1.2.8/userGuide/configuration.html#dd_config_mapping

As an aside, I get the feeling you are new to Struts. If that is correct, that is of course OK (and actually a good thing in terms of Struts continuing to be relevant!)... there are plenty of people on this list who will be very willing to help you along, but I think you would do yourself a service by reading up a bit first. The things we're talking about here are pretty basic and are the kinds of things you could probably answer yourself if you spent a little time getting familiar with Struts. Just skimming through the user guide in 30 minutes would help a lot I think:

http://struts.apache.org/struts-doc-1.2.8/userGuide/index.html

And if my guess was wrong, ignore that entire previous paragraph :)

Frank

Regards.


On 12/7/05, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:

You can use a wildcard mapping for this:


http://struts.apache.org/struts-doc-1.2.8/userGuide/building_controller.html#action_mapping_wildcards

In your case, something like this should work:

<action path="/search/*" type="your.company.app.SearchAction" />

Note that the servlet mapping remains whatever it is now, I'm guessing
something like /* in your case.

Also, I'm not entirely sure what you mean when you say "where ??? is the
keywords for the search".  Do you mean they will be in the form of a
query string, or literally part of the URI path you request?  I believe
a wildcard mapping is the answer either way though, even if the above
configuration isn't precisely right for your particular use case.

Frank

Allen Charlton wrote:

Hi all! I wonder how to manage this.

Suppose a local site called testsystem, whose index page can be visited

as

http://localhost:8080/testsystem. Now I want an Action (named

SearchAction)

to process all search requests presented by this uri-pattern:
http://localhost:8080/testsystem/search/???, where ??? is the keywords

for

search. You know that if I write "<url-pattern>/search/*</url-pattern>"
properly in web.xml, such search requests will be served by

ActionServlet.

But it seems that I cannot specify a certain Action for a url-pattern.

The

names of the forwards defined in <global-forwards> is already constants,

not

variables. So how to do this?

Big thanks!

--
See? It is the Eclipse of the Sun!
-----------------------


--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: [EMAIL PROTECTED]

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





--
See? It is the Eclipse of the Sun!
-----------------------


--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: [EMAIL PROTECTED]

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

Reply via email to