Two Laptop Bag
The moose likes Struts and the fly likes about servlet-mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "about servlet-mapping" Watch "about servlet-mapping" New topic

about servlet-mapping

venkataramana raju

Joined: Sep 11, 2005
Posts: 28
i am using struts-1.

1) if we use *.xyz instead of *.do in <servlet-mapping> of struts-config.xml
what is the effect.
in fact i tried this one but it is working properly(with *.xyz)

2) when ever we using DynaActionForm, how can we validate the inputs?

plz help me...
Scheepers de Bruin
Ranch Hand

Joined: Jul 19, 2005
Posts: 99
On the servlet mapping side I can be of some assistance.

What your servlet-mapping tag does, is identify exactly which URL patterns will cause the request to be handled by which servlet.


Any request received by the web server that is (a)in your application's context, and (b)conforms to the pattern '*.gif' (e.g. http://myserver/myappcontext/abc/123/cookie.gif, or http://myserver/myappcontext/cookie.image.gif) will be forwarded to the imageServlet servlet.

You can add multiple patterns as well:

We're doomed!!<br />Yay!!!<br />No that's bad Girr!!<br />Yay!!!
venkataramana raju

Joined: Sep 11, 2005
Posts: 28
Hi Scheepers, Thanks for ur Explanation
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by venkataramana raju:

2) when ever we using DynaActionForm, how can we validate the inputs?

If you're using DynaActionForm and you want to validate, one way to do it would be to change to DynaValidatorForm and use the Struts Validation Framework to validate. DynaValidatorForm has all the features of DynaActionForm, but adds validation through the framework (If you're unfamiliar with the validation framework, just Google "Struts Validation Framework")

Of course you also have the option of validating by subclassing DynaActionForm and including a validate() method in your subclass, but if you're going to write a new class anyway, you might as well subclass ActionForm and put your properties in as well.

Another option is simply to do the validation in the Action class by populating an ActionMessages object and calling the addErrors() method.

Consultant, Sima Solutions
I agree. Here's the link:
subject: about servlet-mapping
It's not a secret anymore!