首页 > > 详细

Lab 2 JSF作业代做、java编程语言作业调试、java实验作业代写、代做data留学生作业 代做留学生Processing|代写Python编程

Lab 2 JSF Managed Beans
Note you can find the Java EE 8 API at https://javaee.github.io/javaeespec/javadocs/?xd_co_f=a58163a1-d7c6-49cf-abf7-bc137d463336
1. For this lab start with last week’s example for a maven template. Download the
version from https://gitlab.infoteach.ca/bdlink/ch2-numberquiz. Unzip it and create a
template for yourself. Delete the example specific files and keep the rest (I do not
give you a template so you will have to do it yourself (learning).
2. Edit the pom.xml file and change the artifact-id to your first initial + last name +
“lab02”. Make the same change to finalName. The artifact-id seems to be what
Eclipse uses for the project name.
3. After you have put the correct name in the pom.xml, you can import the project into
eclipse for the other changes.
4. Create a project in your gitlab.infoteach.ca account that tracks your code. For this
week, this can be a public project to avoid some issues we will deal with later. A help
page gives you the steps to make your code into a git project and upload it. I usually
create the project in the command window with git init, but you can do it several
ways.
5. As you work the following steps, debug on your local Wildfly server, commit your
code and push updates to your gitlab repository. At the point that everything works
locally, your code should be in your repository. Get used to using git to manage your
code (if you are not already) and you will be more comfortable working in teams.
6. Define a welcome page enterProblem.xhtml (define this in the web.xml). Use a
messages file for all text (as in the example of chapter 2). Define the enterProblem
page to display a problem report entry form similar to figure 1 below (don’t worry
about the layout too much; we will get more tags in chapter 4).
7. Define a JavaBean Project with properties name and title (both Strings). This
class does not need any annotations (this means it will have dependent scope) if you
are using an empty beans.xml file. If you do not have a beans.xml file (as in the
ch2 example), annotate the class with
javax.enterprise.context.Dependent (this is good style in any case).
8. Define a JavaBean ProblemReport with properties corresponding to each field
(except name and title, which are in Project). Inject the project object for
the project name and title. For the moment, all nonnumeric properties can be
Strings (we will learn how to convert dates later). For numeric properties, use
Integer [what is the difference if you use int?]. Make the JavaBean a CDI named
bean with the name problemReport. [what scope should you use to get the
information from page to page? What scopes would work here? Look ahead and see
where the information needs to go]
9. Use the problemReport bean properties in the input fields in the
enterProblem page (via expression language).
10. Write a display page to display the entered problem report. You can use a large
portion of the enterProblem page if you add the readonly=”true” attribute
to the tags (this will not look very good, but will save time). The
results should look somewhat like figure 2. Use an HTML link to go from the display
page back to the entry page, which should have blank fields (no code is required if
you store problemReport in the correct scope).
11. We will see a lot more of tags and their attributes in chapter 4. For now you may
want to use the size attribute in tags to specify the approximate
number of characters of the input box. You may also investigate
as well as and . This is optional, as the main focus
this week is getting the functionality going, not the look and feel.
12. After things work and your code is in the repository, log into OKD via a browser (this
needs a VPN connected to the BCIT network)
13. In the Developer view make sure your project is showing (named username-labs.
You should have created this in lab 1)
14. Click the +Add to see your choices for creating applications and select “From Git”
(you can get there “From Catalog” selecting the Wildfly Build for a longer path).
15. Fill in your Git Repo URL (we are using GitLab, GitHub also works). You can get
the URL from GitLab, copying the “Clone with HTTPS” text under the Clone button.
16. Select Git Type GitLab
17. Builder should be Wildfly 20
18. For Application, select create application and enter “lab02” under Application Name
19. For name, enter “lab02” (an application can have several parts, here there is only one
so there seems to be duplicate information)
20. Make sure deployment is checked.
21. Make sure the “Create a route to the application” is checked.
22. Click the Create button.
23. A pod icon with a light blue circle should appear in the Topology screen. After a fre
minutes it should turn dark blue. Clicking on the handle on the top right will open a
web page with your application. Clicking on the handle on the lower right will take
you to your Git repository.
24. When all this works, dance a quick jig and feel good about yourself.
25. As we do not have a trigger set up to automatically deploy to OKD when the Git
repository changes, you will have to manually redeploy to push a new version to the
cluster. Just click on the pod to bring up the details and under Builds, click on “Start
Build”. You can click on view logs to see the build process. Note the lower left
handle changes to indicate the build is running. (Note as we have not set readiness
tests, the graphics can show your application as ready a bit before Wildfly finishes
deploying it).
26. (extra credit) Modify the above example to use a language in addition to English.
Your application should respond automatically to the user's browser's preferred
language.
27. (extra credit) The numberquiz example in the text has a problem if it is run from
two different tabs in a browser. The entries made in one tab affect the other tab.
Modify it to use conversation scope so it works properly (each tab should have its
own copy which functions independently of other tabs).
Figure 1 input screen.
Figure 2: display screen

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp
热点文章
程序代写更多图片

联系我们 - QQ: 99515681 微信:codinghelp
© 2014 www.7daixie.com
程序代写网!