AppComposer and its included local web server provide several ways
to test the servlets and other kinds of capsules that you create. This lesson
takes you through some simple testing with the servlet hello.zac
.
Hello.zac
retrieves user input from a form and generates a custom
greeting in response to the input. If you do not have this capsule created and
saved from the previous lessons, you can use the capsule AppComposer/docs/tutorials/resources/helloUser.zac
to begin this lesson.
The goal for this section is to use the debug server's parameters testing function.
AppComposer/docs/manuals/tutorials/resources/helloUser.zac
in AppComposer.http://localhost/
, or wherever you defined
AppComposer's local server when you configured it.hello.zac
servlet.If you click on the link to the servlet, the browser shows you an empty page. This is because the servlet responds to input from a form. Since the form is not built yet, there is no input for the servlet to respond to. This is why the debug server page provides the button. You can use it to feed parameters into your servlet to test that it processes them correctly.
hello.zac
appears.If everything has gone as planned, you should see your customized Hello message. This is the simplest way in AppComposer to test that your servlets function correctly, without needing to complete the other parts of the web application to which they belong.
When servlets are more complex than this simple example, you need to test and debug your servlet capsules on a more detailed level than just passing parameters and looking at the result. AppComposer provides several tools to help you with line-by-line debugging.
In the next section you will learn how to manage multiple files in a project window and how to use a servlet capsule in conjunction with a JSP file.