完整的Web應用程序Tomcat JSF Primefaces JPA Hibernate –第2部分

托管豆

這篇文章是本教程第1部分的繼續。

在“ com.mb”包中,您將需要創建以下類:

package com.mb;import org.primefaces.context.RequestContext;import com.util.JSFMessageUtil;public class AbstractMB {private static final String KEEP_DIALOG_OPENED = 'KEEP_DIALOG_OPENED';public AbstractMB() {super();}protected void displayErrorMessageToUser(String message) {JSFMessageUtil messageUtil = new JSFMessageUtil();messageUtil.sendErrorMessageToUser(message);}protected void displayInfoMessageToUser(String message) {JSFMessageUtil messageUtil = new JSFMessageUtil();messageUtil.sendInfoMessageToUser(message);}protected void closeDialog(){getRequestContext().addCallbackParam(KEEP_DIALOG_OPENED, false);}protected void keepDialogOpen(){getRequestContext().addCallbackParam(KEEP_DIALOG_OPENED, true);}protected RequestContext getRequestContext(){return RequestContext.getCurrentInstance();}
}
package com.mb;import java.io.Serializable;
import java.util.List;import javax.faces.bean.*;import com.facade.DogFacade;
import com.model.Dog;@ViewScoped
@ManagedBean
public class DogMB extends AbstractMB implements Serializable {private static final long serialVersionUID = 1L;private Dog dog;private List<Dog> dogs;private DogFacade dogFacade;public DogFacade getDogFacade() {if (dogFacade == null) {dogFacade = new DogFacade();}return dogFacade;}public Dog getDog() {if (dog == null) {dog = new Dog();}return dog;}public void setDog(Dog dog) {this.dog = dog;}public void createDog() {try {getDogFacade().createDog(dog);closeDialog();displayInfoMessageToUser('Created With Sucess');loadDogs();resetDog();} catch (Exception e) {keepDialogOpen();displayErrorMessageToUser('Ops, we could not create. Try again later');e.printStackTrace();}}public void updateDog() {try {getDogFacade().updateDog(dog);closeDialog();displayInfoMessageToUser('Updated With Sucess');loadDogs();resetDog();} catch (Exception e) {keepDialogOpen();displayErrorMessageToUser('Ops, we could not create. Try again later');e.printStackTrace();}}public void deleteDog() {try {getDogFacade().deleteDog(dog);closeDialog();displayInfoMessageToUser('Deleted With Sucess');loadDogs();resetDog();} catch (Exception e) {keepDialogOpen();displayErrorMessageToUser('Ops, we could not create. Try again later');e.printStackTrace();}}public List<Dog> getAllDogs() {if (dogs == null) {loadDogs();}return dogs;}private void loadDogs() {dogs = getDogFacade().listAll();}public void resetDog() {dog = new Dog();}
}
package com.mb;import java.io.Serializable;import javax.faces.bean.*;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;import com.model.User;@SessionScoped
@ManagedBean(name='userMB')
public class UserMB implements Serializable {public static final String INJECTION_NAME = '#{userMB}';private static final long serialVersionUID = 1L;private User user;public boolean isAdmin() {return user.isAdmin();}public boolean isDefaultUser() {return user.isUser();}public String logOut() {getRequest().getSession().invalidate();return '/pages/public/login.xhtml';}private HttpServletRequest getRequest() {return (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();}public User getUser() {return user;}public void setUser(User user) {this.user = user;}
}
package com.mb;import java.io.Serializable;
import java.util.*;import javax.faces.bean.*;import com.facade.*;
import com.model.*;
import com.sun.faces.context.flash.ELFlash;@ViewScoped
@ManagedBean
public class PersonMB extends AbstractMB implements Serializable {private static final long serialVersionUID = 1L;private static final String SELECTED_PERSON = 'selectedPerson';private Dog dog;private Person person;private Person personWithDogs;private Person personWithDogsForDetail;private List<Dog> allDogs;private List<Person> persons;private DogFacade dogFacade;private PersonFacade personFacade;public void createPerson() {try {getPersonFacade().createPerson(person);closeDialog();displayInfoMessageToUser('Created With Sucess');loadPersons();resetPerson();} catch (Exception e) {keepDialogOpen();displayErrorMessageToUser('Ops, we could not create. Try again later');e.printStackTrace();}}public void updatePerson() {try {getPersonFacade().updatePerson(person);closeDialog();displayInfoMessageToUser('Updated With Sucess');loadPersons();resetPerson();} catch (Exception e) {keepDialogOpen();displayErrorMessageToUser('Ops, we could not create. Try again later');e.printStackTrace();}}public void deletePerson() {try {getPersonFacade().deletePerson(person);closeDialog();displayInfoMessageToUser('Deleted With Sucess');loadPersons();resetPerson();} catch (Exception e) {keepDialogOpen();displayErrorMessageToUser('Ops, we could not create. Try again later');e.printStackTrace();}}public void addDogToPerson() {try {getPersonFacade().addDogToPerson(dog.getId(), personWithDogs.getId());closeDialog();displayInfoMessageToUser('Added With Sucess');reloadPersonWithDogs();resetDog();} catch (Exception e) {keepDialogOpen();displayErrorMessageToUser('Ops, we could not create. Try again later');e.printStackTrace();}}public void removeDogFromPerson() {try {getPersonFacade().removeDogFromPerson(dog.getId(), personWithDogs.getId());closeDialog();displayInfoMessageToUser('Removed With Sucess');reloadPersonWithDogs();resetDog();} catch (Exception e) {keepDialogOpen();displayErrorMessageToUser('Ops, we could not create. Try again later');e.printStackTrace();}}public Person getPersonWithDogs() {if (personWithDogs == null) {if (person == null) {person = (Person) ELFlash.getFlash().get(SELECTED_PERSON);}personWithDogs = getPersonFacade().findPersonWithAllDogs(person.getId());}return personWithDogs;}public void setPersonWithDogsForDetail(Person person) {personWithDogsForDetail = getPersonFacade().findPersonWithAllDogs(person.getId());}public Person getPersonWithDogsForDetail() {if (personWithDogsForDetail == null) {personWithDogsForDetail = new Person();personWithDogsForDetail.setDogs(new ArrayList<Dog>());}return personWithDogsForDetail;}public void resetPersonWithDogsForDetail(){personWithDogsForDetail = new Person();}public String editPersonDogs() {ELFlash.getFlash().put(SELECTED_PERSON, person);return '/pages/protected/defaultUser/personDogs/personDogs.xhtml';}public List<Dog> complete(String name) {List<Dog> queryResult = new ArrayList<Dog>();if (allDogs == null) {dogFacade = new DogFacade();allDogs = dogFacade.listAll();}allDogs.removeAll(personWithDogs.getDogs());for (Dog dog : allDogs) {if (dog.getName().toLowerCase().contains(name.toLowerCase())) {queryResult.add(dog);}}return queryResult;}public PersonFacade getPersonFacade() {if (personFacade == null) {personFacade = new PersonFacade();}return personFacade;}public Person getPerson() {if (person == null) {person = new Person();}return person;}public void setPerson(Person person) {this.person = person;}public List<Person> getAllPersons() {if (persons == null) {loadPersons();}return persons;}private void loadPersons() {persons = getPersonFacade().listAll();}public void resetPerson() {person = new Person();}public Dog getDog() {if (dog == null) {dog = new Dog();}return dog;}public void setDog(Dog dog) {this.dog = dog;}public void resetDog() {dog = new Dog();}private void reloadPersonWithDogs() {personWithDogs = getPersonFacade().findPersonWithAllDogs(person.getId());}
}
package com.mb;import javax.faces.bean.*;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;import com.facade.UserFacade;
import com.model.User;@RequestScoped
@ManagedBean
public class LoginMB extends AbstractMB {@ManagedProperty(value = UserMB.INJECTION_NAME)private UserMB userMB;private String email;private String password;public String getEmail() {return email;}public void setEmail(String email) {this.email = email;}public String getPassword() {return password;}public void setPassword(String password) {this.password = password;}public String login() {UserFacade userFacade = new UserFacade();User user = userFacade.isValidLogin(email, password);if(user != null){userMB.setUser(user);FacesContext context = FacesContext.getCurrentInstance();HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();request.getSession().setAttribute('user', user);return '/pages/protected/index.xhtml';}displayErrorMessageToUser('Check your email/password');return null;}public void setUserMB(UserMB userMB) {this.userMB = userMB;} 
}

關于上面的代碼:

