SSH integrated learning knowledge points (1)

2010-04-21  来源:本站原创  分类:Java  人气:278 

1.struts of Internationalization:

Struts.properties:

struts.custom.i18n.resources = globalMessages

English configuration file: globalMessages_en.properties:

firstname = firstname

lastname = lastname

age = age

Chinese profile: globalMessages_zh.properties:

firstname = \ u59D3

lastname = \ u540D

age = \ u5E74 \ u9F84

And in the jsp in the control display by taking an international approach:

<s:form action="saveUser">

<s:textfield name="user.firstname" label="%{getText('firstname')}"> </ s: textfield>

<s:textfield name="user.lastname" label="%{getText('lastname')}"> </ s: textfield>

<s:textfield name="user.age" label="%{getText('age')}"> </ s: textfield>

<s:submit> </ s: submit>

<!--< s: textfield name = "user.firstname" label = "% (getText ( 'firstname')}"> as follows: take an international usage of -"

</ s: form>

2. General ssh class hierarchy should be as shown below, where dao layer objects on a certain javabean all data manipulation interface, dao.impl layer interface based on the hibernate specific operations to achieve, it is strongly recommended that action and dao layer sandwiched between the service layer to prevent the action directly access the database, so that service layer service can write to other logic.

<! - EndFragment ->

3. UserServiceImpl.java class service layer getter and setter methods in the main role is to parse spring in the server configuration document is used to service service layer into the dao object. The service layer code for the following main method is to use setter injection userDao this service layer.

private UserDAO userDao;

public UserDAO getUserDao ()

(

return userDao;

)

public void setUserDao (UserDAO userDao)

(

this.userDao = userDao;

)

And then directly in the service implementation class for database operations directly call the dao

public void delete (User user)

(

this.userDao.removeUser (user);

)

For example, in the following spring configuration documentation applicationContext.xml configuration: The second of bean in the name = "userDao" expressed in the above code in the service of the userDao object, ref = "userDao" said the first one beanid.

<bean scope="singleton">

<property name="sessionFactory">

<ref bean="sessionFactory"/>

</ property>

</ bean>

<bean>

<property name="userDao" ref="userDao"> </ property>

</ bean>

<! - EndFragment ->

相关文章
  • SSH integrated learning knowledge points (1) 2010-04-21

    1.struts of Internationalization: Struts.properties: struts.custom.i18n.resources = globalMessages English configuration file: globalMessages_en.properties: firstname = firstname lastname = lastname age = age Chinese profile: globalMessages_zh.proper

  • SSH integrated learning knowledge points (b) 2008-08-27

    1.Spring configuration file applicationContext.xml in the data source configuration code is as follows, in which the data source using apache's implementation class org.apache.commons.dbcp.BasicDataSource to inject into the class in commons-dbcp.jar

  • Learning knowledge points to be 2011-05-30

    1. Extremtable understanding of <Ec: table items = "fixedGoods" var = "fixedGood" styleClass = "clip" border = "1" cellpadding = "2" cellspacing = "0" action = "?" filterable = "

  • Oracle temporary table space of learning knowledge points 2011-08-17

    Temporary tablespace For the large number sorting create temporary tablespace tbstemp datafile '$ORACLE_HOME/oradata/tbstmp01.dbf' size 50M Size 5M extent management local uniform size 1m; View temporary table space select * from v$tempfile f,v$table

  • Java synchronization. Asynchronous knowledge points 2010-07-25

    1, Keyword: thread (thread), thread-safe (thread safety), intercurrent (concurrent) synchronized (synchronous), asynchronized (asynchronous) volatile (volatile), atomic (atomic), share (sharing) 2, Summary Background: A reading and writing shared doc

  • Javajava knowledge points summary (1) 2010-06-16

    ● Use with label (label) of the break and continue instead of goto, so break out of the loop directly to a location outside, continue the cycle jump outside the current cycle from a label named to the role of circulating, reference label in the progr

  • After the company's written a little sort of knowledge points 2010-09-26

    At noon yesterday, was a company first despised, then there are two companies at the time the written conflict, and finally think about the, or whatever the X company (who face contempt to be a big risk), the results also appeared in the middle point

  • Written after the company that sort of knowledge points 2010-09-26

    The first is at noon yesterday by a company despised, and then written at the time there is conflict in the two companies, and finally think about the, or go to the X Company (risk being despised to be a big risk), the results also appeared in the mi

  • oracle knowledge points 2011-01-06

    --oracle Basic knowledge points 1. oracle The physical database file types a. dbf (database file) Database data files b. log (logging file) Log File Log file records a certain period of time all the changes to the database operations ( Add, delete ,

  • HTTP protocol knowledge points (collection) 2011-01-12

    Quote HTTP protocol knowledge points (collection) (A) object update check by: HTTP authentication in two ways whether the updates if-non-match, or if-modified-since. By Request is included in the header to the server-initiated inquiry. When the respo

  • C language knowledge points Supplements 2011-05-25

    /** * C Supplements knowledge of the language points with each test function of knowledge points * 1.C Language is actually an array in assembly language directly addressing the table, there are two access methods * int iArray[10]; * iArray[0]=1;// T

  • Learning orientation and knowledge points (suspense) 2011-05-24

    1.ubuntu Learning 2.hadoop learning 3. Search knowledge of learning 4. head first java Introduction to Java Programming Art Advanced Java FAQ Senior Java Core Effective Java Advanced Thinking In Java Advanced The definitive guide to SWT and JFace Adv

  • Transfer java written knowledge points 2008-12-04

    Java written test of knowledge transfer point from http://www.blogjava.net/javawin/archive/2010/03/15/315448.html HashMap & Hashtable: Map interface implementation class will be the only key is mapped to a particular value on: <key,value>. HashM

  • ssh Integrated Introduction 2010-03-29

    ssh framework of ensemble learning is over, now summarized as follows: At first, when learning struts felt could not get. Because it has been into the brain one-third of the jsp + javabean or jsp + javabean + servert way of coding a little bit differ

  • Java will learn the knowledge points 2010-08-23

    java basics A common package, common classes, interfaces, packages: java.lang / java.awt / java.io / java.sql Category: BufferedReader / BufferedWriter / FileReader / FileWriter / String / Integer Interface: Remote List Map Document Node List Class:

  • Project Management Knowledge Points 2010-02-11

    1. Your team to use source code management tool Why? Should be used. VSS, CVS, PVCS, ClearCase, CCC / Harvest, FireFly can. My choice is VSS. 2. Your team using the defect management system put into effect? Should be used. ClearQuest is too complicat

  • Integrated Learning Struts 2010-07-17

    Strut the basic process in accordance with the struts-config.xml to be understood, first of all path attributes is the use of his client's request, specific to the Action which dealt with this process, first the client sends requests Road, server, se

  • JAVA knowledge points in the file upload and download order 2010-10-16

    Let's look at some of the file upload, first introduced to my first upload the file to be achieved, for the requirements pages, in fact it is a form to be adding some attributes. <h2> View file upload request body </h2> <form method="P

  • Spring Core Knowledge Points 2010-07-06

    Spring is a lightweight structural framework java application, where lightweight is not that kind of number, or the packet size distribution, but rather minimally invasive, meaning that at least you can just change the code to get it benefits, unlike

  • dwr knowledge points 2010-08-15

    GBP is the name of our framework, which is based on SSH, to provide code generation, basic components such as platform function calls. In our framework after the introduction of DWR, DWR replace the struts act as a control layer, for receiving user r