「Java開発」s:checkboxとs:property の使い方

Javaコード

<s:checkbox name=”sampleBean.subSampleBean.demoCftA” label=””” fieldValue=”%{‘true’}”/>
<s:property value=”getText(‘changfa.lijia11’)” escape=”false” />

<s:checkbox name=”sampleBean.subSampleBean.demoCftB” label=””” fieldValue=”%{‘true’}”/>
<s:property value=”getText(‘changfa.lijia22’)” escape=”false” />

<s:checkbox name=”sampleBean.subSampleBean.demoCftC” label=””” fieldValue=”%{‘true’}”/>
<s:property value=”getText(‘changfa.lijia33’)” escape=”false” />

 

 

 

「Java開発」s:textfield、s:select、s:radioのサンプルコード

Javaコード:
① s:textfield
<s:textfield name=”sampleSearchBean.cftYoo”
size=”20″
maxlength=”150″ cssStyle=”xxxx” />

② s:select
<s:select list=”demoList”
name=”demoSearchBean.kdfInfo”
listKey=”value” listValue=”xxx” />

③ s:radio
<s:radio name=”sampleSearchBean.xxxx”
label=”sampleSearchBean.xxx”
list=”%{xxx}” listValue=”getText(‘xxxxx’)”
onclick=”xxxx;”/>

「Java」Collections.sort()でArrayList要素をソートするサンプル

Javaコード
package itstudy;

import java.util.ArrayList;
import java.util.Collections;

public class SortDemoTest {

public static void main(String[] args) {

ArrayList cityLst = new ArrayList();
cityLst.add(“TOKYO”);
cityLst.add(“OOSAKA”);
cityLst.add(“FUKUOKA”);
cityLst.add(“OOKINAWA”);
for (int i = 0; i < cityLst.size(); i++) {
System.out.println(cityLst.get(i));
}
Collections.sort(cityLst);
System.out.println(“***ArrayList要素をソート ***”);
for (int i = 0; i < cityLst.size(); i++) {
System.out.println(cityLst.get(i));
}

}

}

実行結果
TOKYO
OOSAKA
FUKUOKA
OOKINAWA
***ArrayList要素をソート ***
FUKUOKA
OOKINAWA
OOSAKA
TOKYO

「jQuery開発」$.each()と$.ajax()を利用するサンプルコード

サンプルコード