  • 所有ManagedBeans僅負責VIEW操作; ManagedBeans應該負責處理業務方法的唯一結果。 ManagedBeans中沒有業務規則。 在視圖層中執行一些業務操作非常容易,但這不是一個好習慣。
  • LoginMB類使用另一個ManagedBean(UserMB),并在其中注入了它。 要將一個ManagedBean注入另一個ManagedBean中,您必須執行以下操作:
    • 在注入的ManagedBean頂部使用@ManagedProperty
  • PersonMB類可能會因為其太大而接受重構操作。 這樣的PersonMB可以使新手開發人員更輕松地理解代碼。

關于@ViewScoped的觀察

您將在帶有@ViewScoped批注的托管bean中看到一些重新加載和重置方法。 這兩種方法都需要重置對象狀態。 例如,狗對象將在方法執行后保存視圖中的值(持久保存在數據庫中,在對話框中顯示值)。 如果用戶打開創建對話框并成功創建了一條狗,則該狗對象將在用戶停留在同一頁面時保留所有值。 如果用戶再次打開創建對話框,則將在此處顯示最后記錄的狗的所有數據。 這就是為什么我們有重置方法的原因。

如果更新數據庫中的對象,則用戶視圖中的對象也必須接收此更新,ManagedBean對象也必須接收此新數據。 如果您在數據庫中更新了狗名,則狗列表也應收到此更新的狗。 您可以在數據庫中查詢此新數據,也可以僅更新托管Bean值。

開發人員必須注意:

  • 重新加載查詢數據庫的托管Bean數據(重新加載方法) :如果重新加載ManagedBean對象的激發查詢附帶大量數據,則其查詢可能會影響應用程序性能。 開發人員可以使用具有延遲加載的數據表。 單擊此處查看有關Lazy Datatable的更多信息 。
  • 在不查詢數據庫的情況下,直接在托管Bean中重新加載更新的對象 :假設user1更新了數據庫中的dog1名稱,同時user2更新了dog2年齡。 如果user1更新dog2,則user1將看到有關dog2的舊數據,這可能會導致數據庫完整性問題。 該方法的解決方案可以是數據庫表中的版本字段。 在更新發生之前,將檢查此字段。 如果版本字段不具有數據庫中找到的相同值,則可能引發異常。 使用這種方法,如果user1更新dog2,則版本值將不同。

JSFMessageUtil

在“ com.util”包中,創建以下類:

package com.util;import javax.faces.application.FacesMessage;
import javax.faces.application.FacesMessage.Severity;
import javax.faces.context.FacesContext;public class JSFMessageUtil {public void sendInfoMessageToUser(String message) {FacesMessage facesMessage = createMessage(FacesMessage.SEVERITY_INFO, message);addMessageToJsfContext(facesMessage);}public void sendErrorMessageToUser(String message) {FacesMessage facesMessage = createMessage(FacesMessage.SEVERITY_WARN, message);addMessageToJsfContext(facesMessage);}private FacesMessage createMessage(Severity severity, String mensagemErro) {return new FacesMessage(severity, mensagemErro, mensagemErro);}private void addMessageToJsfContext(FacesMessage facesMessage) {FacesContext.getCurrentInstance().addMessage(null, facesMessage);}
}

此類將處理將顯示給用戶的所有JSF消息。 此類將幫助我們的ManagedBeans失去類之間的耦合。

創建一個類來處理對話框動作也是一個好主意。

配置文件

在源“ src”文件夾中,創建以下文件:

log4.properties

# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n# Root logger option
log4j.rootLogger=ERROR, stdout# Hibernate logging options (INFO only shows startup messages)
log4j.logger.org.hibernate=ERROR# Log JDBC bind parameter runtime arguments
#log4j.logger.org.hibernate.type=TRACE

messages.properties

#Actions
welcomeMessage=Hello! Show me the best soccer team logo ever
update=Update
create=Create
delete=Delete
cancel=Cancel
detail=Detail
logIn=Log In
add=Add
remove=Remove
ok=Ok
logOut= Log Out
javax.faces.component.UIInput.REQUIRED={0}: is empty. Please, provide some value
javax.faces.validator.LengthValidator.MINIMUM={1}: Length is less than allowable minimum of u2018u2019{0}u2019u2019
noRecords=No data to display
deleteRecord=Do you want do delete the record#Login / Roles Validations
loginHello=Login to access secure pages
loginUserName=Username
loginPassword=Password
logout=Log Out
loginWelcomeMessage=Welcome
accessDeniedHeader=Wow, our ninja cat found you!
accessDeniedText=Sorry but you can not access that page. If you try again, that ninja cat gonna kick you harder! >= )
accessDeniedButton=You got-me, take me out. =/#Person
person=Person
personPlural=Persons
personName=Name
personAge=Age
personDogs=These dogs belongs to
personAddDogTo=Add the selected Dog To
personRemoveDogFrom=Remove the selected Dog from
personEditDogs=Edit Dogs#Dog
dog=Dog
dogPlural=Dogs
dogName=Name
dogAge=Age

看一下“ lo4j.properties ”,注釋#log4j.logger.org.hibernate.type = TRACE行。 如果要查看由Hibernate創建的查詢,則需要將文件的其他配置從ERROR編輯為DEBUG,并從上面的行中刪除#。

您將能夠看到Hibernate執行的查詢及其參數。

xhtml頁面,面

在WebContent文件夾中,您將找到以下文件:

讓我們看看如何將Facelets應用于項目。 在“ / WebContent / pages / protected / templates /”文件夾下創建以下文件:

left.xhtml

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'xmlns:ui='http://java.sun.com/jsf/facelets'xmlns:h='http://java.sun.com/jsf/html'xmlns:p='http://primefaces.org/ui'><h:body><ui:composition><h:form><p:commandButton styleClass='menuButton' icon='ui-icon-arrowstop-1-e' rendered='#{userMB.admin or userMB.defaultUser}' action='/pages/protected/defaultUser/defaultUserIndex.xhtml' value='#{bundle.personPlural}' ajax='false' immediate='true' /><br /><p:commandButton styleClass='menuButton' icon='ui-icon-arrowstop-1-e' rendered='#{userMB.admin}' action='/pages/protected/admin/adminIndex.xhtml' value='#{bundle.dogPlural}' ajax='false' immediate='true' /><br /></h:form></ui:composition>
</h:body>
</html>

master.xhtml

<?xml version='1.0' encoding='UTF-8' ?>  
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'xmlns:ui='http://java.sun.com/jsf/facelets'xmlns:h='http://java.sun.com/jsf/html'xmlns:p='http://primefaces.org/ui'xmlns:f='http://java.sun.com/jsf/core'><h:head><title>CrudJSF</title><h:outputStylesheet library='css' name='main.css' /><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
</h:head><h:body><f:view contentType='text/html; charset=UTF-8' encoding='UTF-8' ><div id='divTop' style='vertical-align: middle;'><ui:insert name='divTop'><ui:include src='top.xhtml' /></ui:insert></div><div id='divLeft'><ui:insert name='divLeft'><ui:include src='left.xhtml' /></ui:insert></div><div id='divMain'><p:growl id='messageGrowl' /><ui:insert name='divMain' /></div><h:outputScript library='javascript' name='jscodes.js' /></f:view>
</h:body>
</html>

“ top.xhtml”

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'xmlns:ui='http://java.sun.com/jsf/facelets'xmlns:h='http://java.sun.com/jsf/html'xmlns:p='http://primefaces.org/ui'><h:body>   <ui:composition><div id='topMessage'><h1><h:form>#{bundle.loginWelcomeMessage}: #{userMB.user.name} | <p:commandButton value='#{bundle.logOut}' action='#{userMB.logOut()}' ajax='false' style='font-size: 20px;' /></h:form></h1></div></ui:composition>   </h:body>
</html>

上面的代碼將作為應用程序所有xhtml頁面的基礎。 應用Facelets模式重用xhtml代碼非常重要。 在下面,您可以在xhtml頁面中看到如何應用Facelets,請注意,開發人員只需要覆蓋所需的部分:

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' xmlns:ui='http://java.sun.com/jsf/facelets' xmlns:h='http://java.sun.com/jsf/html'xmlns:f='http://java.sun.com/jsf/core' xmlns:p='http://primefaces.org/ui' >
<h:body><ui:composition template='/pages/protected/templates/master.xhtml'><ui:define name='divMain'>#{bundle.welcomeMessage} :<br/><h:graphicImage library='images' name='logoReal.png' /></ui:define> </ui:composition>
</h:body>
</html>

注意,只有“ divMain ”被覆蓋,其他部分保持不變。 這是Facelets的最大優點,您無需在每個頁面中使用網站的所有區域。

繼續第三部分 。

參考:在uaiHebert博客上,我們的JCG合作伙伴 Hebert Coelho的Tomcat JSF Primefaces JPA Hibernate完整Web應用程序 。

翻譯自: https://www.javacodegeeks.com/2012/07/full-web-application-tomcat-jsf_04.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/371925.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/371925.shtml
英文地址,請注明出處:http://en.pswp.cn/news/371925.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

P1014 Cantor表

洛谷 p1014 題目描述 現代數學的著名證明之一是Georg Cantor證明了有理數是可枚舉的。他是用下面這一張表來證明這一命題的&#xff1a; 1/1 1/2 1/3 1/4 1/5 … 2/1 2/2 2/3 2/4 … 3/1 3/2 3/3 … 4/1 4/2 … 5/1 … … 我們以Z字形給上表的每一項編號。第一項是1/1&#xff…

dvd管理系統

>>>>>>>>>>>>>>>>>>>> 語言&#xff1a;java 工具&#xff1a;eclipse 時間&#xff1a;2016.12.1 >>>>>>>>>>>>>>>>>>>> 一代代碼&#xff1a; 1 …

佳能2900打印機與win10不兼容_佳能RF 1.4、RF 2增倍鏡與RF 100500mm L IS USM并不完全兼容...

據佳能官方透露&#xff0c;佳能RF 1.4、RF 2增倍鏡與RF 100-500mm F4.5-7.1 L IS USM鏡頭并不完全兼容。在安裝使用兩款增倍鏡時&#xff0c;用戶需將RF 100-500mm鏡頭變焦環的變焦位置移動到超過300mm的遠攝區域。而在搭配增倍鏡后&#xff0c;鏡頭變焦范圍將限定在300-500mm…

縣級的圖書館計算機管理員,圖書館管理員的崗位職責

圖書館管理員的崗位職責導語&#xff1a;在領導的命令下&#xff0c;緊緊圍繞學校總體工作要求&#xff0c;牢固樹立全心全意為教學及教科研第一線服務的思想&#xff0c;工作主動熱情&#xff0c;努力做好管理育人的工作。圖書館管理員崗位職責&#xff1a;1、每學期認真制訂切…

使用Java快速入門的Apache Thrift

Apache Thrift是由facebook創建的RPC框架&#xff0c;現在它是一個Apache項目。 Thrift可讓您在不依賴語言的定義文件中定義數據類型和服務接口。 該定義文件用作編譯器的輸入&#xff0c;以生成用于構建通過不同編程語言進行通信的RPC客戶端和服務器的代碼。 您也可以參考Thri…

Windows/Linux安裝python2.7,pycharm和pandas——《利用Python進行數據分析》

一、Windows下&#xff08;兩種方法&#xff09; 1. 安裝Python EDP_free并安裝pandas ① 如果你沒有安裝python2.7&#xff0c;可以直接選擇安裝Python EDP_free&#xff0c;然后再安裝pandas等包就行 &#xff1a; Python EDP_free 網址&#xff1a; http://epdfree-7-3-2.…

Python基礎類型

1. 列表、元組操作 列表是我們最以后最常用的數據類型之一&#xff0c;通過列表可以對數據實現最方便的存儲、修改等操作 定義列表 names [Alex,"Tenglan",Eric] 通過下標訪問列表中的元素&#xff0c;下標從0開始計數 >>> names[0] Alex >>> nam…

angular點擊按鈕彈出頁面_Win10提示“由于啟動計算機時出現了頁面文件配置問題”解決方法...

我們在使用Windows10系統的過程中&#xff0c;經常會遇到一些問題。近期有一個網友咨詢裝機之家小編&#xff0c;稱自己Windows10系統開機之后&#xff0c;彈出系統屬性對話框&#xff0c;提示“由于啟動計算機時出現了頁面文件配置問題”的問題&#xff0c;我們要如何解決呢&a…

計算機程序編程就業,計算機編程就業

為畢業生寫計算機編程就業提供計算機編程就業范文參考,涵蓋碩士、大學本科畢業論文范文和職稱論文范文&#xff0c;包括論文選題、開題報告、文獻綜述、任務書、參考文獻等&#xff0c;是優秀免費計算機編程就業網站。基于編程語言類課程教學方法的探討位把考查學生的編程能力也…

