Interview Questions.

Top 100+ Apache Tapestry Interview Questions And Answers

fluid

Top 100+ Apache Tapestry Interview Questions And Answers

Question 1. I Have To Restart My Application To Pick Up Changes To Specifications And Templates, How Can I Avoid This?

Answer :

Start your servlet box with the JVM gadget parameter org.Apache.Tapestry.Disable-caching set to real, i.E., -Dorg.Apache.Tapestry.Disable-caching=actual. 

Tapestry will discard cached specifications and templates after every request. You utility will run a chunk slower, however changes to templates and specifications will display up right now. This additionally checks which you are persistent server-facet country efficaciously. 

Question 2. I Have A Form With A Submit Button. On The Form And The Submit Button Are Two Separate Listeners. Which Is Invoked First?

Answer :

The button’s listener need to get invoked while the shape encounters your button at some point of the rewind. The form’s submitListener must get invoked after the shape has completed its rewind, and therefore in any case different listeners had been invoked. Note - this can imply that the listener for a button can be invoked BEFORE the form has ’submitted’ all its values - it relies upon wherein your enter fields are relative to your button.

Apache Cassandra Interview Questions
Question three. Is Tapestry A Jsp Tag Library?

Answer :

Tapestry is not a JSP tag library; Tapestry builds at the servlet API, however doesn’t use JSPs in any manner. It uses it personal HTML template layout and its personal rendering engine. Starting with launch 3.0, Tapestry consists of a simple JSP tag library to allow JSP pages to create links to Tapestry pages.

Question four. What Does It Cost?

Answer :

Tapestry is open source and free. It is licensed below the Apache Software License, which allows it to be used even inner proprietary software program.

Apache Tapestry Tutorial
Question 5. Is There A Wysiwyg Editor For Tapestry, Or An Ide Plugin?

Answer :

Currently, no WYSIWYG editor is to be had for Tapestry; however, the layout of Tapestry lets in current editors to paintings moderately nicely (Tapestry additions to the HTML markup are without a doubt invisible to a WYSIWYG editor).Spindle is a Tapestry plugin for the extremely good open-source Eclipse IDE. It provides wizards and editors for developing Tapestry applications, pages and components.

Apache Spark Interview Questions
Question 6. How Is The Performance Of Tapestry?

Answer :

My personal testing, documented inside the Sept. 2001 trouble of the Java Report, concurs with other testing (documented in the Tapestry dialogue boards): Although directly JSPs have a mild aspect in demo programs, in actual packages with a database or software server backend, the overall performance curves for equal Tapestry and JSP programs are identical. Don’t consider the performance of Tapestry; think about the performance of your Java developers.

Question 7. Does Tapestry Work With Other Other Application Servers Besides Jboss?

Answer :

Of path! JBoss is free and convienient for the flip-key demonstrations. You can down load Tapestry and JBoss and have a actual J2EE utility jogging in approximately a minute! The scripts that configure JBoss are touchy to the precise release of JBoss, it need to be release 3.0.6. However, Tapestry programs are 100% field agnostic ... Tapestry doesn’t care what servlet box it's far used with and does now not even require an EJB container.

Apache Cassandra Tutorial Apache Solr Interview Questions
Question 8. How Does Tapestry Compare To Other Frameworks?

Answer :

Tapestry could be very an awful lot not like most other frameworks in that it doesn’t use code generation; as an alternative it uses a true factor object model based totally on JavaBeans homes and sturdy specs. This gives Tapestry a big quantity of flexibleness and permits dynamic runtime inspection of the software with the Tapestry Inspector (a mini-application that may be constructed into any Tapestry application).

Question nine. What Is Apache Tapestry?

Answer :

A element-based view framework.
Classes are written as POJOs and byte-code transformed at run time
Configured with annotations and naming conventions in preference to XML
Compared to JSPs, enforces a clear separation of HTML markup and Java code.
HTML templates are without delay previewable by using web designers
Changed factor classes are live-reloaded into walking utility for quicker improvement.
Uses the Post/Redirect/Get navigation pattern for form submission.
Apache Storm Interview Questions
Question 10. Does Tapestry Use Jsp Tag Libraries?

Answer :

No. Tapestry does no longer use JSP Tag library.
Tapestry builds at the Servlet API, but does no longer use JSP anyway.
It uses it own HTML template layout and its own rendering engine.
Apache Solr Tutorial
Question 11. Is Apache Tapestry Free/open Source?

Answer :

Yes. Tapestry is open source and unfastened. 

It is certified below the Apache Software License, which permits it for use even internal proprietary software.

Apache Hive Interview Questions
Question 12. How Do We Write Components In Apache Tapestry?

Answer :

Retrieving bound homes : When writting a factor, you regularly require numerous residences to be supplied via the component consumer. At a few factor for the duration of rendering, you may need to use the cost of this belongings.

