aspose file tools*
The moose likes Struts and the fly likes Need a Clear info Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Need a Clear info" Watch "Need a Clear info" New topic
Author

Need a Clear info

shashibabu kiran
Greenhorn

Joined: Mar 04, 2010
Posts: 6
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


please reply ASAP

Regards,
shashikiran b.s
Pushkar Choudhary
Rancher

Joined: May 21, 2006
Posts: 425

Shashikiran,
Welcome to Javaranch!

Please use a meaningful subject line while asking questions here.

shashibabu kiran wrote:please reply ASAP

EaseUp.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Srikanth Nalam
Greenhorn

Joined: Feb 23, 2010
Posts: 20
Hi Shashibabu,

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
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"/>


Thanks in advance

Regards,
shashikiran b.s
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need a Clear info
 
Similar Threads
url-pattern tag of servlet-mapping
related to .do and .faces
How to get the url-pattern of a servlet ?
Problem with more than one url-mapping
after migrate from 4.0.1 to 4.2.0, cannot load web.xml in .war/WEB-INF