27. Lấy danh sách Job
List<String> listRegistrant = new ArrayList<String>();
for(Map<String, Object> obj : t_ConferenceDao.getRegistrant("")){
listRegistrant.add(String.valueOf(obj.get("input_user_name")));
}
mainForm.setlistRegistrant(listRegistrant);
List<String> listRegistrant = new ArrayList<String>();
for(Map<String, Object> obj : t_ConferenceDao.getRegistrant("")){
listRegistrant.add(String.valueOf(obj.get("input_user_name")));
}
mainForm.setlistRegistrant(listRegistrant);
26. Xuất ra Output display system.out.println("asf");
25. Form - Controller - EditService - Dao - Hit - SQL
NutritionCareControll
EditService
DAO
24. = = =
=== vua kiem tra value vua kiem tra type object
[8:26:05 AM] Ta Thai Binh: == chi kiem tra value[8:26:13 AM] Ta Thai Binh: equal: kiem tra object
[8:26:33 AM] Vinh mùa xuân (spring, not autumn): hơ hơ... độc quá.. cám ơn a
[8:26:39 AM] Ta Thai Binh: no tuong dung equal trong java
23. on change
$('.formEnabled').on('change', function(event) {
// 編集したアイテムのname属性の値を取得
var editItemName = event.target.name;
// 編集したレコード内、name属性editedの値を更新する
var editItemFlag = editItemName.replace(/\..*/g, '.edited');
if (editItemFlag === editItemName) {
editItemFlag = editItemFlag + '.edited';
}
22. <!-- 機能固有ボタン -->
<table class="table_layout w140 hx250"><tr id="funcBtnIndividualRow">
<td class="t-top">
<!-- ボタン種別が"2":機能固有 の場合表示 -->
<c:forEach items="${mainForm.funcBtnList}" var="list" varStatus="status">
<c:if test="${list.btn_type == '2'}">
<input type="submit" id="${list.btn_cd}" name="${list.btn_cd}" class="btnFunc btnFuncIndividual ${list.css_class}" value="${list.btn_name}"/>
</c:if>
</c:forEach>
</td>
</tr>
</table>
21.
for (var i = 0; i < $orgBtns.length; i++) {
var $orgBtn = $orgBtns.eq(i);var btnId = $($orgBtn).val();
var customCss = $($orgBtn).data('css-class');
20. Tùy hứng argment
// 対象のボタンタグを取得
var target = $('#funcBtnCommon').find('#' + targetBtn);
19. Gán tham chiếu và lấy giá trị mảng
function setCustomerInspSelectEvent(){
$("#dispItemMultiSelectInspection").unbind('change');
$("#dispItemMultiSelectInspection").change(function() {
// リクエストパラメータを定義 - Define the request parameters
var postData = {};
//var postParam = {};
// イベントID
postData = 'func=refreshInspTable';
// 入力項目のリスト
var $inputItemList = $('.patientCommon').find('input');
// inputタグの入力値を設定
for (var i=0; i < $inputItemList.length; i++) {
var $inputItem = $inputItemList.eq(i);
// ラジオボタンの場合、スキップ
if ($inputItem.attr('type') == 'radio') {
continue;
}
18.
<form:form id="inspTable" modelAttribute="mainForm">
<table class="table_100per_layout"><tbody>
<c:forEach items="${mainForm.dataList}" var="item" varStatus="status">
<tr class="inspectionList">
<form:hidden path="dataList[${status.index}].inspection_set_id"/>
<form:hidden path="dataList[${status.index}].inspection_id"/>
<form:hidden path="dataList[${status.index}].disp_seq"/>
<form:hidden path="dataList[${status.index}].inspection_cd"/>
<form:hidden path="dataList[${status.index}].inspection_name"/>
<form:hidden path="dataList[${status.index}].inspection_sname"/>
<form:hidden path="dataList[${status.index}].inspection_unit"/>
<form:hidden path="dataList[${status.index}].inspection_ll"/>
<form:hidden path="dataList[${status.index}].inspection_ul"/>
<form:hidden path="dataList[${status.index}].inspection_normal_range"/>
<form:hidden class="down_value" path="dataList[${status.index}].calc_inspection_ll"/>
<form:hidden class="up_value" path="dataList[${status.index}].calc_inspection_ul"/>
<td class="w170">
<label><c:out value="${item.inspection_name}"/></label>
</td>
17. function setInspectionTextboxEvent() {
$(".inspection_value").unbind('change');
$(".inspection_value").change(function() {
var up_value = $(this).closest('tr').find('.up_value').val();
up_value = parseFloat(up_value);
var down_value = $(this).closest('tr').find('.down_value').val();
down_value = parseFloat(down_value);
if ($(this).val() != '') {
var thisValue = parseFloat($(this).val());
if (thisValue >= down_value && thisValue <= up_value) {
$(this).closest('tr').find('.colorChange').attr("class","w30 colorChange");
}
else {
$(this).closest('tr').find('.colorChange').attr("class","w30 colorChange changeColerpink");
}
}
});
16. Vị trí các file trong dự án Kondateman
15. Hàm gọi hàm function call function
function setCustomerInspSelectEvent(){
$("#dispItemMultiSelectInspection").unbind('change');
// リクエストパラメータを定義
var postData = {};
//var postParam = {};
14. Link hay
https://drive.google.com/open?id=0By2E2VW6zaaYNHpUdVktNFk1Yjg&authuser=0
http://docs.spring.io/spring/docs/2.5.x/reference/spring-form.tld.html
| List<String> addressInputDateTimeList = new ArrayList<String>(); | ||||||||||||
| Date date = DateTimeToString.toDate(dateTime, "format của chuỗi dateTime") | ||||||||||||
| String date = DateTimeToString.convert(dateTime, "format mong muốn"); | ||||||||||||
| 12. <select class="w185 searchPersonByCd searchPersonByNameKana openSearchPersonDlg" data-dlg-param="site_cd"> | ||||||||||||
| <c:forEach items="${siteList}" | ||||||||||||
| var="item" varStatus="status"> | ||||||||||||
| <c:if test="${item.site_cd == mainForm.site_cd}"> | ||||||||||||
| <option value="<c:out value="${item.site_cd}"/>" selected><c:out value="${item.site_name}"/></option> | ||||||||||||
| </c:if> | ||||||||||||
| <c:if test="${item.site_cd != mainForm.site_cd}"> | ||||||||||||
| <option value="<c:out value="${item.site_cd}"/>"><c:out value="${item.site_name}"/></option> | ||||||||||||
| </c:if> | ||||||||||||
| </c:forEach> | ||||||||||||
| </select> | ||||||||||||
| 13 | obj3.parent().parent().find('.colorChange').removeClass("changeColorWhite").addClass("changeColerpink"); | |||||||||||
| 14 | <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/ui/jquery.ui.combobox.js"></script> | |||||||||||
10. Include
<% @ include file="/common/header.jsp" %>
9. Ví dụ tiếp theo
sau khi biến được truyền từ A.jsp, tại B.jsp ta code:
<%= request.getParameter("name") %>
thay bằng ${param.name}
hoặc thay bằng thay bằng ${param[name]}
8. Express Language
sample.jsp
1. Đọc giá từ file XML, biến servlet
<body>
This is a sample.</br>
This is Blog <%= config.getInitParameter("blog") %>
<% out.println("Vietnam"); %>
2. Đọc giá trị global
Image name:
<%= ((Image) request.getAttribute("imageName")).getName() %>
<% pageContext.setAttribute("scope", "Page Context"); %>
page of the: <%= pageContext.getAttribute("scope") %>
Đây nè trym: ${pageScope.scope }
Nè nữa trym: ${requestScope.student.name}
<%=pageContext.findAttribute ("otherScope") %>
Đọc biến toàn cục trong web.xml: <%= application.getInitParameter("account") %> hoặc
${initParam.account}
Đây nữa nè trym: ${ 4 + 5 }
.
XML file
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>Hello World</servlet-name>
<servlet-class>hung.servlet.HelloWorld</servlet-class>
<init-param>
<param-name>myParam</param-name>
<param-value>hungbktt@gmail.com</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Hello World</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
</web-app>
20. Link, tài liệu về Java
http://docs.spring.io/spring/docs/2.5.x/reference/spring-form.tld.html
19. Key board - Phím tắt
Ctrl+0 --> xem file
[4/21/2015 8:12:36 AM] modani: Ctrl+Shift+R --> tim class
[4/21/2015 8:12:50 AM] modani: Ctrl+Shift +T --> tim file jar
[4/21/2015 8:13:03 AM] modani: Ctrl+H --> tim tu trong project
[4/21/2015 8:13:28 AM] modani: Ctrl + F --> tim tu trong file
7. Getter setter
6. Cookie
Cookie cookie new Cookie("location", "Vietnam");
response.addCookie(cookie);
for (Cookie c: request.getCookies()){
System.out.println(c.getName());
System.out.println(c.getValue());
}
.
5. session
Clear session
session.invalidate();
Đặt hạn thời gian session
<session-config>
<session-timeout>15</session-timeout>
</session-config>
session.setMaxInactiveInterval(900);
HttpSession session = request.getSession();
session.setAttribute("username", username);
Lấy nè:
HttpSession session = request.getSession();
String username = (String) session.getAttribute("username");
4. Application Initialization Parameter
Trong file Web.xml
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<context-param>
<param-name>account</param-name>
<param-value>ducky</param-value>
</context-param>
<servlet>
<servlet-name>Hello World</servlet-name>
<servlet-class>ducky.servlet-</servlet-class>
<init-param>
<param-name>song</param-name>
<param-value>I am yours</param-value>
</init-param>
</servlet>
</web-app>
ServletContext context = this.getServletContext();
String account = context.getInitParameter("song");
3.Servlet Initialization Parameter
ServletConfig config = this.getServletConfig();
//Hoặc this.getServletConfig().getServletContext();
String song = config.getInitParameter("song");
PrintWriter writer = response.getWriter();
writer.println("Username or Password is incorrect...!!!");
2.
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String username = request.getParameter("username");
String password = request.getParameter("password");
PrintWriter writer = response.getWriter();
DatabaseManagement dm = new DatabaseManagement();
if(dm.checkUser(username, password)){
writer.println("Welcome " + username + " o VN");
}
else{
writer.println("Username or Password is incorrect...!!!");
}
}
import java.util.Scanner;
public class Main {
public static void main (String[] args) {
System.out.print("Hello World\n);
System.out.printIn("Age: 23");
System.out.printf("Ten %s \t Tuoi: %d, "Do Manh", 23);
System.out.format("Ten %s \t Tuoi: %d\n, "Do Manh", 23);
}
}
B. Sử dụng Eclipse:
1. Trích 1 hàm ra riêng function method:
Refactor/Extract Local Variable...
Không có nhận xét nào:
Đăng nhận xét