$(function(){

$(‘#send’).click(function(){

$.ajax({

type: “GET”,

url: “demo.json”,

data: {username:$(“#username”).val(), content:$(“#profile”).val()},

dataType: “json”,

success: function(data){

$(‘#ctnTxt’).empty();   //ctnTxtのコンテンツをクリア
var html = ”;

$.each(data, function(commentIndex, comment){

html += ‘<div class=”comment”><h6>’ +comment[‘username’]

+ ‘:</h6><p class=”para”‘ + comment[‘profile’]

+ ‘</p></div>’;

});

$(‘#ctnTxt’).html(html);

}

});

});

});

「jQuery」append()とhtml()を利用するサンプルコード

1.append(content)
$(selector).append(function(index,html))
サンプルコード:
<script src=”/jquery.min.js” type=”text/javascript”></script>
<style>
.imgFocus{border: 1px solid #eee;}
</style>
<p> </p>
<script type=”text/javascript”>
var cftImg = “<div class=’imgFocus’>sample</div>”;
$(“p”).append(cftImg);
</script>

2.$(selector).html()
サンプルコード:
$(“.btnInfo”).click(function(){
$(“p”).html(“Hello <b>world</b>!”);

});

要素をクリア
$(“a[href$=’logout.jsp’]”).click(function(event) {
event.preventDefault();
$.get(“/xxx/Logout.jsp”,””,function(data, textStatus) {
if (data == 1) { //ログアウト
$(‘#message’).html(“”);
$(“#userlogin>div”).show();
}
else {
$(‘#message’).append(“<p><strong>ログアウト失敗、もう一度行ってください</strong></p>”);
}
});
});

「Java開発」

Javaコード:
<s:if test=”%{empNum>=10}”>
<A href=”xxxx” >
<s:property value=”getText(‘label001’)” escape=”false” />
<s:property value=”getText(‘label002’)” escape=”false” />
</A>
</s:if>

「Java」文字列を大文字又は小文字へ変換するサンプルメソッド

Javaコード
public static String toUpper(String srcObj)
{
if (srcObj == null) {
return null;
}
return srcObj.toUpperCase();
}
public static String toLower(String srcObj)
{
if (srcObj == null) {
return null;
}

return srcObj.toLowerCase();
}

CentOS 7.3.1611にphp7.0.20をアンインストールするメモ

# php -v
PHP 7.0.20 (cli) (built: Jun 7 2017 07:50:14) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
# yum remove php
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
–> Running transaction check
—> Package php.x86_64 0:7.0.20-1.el7.remi will be erased
–> Finished Dependency Resolution
base/7/x86_64 | 3.6 kB 00:00:00
extras/7/x86_64 | 3.4 kB 00:00:00
extras/7/x86_64/primary_db | 188 kB 00:00:00
remi-safe | 2.9 kB 00:00:00
updates/7/x86_64 | 3.4 kB 00:00:00
updates/7/x86_64/primary_db | 7.7 MB 00:00:00

Dependencies Resolved

===========================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================
Removing:
php x86_64 7.0.20-1.el7.remi @remi-php70 8.3 M

Transaction Summary
===========================================================================================================================
Remove 1 Package

Installed size: 8.3 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : php-7.0.20-1.el7.remi.x86_64 1/1
Verifying : php-7.0.20-1.el7.remi.x86_64 1/1

Removed:
php.x86_64 0:7.0.20-1.el7.remi

Complete!

# yum –enablerepo=remi-php70 remove php\*
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
–> Running transaction check
—> Package php-cli.x86_64 0:7.0.20-1.el7.remi will be erased
—> Package php-common.x86_64 0:7.0.20-1.el7.remi will be erased
—> Package php-fpm.x86_64 0:7.0.20-1.el7.remi will be erased
—> Package php-json.x86_64 0:7.0.20-1.el7.remi will be erased
—> Package php-mbstring.x86_64 0:7.0.20-1.el7.remi will be erased
—> Package php-mcrypt.x86_64 0:7.0.20-1.el7.remi will be erased
—> Package php-mysqlnd.x86_64 0:7.0.20-1.el7.remi will be erased
—> Package php-pdo.x86_64 0:7.0.20-1.el7.remi will be erased
—> Package php-pear.noarch 1:1.10.5-2.el7.remi will be erased
—> Package php-process.x86_64 0:7.0.20-1.el7.remi will be erased
—> Package php-xml.x86_64 0:7.0.20-1.el7.remi will be erased
–> Finished Dependency Resolution
remi-php70 | 2.9 kB 00:00:00

Dependencies Resolved

===========================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================
Removing:
php-cli x86_64 7.0.20-1.el7.remi @remi-php70 13 M
php-common x86_64 7.0.20-1.el7.remi @remi-php70 7.9 M
php-fpm x86_64 7.0.20-1.el7.remi @remi-php70 4.2 M
php-json x86_64 7.0.20-1.el7.remi @remi-php70 80 k
php-mbstring x86_64 7.0.20-1.el7.remi @remi-php70 2.8 M
php-mcrypt x86_64 7.0.20-1.el7.remi @remi-php70 89 k
php-mysqlnd x86_64 7.0.20-1.el7.remi @remi-php70 888 k
php-pdo x86_64 7.0.20-1.el7.remi @remi-php70 381 k
php-pear noarch 1:1.10.5-2.el7.remi @remi-php70 2.1 M
php-process x86_64 7.0.20-1.el7.remi @remi-php70 187 k
php-xml x86_64 7.0.20-1.el7.remi @remi-php70 854 k

Transaction Summary
===========================================================================================================================
Remove 11 Packages

Installed size: 32 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : 1:php-pear-1.10.5-2.el7.remi.noarch 1/11
Erasing : php-cli-7.0.20-1.el7.remi.x86_64 2/11
Erasing : php-process-7.0.20-1.el7.remi.x86_64 3/11
Erasing : php-xml-7.0.20-1.el7.remi.x86_64 4/11
Erasing : php-fpm-7.0.20-1.el7.remi.x86_64 5/11
warning: /etc/php-fpm.d/www.conf saved as /etc/php-fpm.d/www.conf.rpmsave
Erasing : php-mcrypt-7.0.20-1.el7.remi.x86_64 6/11
Erasing : php-mysqlnd-7.0.20-1.el7.remi.x86_64 7/11
Erasing : php-pdo-7.0.20-1.el7.remi.x86_64 8/11
Erasing : php-mbstring-7.0.20-1.el7.remi.x86_64 9/11
Erasing : php-json-7.0.20-1.el7.remi.x86_64 10/11
Erasing : php-common-7.0.20-1.el7.remi.x86_64 11/11
Verifying : php-pdo-7.0.20-1.el7.remi.x86_64 1/11
Verifying : php-common-7.0.20-1.el7.remi.x86_64 2/11
Verifying : php-mbstring-7.0.20-1.el7.remi.x86_64 3/11
Verifying : php-mysqlnd-7.0.20-1.el7.remi.x86_64 4/11
Verifying : 1:php-pear-1.10.5-2.el7.remi.noarch 5/11
Verifying : php-cli-7.0.20-1.el7.remi.x86_64 6/11
Verifying : php-mcrypt-7.0.20-1.el7.remi.x86_64 7/11
Verifying : php-xml-7.0.20-1.el7.remi.x86_64 8/11
Verifying : php-process-7.0.20-1.el7.remi.x86_64 9/11
Verifying : php-fpm-7.0.20-1.el7.remi.x86_64 10/11
Verifying : php-json-7.0.20-1.el7.remi.x86_64 11/11

Removed:
php-cli.x86_64 0:7.0.20-1.el7.remi php-common.x86_64 0:7.0.20-1.el7.remi php-fpm.x86_64 0:7.0.20-1.el7.remi
php-json.x86_64 0:7.0.20-1.el7.remi php-mbstring.x86_64 0:7.0.20-1.el7.remi php-mcrypt.x86_64 0:7.0.20-1.el7.remi
php-mysqlnd.x86_64 0:7.0.20-1.el7.remi php-pdo.x86_64 0:7.0.20-1.el7.remi php-pear.noarch 1:1.10.5-2.el7.remi
php-process.x86_64 0:7.0.20-1.el7.remi php-xml.x86_64 0:7.0.20-1.el7.remi

Complete!

 

# rpm -q php
package php is not installed

phpのバージョンを再度確認する
# php -v
-bash: /usr/bin/php: No such file or directory

CentOS6(7)にhttpd操作コマンドメモ

CentOS6の場合
# sudo service httpd start
# sudo chkconfig httpd on

CentOS7の場合
sudo systemctl start httpd.service
sudo systemctl enable httpd.service

CentOS7.3.1611にphp7.0.20 + nginx1.10.2 + php-fpmをインストールするメモ

1.epelリポジトリのインストール
# yum -y install epel-release
# vi /etc/yum.repos.d/epel.repo
修正前
enabled=1
修正後
enabled=0

2.remiリポジトリの追加
# rpm –import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

3.nginxインストール
# yum install –enablerepo=epel nginx

4.nginx設定
# cd /etc/nginx/conf.d
# vi sample.conf
サンプルコード
server {
listen 80;
server_name xxxx.net;
root /usr/share/nginx/data/xxx;
index index.php;

charset utf-8;

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include fastcgi_params;
}
}

5.nginx起動
# nginx -t
# systemctl start nginx

nginx自動起動設定
# systemctl enable nginx

6.php7インストール
# yum install –enablerepo=epel,remi-php70 php php-mbstring php-pear php-fpm php-mcrypt php-mysql

phpバージョン確認
# php -v

7.php-fpm設定
# cd /etc/php-fpm.d/
# cp -p www.conf www.conf_yyyymmdd
# vi www.conf

修正前
user = apache
group = apache

修正後
user = nginx
group = nginx

8.php-fpm起動
# systemctl start php-fpm
php-fpm自動起動設定
# systemctl enable php-fpm

9.MariaDBインストール
# yum install mariadb mariadb-server

MariaDB起動
# systemctl start mariadb

MariaDB自動設定
# systemctl enable mariadb

MariaDB設定
# mysql_secure_installation

文字コード設定
# cd /etc/my.cnf.d/
# cp -p server.cnf server.cnf_yyyymmdd
# vi server.cnf

追記
[mysqld]
character-set-server = utf8