• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need a Clear info

 
shashibabu kiran
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 425
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.
 
Ankit Garg
Sheriff
Posts: 9528
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Srikanth Nalam
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
shashibabu kiran
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic