![]() |
![]() |
![]() |
![]() |
Create the database query
Next, we will create the code that the servlet will run when it receives a new query.
- Select the doGet section of the Servlet methods by choosing 'doGet' from the choicebox to the left of the Code Sourcerer button.
- Type the following code:
Be sure to hit return after the last ;. Take a moment to double-check that you typed this in correctly; if it is incorrect the servlet will not work properly.
- Press the 'Code Sourcerer' button.
- Choose 'JDBC Operations...'. Press Next.
- Choose 'Perform a Search...'. Press Next.
- Choose the last option, 'the following variable expression'. Erase the initial value and type 'newQuery' in the field to the right. Press Next.
- The last page has other settings. Do not change any of the settings on the page. Press done.
The Code Sourcerer will generate several lines of code which will execute a search and store the result in a two-dimensional array of Strings named 'tableData'.
Data Representations, Inc. http://www.datarepresentations.com support@datarepresentations.com sales@datarepresentations.com |
![]() |
![]() |
![]() |
![]() |