Getting request parameters

Getting request parameters is the most important part of any web application. ActiveWeb provides a few methods to achieve this goal:

Getting a single parameter

Getting all parameters

Getting all values for a single parameter

This is in cases for submit parameters with multiple values, such as selects:

Getting a first value from each submitted parameter

99% of the time, there is only one value for a single parameter. This makes the method params1st() very useful:

The return value is a map where keys are names of all parameters, while values are first value for each parameter, even if such parameter has more than one value submitted.

This method is used quite often whe a form is submitted. Using ActiveJDBC makes it trivial to accept a form as well as validate it:

The Post is an ActiveJDBC model. params1st() method returns a map of first values (the most typical case) of all submitted parameters, which are set in on call on a model instance. A this point, it is easy to use ActiveJDBC validation to display a page with error messages defined on the Post model. See PostController for more information.

In ActiveWeb:

Here is a link to controller: ActiveWeb BookController

Read next: processing web requests implicit conversion.

How to comment

The comment section below is to discuss documentation on this page.

If you have an issue, or discover bug, please follow instructions on the Support page