You can try this through gaining access to the Binding. Assume we've a issue with one property referred to as ‘values’. Our issue will use this listing in its preRenderCommponent() technique to setup a few version, for use somewhere else.

.... If(getValues() == null) 
  IBinding binding = getBindings("values"); if(binding.GetObject() == null) 
      throw new RequestCycleException("The price for 'values' cannot be null", this);
   setValues((List)values.GetObject());


The binding itself will make certain that the object fee is the appropriate kind (assuming of direction, it’s been setup right).

Performing Lazy Instantiation of nation based totally upon element homes : In a few instances, the output of a issue can be based upon the kingdom of a few different property of the equal issue. For example, believe a shape in which the consumer can pick the sort of product to view. When they select a product, the form makes a question to the database for products matching this kind, and reshows the listing at the equal web page. (the list could be protected out of doors of the shape element itself).

Lets assume that the page item exposes it’s merchandise through a getProductModel() – that is an example of IPropertySelectionModel.

We can even expect that the remainder of the web page has the opposite components vital to render accurate HTML, the use of the price supplied by using the getProductModel() end result.

Here, it's far useful to recognise while inside the rendering method you can rely on the cost of selectedProduct to be set efficiently, so that you can instantiate a ProductModel primarily based on the provided cost, for use in the shape rendering. The fine area to setup country is inside the preRenderComponent() approach. This is known as by means of Tapestry simply earlier than it renders any issue, however AFTER it has set aspect properties. So, we'd write:

blanketed void preRenderComponent() 
  String decided on = getSelectedProduct();
  List products = getMatchingProducts(selectedProduct);
  productModel = new ProductModel(merchandise);
  .. Different initialization code ...


Apache Cassandra Interview Questions
Question thirteen. Why Do We Need @script In Apache Tapestry?

Answer :

The script framework is an effective manner to package scripts in components. It provides scripts with the benefits of additives. It can now be reused like a element and no longer have to worry approximately renaming subject names or the wiring among the fields and the scripts. You just declare the element and you're correct to go. It without a doubt is every other layer of abstraction that one will need to study but as soon as you've got found out it, it is very powerful. And truly there is not a lot to it.

The script framework is mandated with the aid of the truth that form detail/subject names are robotically generated by using the framework. And so you write your script in XML and use variables for those names and permit the framework offer the right names at some point of runtime. Going in addition, you can also ask the framework to provide other objects that could help in developing your script. For instance…

<input-symbol key="select"
    class="org.Apache.Tapestry.Form.PropertySelection"
    required="yes"/>

This defines an input variable “pick out” of type “org.Apache.Tapestry.Shape.PropertySelection”. All such variables/symbols handed in to the script is stored in a image map. And now you can use the shape choose list name by means of using an ant style syntax like $pick.Call. The expression inside “$” is an OGNL expression and is evaluated with respect to the image map. You may additionally outline your very own symbols/variables the use of <let…> like…

<let key="formObj">
    report.$pick out.Shape.Name
</let>
<let key="selectObj">
    $formObj.$pick out.Name
</let>

These variables/symbols are stored within the image map also. So now in case you need to set the price of the form select list all you do is say $formObj.$selectObj.Price = ‘whatever’; this would be equal to record.MyForm.MySelect.Fee = ‘something’; in which myForm is the shape call and mySelect is the choose list call.

<input-symbol...>s are like approach parameters and <let...>s are like example variables. Typically you would bypass values to the <input-symbol...>s through the Script component like...

<component id="myScript" type="Script">
    <static-binding name="script" value="ScriptSpecificationName.Script"/>
    <binding name="select" expression="components.SomePropertySelection"/>
</component>

The actual scripts are described in one of the two sections of the script specification, <body…> or <initialization…>, relying on while you need the script to execute. If you need the script to execute on load of the page, then you definately define it in the <initialization…>, in case you want it to execute on some other event, define it within the <body…> segment of the specification. For instance…

 

<body>
    function onChangeList(listObj)
    
        alert(listObj.Value);
    
</body>
<initialization>
    $selectObj.Onchange = feature(e)
    
        onChangeList($selectObj);
    
</initialization>
As you can see within the rendered web page all scripts are aggregated at the pinnacle of the page frame, there are not any extra scripts all over the page. Even occasion handlers are connected to form gadgets inside the initialization block.

One greater element to recollect, scripts being components, and additives by means of nature being unbiased of its environment, will render the script inside the page once for each ocurrance of the aspect. If you want the body of the script to be rendered best as soon as no matter how generally the thing is used, simply wrap the body in a <unique> tag like…

<body>
<unique>
    feature onChangeList(listObj)
    
        alert(listObj.Value);
    
</unique>
</body>

Apache Storm Tutorial
Question 14. How To Alter The Url To Point To The Correct Page?

Answer :

You would need to throw a RedirectException with the new URL; this sends an HTTP redirect to the consumer.

