Hi friends, i m new to this forum. i have two doubts
1. <servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
this is a piece of code in web.xml
why to use only *.do in struts application can't we use something like *.com or *.it etc...
and w't is the actual use of it.
2. class formname implements serializable this is line in struts application, why serializable interface is implemented in multi-tier application
The *.do extension is mapped in the web.xml because Struts 1.x maps actions to *.do paths. So the ActionServlet needs to be able to handle all requests that have .do in the end so that it can send the request to that action...
1.It is not mandatory to use *.do. But it is most widely used. You can use any.
Coming to its use, here any request received by the web container which ends with .do is handled by the ActionServlet. If you would like to handle a request using Struts you should ensure that it is mapped to Struts ActionServlet. Rather than mapping each and every request in the configuration file, it is better to use a pattern. Here *.do is used. So all the requests which end with .do will be handled by Struts
2.Serialization is meaningfull in multi tier application only. Have a look at Serialization
Thanks & Regards,
Srikanth Nalam.
shashibabu kiran
Greenhorn
Joined: Mar 04, 2010
Posts: 6
posted
0
Hi Srikanth Nalam,
Thanks for the info, but i didn't get clearly about this line-Rather than mapping each and every request in the configuration file, what actually the configuaration file is, how to do request handling if *.do pattern is not used.
I know serializable interface it is used to convert object into byte stream, but what i am asking is. i have seen a code i.e it is a actionform class mapping to the jsp, implementing serializable interface since it contains objects of other class
example:
Class SurveyTO
{
String surveyName=null;
.....
.....
}
Class surveyForm implements Serializable
{
SurveyTO surveyTO=new SurveyTO();
.....
.....
}
in jsp
<html:text property="surveyTO.surveyName"/>
shashibabu kiran wrote:i didn't get clearly about this line-Rather than mapping each and every request in the configuration file, what actually the configuaration file is, how to do request handling if *.do pattern is not used.
As has been said, using "*.do" isn't mandatory. You could use "*.doohicky" if you want. All it means is that Struts will only process requests ending with that extension--nothing more. Don't over-complicate it.
I know serializable interface it is used to convert object into byte stream, but what i am asking is. i have seen a code i.e it is a actionform class mapping to the jsp, implementing serializable interface since it contains objects of other class
But what's the question?
Serializable has nothing to do with "multi-tier" applications; it has to do with whether or not forms are serializable, and even then, it only affects session-based form beans. If you're using a cluster with session replication, for example, forms would have to be serializable in order to allow all machines on the cluster to get access to the form bean.