chapter 8.
creating web clients 【程序编程相关:如何在weblogic 中对EJB 使用】
【推荐阅读:java.net.URLClassLoa】
【扩展信息:利用MS的CAPICOM控件与Java结】
this chapter describes how to create web clients in the client tier/presentation tier to access or otherwise communicate with the business tier. servlets and jsp pages are the two examples of web clients which will be created. in a typical model view controller pattern, the servlet acts as the controller whilst jsp pages act as the view (the model being the data, of course).
tasks :
create a servlet named accesscontroller under the package au.com.tusc.servlet.
add a business method to storeaccess bean named getallitems() with the following signature
public java.util.arraylist getallitems()
implement the init method.
implement doget and dopost methods.
add a method processrequest with the following signature
protected void processrequest (httpservletrequest request,httpservletresponseresponse)
throwsservletexception, ioexception
implement the processrequest method.
deploy the accesscontroller servlet.
test the accesscontoller servlet.
create a jsp page named showitems.
modify the method processrequest in servlet accesscontroller.
add html and jsp tags to display a list of all items in mystore.
deploy the module onlinestore.
test the showitems.jsp page.
create accesscontroller servlet :go to package explorer > expand mystore (project) node > select src, right click and a menu will pop up.
on the pop up menu > new > lomboz servlet wizard as shown below.
... 下一页