Question 15. How Should Do Page Navigation In Apache Tapestry?

Answer :

Usage page homes:

Page1.Web page
<page-specification class="Welcome.Action">
        <property name="success" value="Home" />
        <property name="error" value="Error" />
</page-specification>

Page2.Web page
<page-specification class="Welcome.Action">
        <property name="success" value="Home2" />
        <property name="error" value="Error2" />
</page-specification>

Welcome.Action.Java
public void submitListener(IRequestCycle cycle)

    if (fulfillment)
        cycle.Spark off(getSpecification().GetProperty("success"));
    if (mistakes)
        cycle.Prompt(getSpecification().GetProperty("blunders"));


So on fulfillment, it will likely be redirected to Home2 and on blunders it'll be redirected to Error2 page.

Apache Pig Interview Questions
Question 16. How Do I Make A Link Popup A New Window?

Answer :

Use the contrib:PopupLink factor.

Apache Hive Tutorial
Question 17. How To Get A File From Client Input To Server End In Apache Tapestry?

Answer :

Make a way just like the following a a listener, consisting of from a DirectLink or some thing.

(The Document is only a magnificence that holds the file data you need to ship to the person.)

public void downloadAction(IRequestCycle cycle)

    attempt
    
        HttpServletResponse response =
        cycle.GetRequestContext().GetResponse();
        byte[] statistics = new byte[1024];
        FileInputStream in = record.GetFileInputstream();
        response.SetHeader("Content-disposition",
          "inline; filename=" +
           report.GetFileName());
        response.SetContentType(record.GetMimeType());
        response.SetContentLength(new Long(document.GetSize()).IntValue());
        ServletOutputStream out = response.GetOutputStream();
        whilst (in.Study(facts) > -1)
        
            out.Write(statistics);
        
        in.Near();
        reaction.FlushBuffer();
    
    catch (IOException e)
    
        e.PrintStackTrace();
    

Apache Flume Interview Questions
Question 18. How Do I Integrate A Tapestry Application With J2ee Declarative Security/jaas?

Answer :

In net.Xml:

upload a further servlet mapping on your tapestry utility to /admin, and add the following:

<security-constraint>
 <web-resource-collection>
  <url-pattern>/admin/*</url-pattern>
 </web-resource-collection>
 <auth-constraint>
   <role-name>ADMIN</role-name>
 </auth-constraint>
</security-constraint>
In your base elegance for included pages:

public void validate(IRequestCycle cycle) throws RequestCycleException 
  boolean isAdmin = getRequestCycle().GetRequestContext().GetRequest().IsUserInRole("ADMIN");
  if (!IsAdmin) 
    // now not in proper function
    throw new PageRedirectException.......
  

You could have some of mappings for the same app-servlet to distinctive URIs, that manner you can depend a chunk greater at the declarative safety.

Apache Spark Interview Questions
Question 19. How Do I Stream A File To The User From Tapestry?

Answer :

Make a way like the following a a listener, including from a DirectLink or some thing.

(The Document is just a magnificence that holds the record information you need to send to the person.)

public void downloadAction(IRequestCycle cycle)

    attempt
    
        HttpServletResponse response =
        cycle.GetRequestContext().GetResponse();


        byte[] facts = new byte[1024];
        FileInputStream in = report.GetFileInputstream();


        response.SetHeader("Content-disposition",
          "inline; filename=" +
           record.GetFileName());
        reaction.SetContentType(report.GetMimeType());
        reaction.SetContentLength(new Long(file.GetSize()).IntValue());
        ServletOutputStream out = response.GetOutputStream();

        at the same time as (in.Examine(data) > -1)
        
            out.Write(information);
        
        in.Close();
        response.FlushBuffer();
    
    capture (IOException e)
    
        e.PrintStackTrace();
    


Apache Pig Tutorial
Question 20. Can I Use The Same Component Multiple Times In One Template?

Answer :

No – but you may reproduction the definition of a factor pretty without problems.

<component id="valueInsert" type="Insert" >
   <binding name="value" expression="getValueAt( rowIndex, columnIndex )" />
</component>

<component id="valueInsert1" copy-of="valueInsert"/>
<component id="valueInsert2" copy-of="valueInsert"/>
<component id="valueInsert3" copy-of="valueInsert"/>
<component id="valueInsert4" copy-of="valueInsert"/>

Apache Kafka Interview Questions
Question 21. What’s The Lifecycle Of A Form Submit?

Answer :

Events will trigger in the following order:

initialize()
pageBeginRender()
formListenerMethod()
pageBeginRender()

The form “rewind” cycle is nothing extra than a render cycle where the output is buffered and scrapped in preference to written to the servlet output movement. The 2d pageBeginRender() is brought about at some stage in the actual page rendering. You can use requestCycle.IsRewinding() to distinguish between these two render cycles.




CFG