Struts Interview Questions
1) Explain about Struts ?
Apache is used for developing Java web applications. It has garnished huge popularity because open source web framework. It encourages developers to implement MVC architecture. It became a top priority project within the Apache Foundation and it is now known as Jakarta Struts.
2) Explain the core end goal while using Java Struts?
Struts are used to separate the three core functions of a web program. It separate`s the client, user, and the data transfer pattern in between the whole processes. It gives much more flexibility to the developer as it increases the security and flexibility between applications.
3) Explain about the process of functioning of the struts program?
Struts separates three process they are separating the model from view that is it separates the application logic from the HTML page which is used to represent the logic. Secondly it separates the message routing function which transmits information between model and view.
4) Explain about how requests from the client are sent?
Requests from the client are always sent to the controller defined in a configuration file in the form of "actions". When the controller receives such a call from a specific file it calls for a corresponding "action" class. This action class in turn interacts with the application specific code for the necessary work to be done; this process is written in Java beans.
5) Explain about the library tag?
Library tag is a very powerful tag which is used to write code for Java beans programs. This tag gives a special permission to read and write the content of beans without any special form of embedded java code in the application.
6) Explain about Tiles?
Tiles allow template mechanism to be present in your components. You can compose a presentation layer from different components such as footer, header and content components. This form of composition helps in validating web forms much easier.
7) Explain about the future of Struts?
Struts is a very efficient language to build front end applications for Java. This language is facing tough competition from building Java components and web forms validation with much more easier and efficient form of frameworks such as Stripes, Spring MVC, Tapestry, etc.
Explain about the validation steps which have to be carried during validation of client side address?
These are the following steps which are to be carried for validating client side address they are: -
1) Validator plug in should be enabled to the system to start the process of validation.
2) A message resource should be created which can display error message to the client.
3) Validation rules should be defined by the developer for validation.
4) Relevant tags should be created to generate Java script code.
5) Last but not least the whole process of validation should be tested.
9) How do you create message resource?
Message resources are used to generate error messages they are primarily used by the validator framework. Lines of code or rules should be entered in the following lines which is Struts\strutsinfo\web\WEB-INF\ MessageResources.properties file.
10) Expain about Struts relation to HTML tags?
User interfaces are created with the help of struts HTML tag Library. If you wish to use a HTML tag to your code then it is imperative that you add this tag to your Java server pages. All tags present in the library are available for creating user interfaces.
11) Explain about the tag?
This tag is present in the HTML library provided by Struts. This tag informs the browser to pretend that the original tag is located at somewhere other than the current url. This tag is responsible in creating a base tag which gives a false impression to the user via browser about the exact location of the url.
12) Give an example where struts tiles may be used?
Tiles help the developer to create a template and a validator framework. If a developer is planning to develop a website where there would be almost 500 pages of static content and additional dynamic content then it is recommended for him to use template designed with the help of Tiles because it would help him in making necessary changes.
13) Describe the basic steps used to create a tiles application?
Tiles are useful in creating web applications. Some of the steps are
1) Adding the TLD to the web.xml file so that the application know about the librarys we are using.
2) A layout should be created with the help of JSP.
3) Designed and developed layouts should be used in creating pages.
4) Make the whole application adhere to the rules present and test it for any errors. Don't forget to repackage the application.
14) How to upload struts file?
Org.apache.struts.upload.Formfile is known to be foremost interface for the upload function. This represents the files which have been uploaded by the client. Struts application directly references this interface. This class helps you in uploading files to the database. Here we uploaded a Formfile.
15) Explain about struts dispatch action?
Org.apache.struts.actions.Dispatchaction interface gives the user to collect all the information and functions into a single action file. This interface is very useful because it helps you in developing a common action for all the functions.
16) Explain the necessity of empty tag?
When the requested variable does not contain any information, (null or empty) then this tag is used to know the contents present in the other body parts of the tag. If the tag is nested then it is advisable to use this tag as it may contain a bit of information.
17) Explain about logic match tag?
This tag is used whenever the requested variable has a value which is present in the sub string. To evaluate the contents present in the nested tag, logic match is used. This tag is used when the requested value is present in the tag of the variable in which this value is present.