Without Book Interview Questions and Answers | Online Test | Moct Test
Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Institute Training Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

Apache Tapestry Interview Questions and Answers

Ques 6. How to alter the URL to point to the correct page?

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

Is it helpful? Add Comment View Comments
Ques 7. How should do page navigation in apache tapestry?
Ans.
Usage page properties:

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

Page2.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 (success)
        cycle.activate(getSpecification().getProperty("success"));
    if (error)
        cycle.activate(getSpecification().getProperty("error"));
}

So on success, it will be redirected to Home2 and on error it will be redirected to Error2 page.
Is it helpful? Add Comment View Comments
Ques 8. How do I make a link popup a new window?
Ans. Use the contrib:PopupLink component.
Is it helpful? Add Comment View Comments
Ques 9. How to get a file from client input to server end in apache tapestry?
Ans.
Make a method like the following a a listener, such as from a DirectLink or whatever.
(The Document is just a class that holds the file information you want to send to the user.)

public void downloadAction(IRequestCycle cycle)
{
    try
    {
        HttpServletResponse response =
        cycle.getRequestContext().getResponse();

        byte[] data = new byte[1024];
        FileInputStream in = document.getFileInputstream();

        response.setHeader("Content-disposition",
          "inline; filename=" +
           document.getFileName());
        response.setContentType(document.getMimeType());
        response.setContentLength(new Long(document.getSize()).intValue());
        ServletOutputStream out = response.getOutputStream();

        while (in.read(data) > -1)
        {
            out.write(data);
        }
        in.close();
        response.flushBuffer();
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
}
Is it helpful? Add Comment View Comments

Most helpful rated by users:

©2017 WithoutBook