This sample demonstrates a basic application
that shows how a custom Java control and a database control are
used to model a simplified sign on procedure. Instead of running this finished
sample,
you
can create this application by running the tutorial Getting
Started: Java Controls.
The sample application allows a user to enter his/her name, and returns
a greeting based on the number of times the user has entered this name
before.
The application contains the following components:
-
Start WebLogic Server in the workshop domain.
- Open MyControlTestProject_Sample\hello\HelloTest.jws and
click the Start button.
- If this is the first time you have ever run this application, click the createTable button
to make the table the database control is going to interact with.
- Scroll down to the Service Response section, and notice
that no exceptions are thrown.
- Click the Test Operations link.
- Enter your name in the String field and click the hello button.
-
Scroll down to the Service Response section, and notice
that the response is Hello, <your name>!
In the preceding two steps the web service invoked the hello method
on the custom control. The control called the getVisits method
of the VisitDB database control to find out the number of previous visits.
Because you were running this test for the first time, this method returned
0, your name was added to the database using the database contro'ls insertVisitor method,
and the Hello control sent the appropriate response.
-
Enter your name again, click the hello button,
and notice that the response is Hello again, <your
name>!
In this step the Hello control again invoked the getVisits method
of the VisitDB database control to find out the number of previous visits.
This method returned 1, the database record was updated to reflect that this
was your second visit, and the Hello control sent the appropriate response.
-
Click the Test Operations link, enter
your name again, click the hello button,
and notice that the response is Hello <your
name>! This is visit number 3.
- Repeat the test with a different name and observe the outcome.
- Return to WebLogic Workshop and press the Stop button
to close the Test Browser.