Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Articles
Articles_ko
CreateActions_ko




JSPWiki v2.2.33

[RSS]


Hide Menu

ValidationAndList_ko


Difference between version 6 and version 2:

At line 75 changed 3 lines.
personForm.jsp 에 client-side validation(자바스크립트를 이용한 폼 유효성 체크) 를 사용하려면 javascript JSP tag(html:javascript) 와 script 태그를 personForm.jsp 의 하단에 작성 해야 합니다.\\
이것은 이미 작성되어 있고(viewgen에 의해서) 단지 여러분은 코멘트 처리를 없애기만 하면 됩니다. \\
이것이 코멘트 처리되어 있는 이유는 formName 은 정의되었으나 거기에 아무런 validation 규칙이 없다면 Validator 가 예외를 던지기 때문입니다.
personForm.jsp 에 client-side validation(자바스크립트를 이용한 폼 유효성 체크) 를 사용하려면 javascript JSP tag(html:javascript) 와 script 태그를 personForm.jsp 의 하단에 작성 해야 합니다. 이것은 이미 작성되어 있고(AppGen에게 감사) 단지 여러분은 코멘트 처리를 없애기만 하면 됩니다.
At line 79 removed 2 lines.
;: ''개인적으로 저는 이게 [버그|http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27316]라고 생각하나 Struts Committer 들은 아니라고 하네요..''
At line 201 changed 1 line.
;:<div class="note">보다시피 여기서는 person 파라미터 가지고 하는 일이 아무것도 없습니다. 현재 위 예의 person 파라미터는 단지 placeholder 의 역할을 하고 있는겁니다. 차후에 위 파라미터(person)의 속성값들을 통해 필터 기능을 원할 수도 있습니다(Hibernate's Query Language (HQL) 나 Criteria Query를 이용해서). \\ Criteria Query 를 사용한 예입니다: \\ \\ [{Java2HtmlPlugin
;:<div class="note">보다시피 여기서는 person 파라미터 가지고 하는 일이 아무것도 없습니다. 현재 위 예의 person 파라미터는 단지 placeholder 의 역할을 하고 있는겁니다. 차후에 위 파라미터(person)의 속성값들을 통해 필터 기능을 원할 수도 있습니다(Hibernate's Query Language (HQL) 나 Criteria Query를 이용해서).
At line 199 added 1 line.
Criteria Query 를 사용한 예입니다:
At line 204 changed 11 lines.
Example example = Example.create(person)
.excludeZeroes() // exclude zero valued properties
.ignoreCase(); // perform case insensitive string comparisons
try {
return getSession().createCriteria(Person.class)
.add(example)
.list();
} catch (Exception e) {
throw new DataAccessException(e.getMessage());
}
return new ArrayList();
[{Java2HtmlPlugin
At line 203 added 9 lines.
// filter on properties set in the person object
HibernateCallback callback = new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException {
Example ex = Example.create(person).ignoreCase().enableLike(MatchMode.ANYWHERE);
return session.createCriteria(Person.class).add(ex).list();
}
};
return (List) getHibernateTemplate().execute(callback);
At line 328 changed 1 line.
The template you used to create this JSP has the column for the id property hard-coded, so XDoclet adds it twice. To remove this from personList.jsp, delete the following from this file:
아마도 당신이 변경하길 원하는 다른 것은 당신이 목록화한 항목의 복수형태일것이다. 이 예제에서 생성된 이름은 "person"이고 이것은 아마도 people가 될것이다. 31번 라인이나 그 근처에서, 당신은 다음의 라인을 볼수 있을것이다.
At line 330 changed 1 line.
[{Java2HtmlPlugin
{{{<display:setProperty name="paging.banner.items_name" value="persons"/>}}}
At line 332 changed 3 lines.
<display:column property="id" sort="true" headerClass="sortable"
titleKey="personForm.id"/>
}]
이것을 다음과 같이 변경한다.
At line 336 changed 1 line.
;:''If anyone knows of a way to modify the extras/viewgen/src/List_jsp.xdt to not include this column tag, please let me know.''
{{{<display:setProperty name="paging.banner.items_name" value="people"/>}}}
At line 338 changed 1 line.
Another thing you'll probably want to change is the plural form of the items you're listing. The generated name in this example is "persons" and it should probably be people. At or near line 31, you should have the following line:
마지막으로, 타이틀과 해더키(personList.title and personList.heading)를 web/WEB-INF/classes/ApplicationResources.properties에 추가한다. 이 파일을 열고 다음을 추가한다.
At line 341 removed 12 lines.
<display:setProperty name="paging.banner.items_name" value="persons"/>
}}}
Change it to:
{{{
<display:setProperty name="paging.banner.items_name" value="people"/>
}}}
Finally, add the title and heading keys (personList.title and personList.heading) to web/WEB-INF/classes/ApplicationResources_en.properties. Open this file and add the following:
{{{
At line 358 changed 1 line.
As a reminder, the personList.title is what ends up in the brower's title bar (the &lt;title> tag) and personList.heading will be put into an &lt;h1> tag before any page content.
{{personList.title}}은 브라우저의 타이틀(&lt;title&gt; 태그)바에서 보여지는 것이고 {{personList.heading}}는 페이지 내용 이전에 &lth1&gt;태그에 넣어질것이다.
At line 360 changed 1 line.
At this point, you should be able to run ant clean deploy, start Tomcat and view this page in your browser at http://localhost:8080/appfuse/editPerson.html?method=Search.
이 시점에서, 당신은 __ant clean deploy__를 실행할수 있을것이다. Tomcat을 실행하고 당신의 브라우저에서 [http://localhost:8080/appfuse/editPerson.html?method=Search] 페이지를 보라.
At line 362 changed 1 line.
Now that we have a List Screen, let's change the pages that are displayed after adding and deleting a new Person. In src/web/**/action/PersonAction.java, change the mapping.findForward("mainMenu") in the save, delete and cancel methods to be:
지금 우리는 목록 화면을 보고있다. 새로운 Person을 추가하거나 삭제한후에 페이지가 변경되는 것을 보자. src/web/**/action/PersonAction.java에서, ''save'', ''delete'' 그리고 ''cancel'' 메소드내 ''mapping.findForward("mainMenu")''를 변경하자.
At line 366 changed 1 line.
return mapping.findForward("viewPeople");
return mapping.findForward("viewPeople");
At line 369 changed 1 line.
You will also need to change verifyForward("mainMenu") to be verifyForward("viewPeople") in the testRemove method of test/web/**/action/PersonActionTest.java. Lastly, the Canoo tests "AddPerson" and "DeletePerson" need to be updated. Open test/web/web-tests.xml and change the following line in the "AddPerson" target:
당신은 test/web/**/action/PersonActionTest.java의 testRemove메소드내 ''verifyForward("mainMenu")''를 ''verifyForward("viewPeople")''로 변경할 필요가 있을것이다. 마지막으로, 수정될 필요가 있는 "AddPerson" 과 "DeletePerson"를 테스트하자. test/web/web-tests.xml를 열고 "AddPerson" target내 다음 라인을 변경하자.
At line 371 changed 4 lines.
{{{
<verifytitle description="Main Menu appears if save successful"
text=".*${mainMenu.title}.*" regex="true"/>
}}}
{{{<verifytitle description="Main Menu appears if save successful"
text=".*${mainMenu.title}.*" regex="true"/>}}}
At line 376 changed 1 line.
to:
위 라인을 아래와 같이 변경한다.
At line 378 changed 4 lines.
{{{
<verifytitle description="Person List appears if save successful"
text=".*${personList.title}.*" regex="true"/>
}}}
{{{<verifytitle description="Person List appears if save successful"
text=".*${personList.title}.*" regex="true"/>}}}
At line 383 changed 1 line.
Then in the "DeletePerson" target, change the following line:
그 다음 "DeletePerson" target에서, 다음 라인을 변경하자.
At line 385 changed 2 lines.
{{{
<verifytitle description="display Main Menu"
{{{<verifytitle description="display Main Menu"
At line 390 changed 1 line.
to:
위 라인을 아래와 같이 변경한다.
At line 392 changed 3 lines.
{{{
<verifytitle description="display Person List" text=".*${personList.title}.*" regex="true"/>
}}}
{{{<verifytitle description="display Person List" text=".*${personList.title}.*" regex="true"/>}}}
At line 396 changed 1 line.
We use "viewPeople" instead of "list" so that the search method will be executed, rather than simply forwarding to the personForm.jsp (which the "list" forward points to).
우리는 "list"대신에 "viewPeople"를 사용한다. 그래서 personForm.jsp로 간단하게 포워딩하는 것보다 search메소드가 수행될것이다.
At line 398 changed 1 line.
To test that displaying this page works, create a new JSP test in test/web/web-tests.xml:
이 페이지가 작동하는것을 보기 위해, test/web/web-tests.xml내 새로운 JSP테스트를 생성하자.
At line 400 removed 1 line.
At line 391 added 1 line.
At line 419 changed 1 line.
You'll also want to add the "SearchPeople" target to the "PersonTests" target so it will be executed along with all the other person-related tests.
당신은 "PersonTests" target에 "SearchPeople" target를 추가하길 원할것이다. 그래서 이것은 다른 person관련 테스트와 함께 수행될것이다.
At line 431 changed 1 line.
Now you can run ant test-canoo -Dtestcase=SearchPeople (or ant test-jsp if Tomcat isn't running) and hopefully it will result in "BUILD SUCCESSFUL". If so - nice work!
지금 당신은 __ant test-canoo -Dtestcase=SearchPeople__ (Tomcat이 구동중이지 않다면 ''ant test-jsp'')를 실행할수 있고 "BUILD SUCCESSFUL"이라는 결과가 나오길 바랄것이다. 만약 그렇다면, 제대로 작업이 수행된것이다.
At line 433 changed 2 lines.
!!Add link to menu [#8]
The last step is to make the list, add, edit and delete functions visible to the user. The simplest way is to add a new link to the list of links in web/pages/mainMenu.jsp:
!!메뉴에 링크추가하기 [#8]
At line 436 changed 3 lines.
<div class="note">
<b>NOTE:</b> The other links in mainMenu.jsp don't use so this JSP can be shared among the various web framework implementations in AppFuse (i.e. Spring MVC and WebWork).
</div>
가장 마지막 단계는 사용자가 볼수 잇는 list, add, edit, delete함수를 만드는 것이다. 가장 간단한 방법은 web/pages/mainMenu.jsp에 새로운 링크를 추가하는 것이다.
At line 412 added 2 lines.
%%note __NOTE:__ mainMenu.jsp내 다른 링크는 <html:link>를 사용하지 않는다. 그래서 이 JSP는 AppFuse내 다른 다양한 웹 프레임워크(이를테면, Spring MVC와 WebWork) 구현물간에 공유될수 있다. %%
At line 446 changed 1 line.
</li>
</li>
At line 449 changed 2 lines.
Where menu.viewPeople is an entry in web/WEB-INF/classes/ApplicationResources_en.properties.
''menu.viewPeople''는 web/WEB-INF/classes/ApplicationResources.properties파일내 항목이고 값은 아래와 같다..
At line 455 changed 1 line.
The other (more likely) alternative is that you'll want to add it to the menu. To do this, add the following to web/WEB-INF/menu-config.xml:
다른 대안은 메뉴에 이것을 추가하는 것이다. 이것을 하기 위해, web/WEB-INF/menu-config.xml에 다음을 추가한다.
At line 462 changed 1 line.
Make sure the above XML is inside the <Menus> tag, but not within another [<Menu>. Then add this new menu to web/common/menu.jsp - which should now look as follows:
위 XML이 &lt;Menu&gt;가 아닌 &lt;Menus&gt; 태그내 위치하는지 확인하라. 그리고 나서 다음과 같은 web/common/menu.jsp에 새로운 메뉴를 추가한다.
At line 480 changed 1 line.
Now if you run ant clean deploy start Tomcat and go to http://localhost:8080/appfuse/mainMenu.html, you should see something like the screenshot below.
지금 당신이 __ant clean deploy__를 실행한다면, Tomcat을 실행하고 [http://localhost:8080/appfuse/mainMenu.html]를 보라. 당신은 아래와 같은 화면을 보게 될것이다.
At line 482 changed 1 line.
<div style="border: 1px solid black; margin: 0px auto; width: 551px; height: 184px">
%%(border: 1px solid black; margin: 0px auto; width: 551px; height: 184px)
At line 484 changed 1 line.
</div>
%%
At line 486 changed 1 line.
Notice that there is a new link on the left side (from mainMenu.jsp) and on the right in our menu (from menu.jsp).
왼쪽(mainMenu.jsp에서)에 새로운 링크가 있고 우리의 메뉴는 오른쪽(menu.jsp에서)에 있다.
At line 488 changed 2 lines.
!!That's it!
You've completed the full lifecycle of developing a set of master-detail pages with AppFuse and Struts - Congratulations! Now the real test is if you can run all the tests in your app without failure. To test, stop tomcat and run ant clean test-all. This will run all the unit tests within your project. As a reminder, it should be easy to setup and test AppFuse from scratch using ant setup-db setup-tomcat test-all. Also, if you're looking for more robust examples - checkout Struts Resume.
!!다 되었다.!
당신은 AppFuse와 Struts를 가지고 독립적인 상세한 페이지들을 개발하는 완전한 생명주기를 완성했다. __축하한다__! 지금 당신은 실패없이 당신의 애플리케이션내 모든 테스트를 수행할수 있을것이다. 테스트하기 위해, tomcat를 중지하고 __ant clean test-all__를 실행한다. 이것은 당신의 프로젝트내 모든 단위테스트를 수행할것이다. 이것은 __ant setup-db setup-tomcat test-all__을 사용하여 AppFuse를 쉽게 셋업하고 테스트할수 있다. 또한 당신은 좀더 견고한 예제를 찾는다면, [Struts Resume|StrutsResume]를 보라.
At line 491 changed 2 lines.
''__Happy Day!__''
<span style="color: green">
''__즐거운 시간이 되길.!__''
%%(color: green)
At line 494 changed 3 lines.
Total time: 2 minutes 31 seconds
</span>
If you'd like, you can download the files created in this tutorial.
Total time: 2 minutes 31 seconds
%%

Back to ValidationAndList_ko, or to the Page History.