Java Full Stack Interview Questions
Java Full Stack Interview Questions
struts
1) What is Struts? Why you have used struts in your application
or project.
Ans:-
Struts are nothing but open source framework mostly used for
making web application whenever we use the term framework
means it comprises JSP, servlet, custom tags message resources
all in one bundle which makes developer task very easy. Its is
based on MVC pattern which is model view Controller pattern.
<exception
key="stockdataBase.error.invalidCurrencyType"
path="/AvailbleCurrency.jsp"
type="Stock.account.illegalCurrencyTypeException">
</exception>
4)
4: How validation is performed in struts application?
<form-validation>
<formset>
<form name=" CurrencyConverterForm ">
<field property=" fromCurrency " depends="required">
<arg key=" CurrencyConverterForm. fromCurrency "/>
</field>
<field property=" toCurrecny " depends="required ">
<arg key=" CurrencyConverterForm.toCurrency "/>
</field>
</form>
</formset>
</form-validation>
5)
What are the components of Struts Framework?
1. Java Servlets
2. JSP (Java Server Pages)
3. Custom Tags
4. Message Resources
6)
What’s the role of a handler in MVC based applications?
Ans:. It’s the job of handlers to transfer the requests to appropriate models as they are bound to the model layer of MVC architecture. Handlers use mapping information from configuration files for request
transfer.
Q3. What’s the flow of requests in Struts based applications?
Ans: Struts based applications use MVC design pattern. The flow of requests is as follows:
User interacts with View by clicking any link or by submitting any form.
Action is responsible for calling a function in Model which has all business logic implemented.
Response from the model layer is received back by the action which then passes it towards the view where user is able to see the response.
Q4. Which file is used by controller to get mapping information for request routing?
Ans: Controller uses a configuration file “struts-config.xml file to get all mapping information to decide which action to use for routing of user’s request.
Ans: In Struts, Action Class acts as a controller and performs following key tasks:
Uses appropriate model and pulls data from model (if required).
WebServices