Spring集成–第1節– Hello World

Spring Integration的“ Hello World ” –考慮一個簡單的程序&#xff0c;以使用Spring Integration將“ Hello World”打印到控制臺&#xff0c;并在此過程中訪問一些企業集成模式概念 在進入程序本身之前&#xff0c;快速回顧一下消息傳遞概念將很有用–消息傳遞是一種集成樣…

正則表達式貪婪模式與懶惰模式

正則表達式貪婪匹配模式&#xff0c;對于初學者&#xff0c;往往也很容易出錯。有時候需要匹配一個段代碼內容&#xff0c;發現匹配與想要不一致。發現原來&#xff0c;跟貪婪模式有關系。如下&#xff0c;我們看下例子&#xff1a; 什么是貪婪模式 字符串有: “<h3>abd&…

stm32 薄膜鍵盤原理_市面上的筆記本鍵盤優缺點解析,看完秒懂

大家在選購電腦時&#xff0c;很多人的關注重點都是筆記本的配置好不好、外觀設計酷不酷和電池續航能力強不強&#xff0c;對電腦鍵盤往往不會太在意&#xff0c;其實一個好的電腦鍵盤也可以幫助你提高工作效率&#xff0c;特別對于小編這樣的文字工作者&#xff0c;如果鍵盤手…

計算機等級考試心得體會,計算機等級考試心得體會(2)

估計以后的考試也可能略有變化&#xff0c;即逐漸增加使用命令的條數。由于該內容變化小&#xff0c;考生應當練習到純熟的境地&#xff0c;在考試時用盡可能少的時間來做這部分內容&#xff0c;以使其他內容有更多的時間。六題能做出五題即可&#xff0c;有一題一時想不起&…

Web開發框架–第1部分:選項和標準

在我的公司&#xff0c;我們正在評估未來幾年將使用哪種Web開發框架。 自上次評估以來&#xff0c;我們一直在使用由Struts 2驅動的Java應用服務器作為MVC&#xff0c;將Tiles作為模板引擎&#xff0c;將jQuery用于Javascript awesomennes&#xff0c;將DWR用于AJAX調用&#x…

增加一個類的功能可以采用繼承或者代理模式或者裝飾者模式

增加一個類的功能有3種辦法&#xff1a; 1.繼承 2.代理模式 3.裝飾者模式轉載于:https://www.cnblogs.com/panxuejun/p/6127837.html

dell增強保護套裝還原失效_汕頭長安歐尚汽車音響改裝升級,還原真實音色

今天給大家分享的是汕頭車韻汽車音響改裝店開業以來&#xff0c;升級改裝的第113輛長安汽車。長安歐尚x7外觀設計十分出彩&#xff0c;整體造型動感十足&#xff0c;前臉采用六邊形大尺寸的前格柵&#xff0c;并加入了“云鷹之翼”的設計元素&#xff0c;造型十分具有攻擊性&am…

POJ 2386 Lake Counting

鏈接&#xff1a;http://poj.org/problem?id2386 Lake Counting Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 24263 Accepted: 12246Description Due to recent rains, water has pooled in various places in Farmer Johns field, which is represented by a…

計算機窗口顏色不能自定義,用RBG顏色設置自定義顏色

這個是Mac自帶的測色計快捷鍵shift command c即可復制RBG格式的顏色#DD0000 這個是csdn 的logo里的紅色我們得到的是十六位顏色代碼但是UIColor()只有這幾種初始化方式init(white: CGFloat, alpha: CGFloat)init(hue: CGFloat, saturation: CGFloat, brightness: CGFloat, al…

http協議和瀏覽器緩存問題

HTTP是超文本傳輸協議。 HTTP是一個應用層協議&#xff0c;由請求和響應構成&#xff0c;是一個標準的客戶端服務器模型。HTTP是一個無狀態的協議。 轉載于:https://www.cnblogs.com/hodgson/p/6128003.html

Spring3國際化和本地化

我最近想將Spring 3提供的國際化和本地化功能添加到我當前的項目之一中。 我瀏覽了Spring文檔&#xff0c;然后在Internet上搜索以找到一些資源。 但是我找不到能夠滿足客戶要求的資源。 大多數教程都像hello world應用程序&#xff0c;它提供了基本的理解。 即使是spring文檔&…