ardygithub / machinetta

0 stars 0 forks source link

JSP modify #6

Closed ardygithub closed 5 years ago

ardygithub commented 5 years ago
                                        Jsp画面ファイルの改修案                                                               

◆改修規模:JSPファイル198件

① パッケージの変更
PJNAME\web\jsp\xxxxxx ※ xxxxxxは機能ID ⇒
PJNAME-web\src\main\webapp\WEB-INF\views\xxxxxx

② タグインポートの切替
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%> 追加
<%@ taglib prefix="s" uri="/struts-tags"%> 削除
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%> 追加
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 追加

③ タグの切替
① s:text ⇒ spring:message
 ⇒ 

② s:textfield ⇒ form:input type="text"                                                                                                      
     <s:textfield name="existSetPlaceHousouBean.usePlaceAdBldg1"/> ⇒ <form:input type="text" path="existSetPlaceHousouBean.usePlaceAdBldg1" />                                                                                                  

③ s:property ⇒ c:out                                                                                                        

    <s:property value="existSetPlaceChInfo.merStdVal1" escape="false" /> ⇒ <c:out value="${existSetPlaceChInfo.merStdVal1}"  escapeXml="false"/>                                                                                                    

    ◆出力対象がFormのプロパティであれば、formの指定が必要                                                                                                 
    <c:out value="${ezcm0000Form.dummyLogin}" />                                                                                                    

④ s:hidden ⇒ form:input type="hidden"                                                                                                       

⑤ s:form ⇒ form:form                                                                                                        
    <s:form name="ezms3000Form" action="ezcllogin"> ⇒ <form:form  modelAttribute="ezms3000Form" action="./ezcllogin">                                                                                                   
                                                                    <form:form  modelAttribute="ezms3000Form" name="ezms3000Form" action="./ezcllogin">                                 
⑥ s:if ⇒ c:if                                                                                                       
    <s:if test="1!=recodeJudgeHousou"> ⇒ <c:if test="${recodeJudgeHousou != 1}">                                                                                                    

⑦ s:if、s:else ⇒ c:choose c:when c:otherwise                                                                                                         

⑧ s:checkbox ⇒ form:checkbox                                                                                                        
    <s:checkbox name="fiContactRenA" value="%{newFiContactRenA == 1}"                                                                                                   
    ⇒                                                                                                   
    <form:checkbox path="fiContactRenA" value="${newFiContactRenA == 1}"                                                                                                    

⑨   s:label ⇒ form:label                                                                                                    
    <s:label name="newSsReferFinishDate" value="受領済" />                                                                                                 
    ⇒                                                                                                   
    <form:label path="newSsReferFinishDate">受領済</form:label>                                                                                                    

⑩ s:url キーワードを取り除く                                                                                                      

    <script language="JavaScript" src="<s:url value='/js/common.js'/>" ></script>                                                                                                   
    ⇒                                                                                                   
    <script language="JavaScript" src="${pageContext.request.contextPath}/resources/js/common.js" ></script>                                                                                                    

    <link rel="stylesheet" type="text/css" href="<s:url value='/css/main.css'/>" />                                                                                                 
    ⇒                                                                                                   
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/main.css" type="text/css" />                                                                                                  

    window.open('<s:url value="/dummy"/>','ezmp2400',"toolbar=no menubar=no resizable=yes status=no scrollbars=yes width=1000 height=650 left=0 top=0");                                                                                                    
    ⇒                                                                                                   
    window.open('./dummy','ezmp2400',"toolbar=no menubar=no resizable=yes status=no scrollbars=yes width=1000 height=650 left=0 top=0");                                                                                                    

⑪ s:iterator ⇒ c:forEach                                                                                                        
     <s:iterator value="viewLineInfoList" status="stat">                                                                                                    
    ⇒                                                                                                   
    <c:forEach var="lineInfo" items="${xxxForm.viewLineInfoList}" varStatus="stat">                                                                                                 

⑫ s:select ⇒ form:select                                                                                                        
    <s:select name="user.userOrgCd" id="user_userOrgCd" list="orgList" headerKey="codeClassCode" listKey="codeClassCode" listValue="codeDetails"></s:select>                                                                                                    
    ⇒                                                                                                   
    <form:select path="userOrgCd" id="userOrgCd" >                                                                                                  
        <form:options items="${orgList}" itemValue="codeClassCode" itemLabel="codeDetails"></form:options>                                                                                              
    </form:select>                                                                                                  

⑬ s:set ⇒ c:set                                                                                                     
    ◆セット対象がFormのプロパティであれば、targetのForm指定が必要                                                                                                  
    <c:set target="${ezcm0000Form}" property ="dummyLogin" value="123"/>                                                                                                    

⑭                                                                                                       
    session.session_user.xxx                                                                                                    
    ⇒                                                                                                   
    sessionScope.session_user.xxx                                                                                                   
    例:                                                                                                  
    <c:out value="${sessionScope.session_user.noukiAuth}" />                                                                                                    

⑮   自定義タグの変更                                                                                                    

    自定義タグに対応するクラスの修正も必要である。                                                                                                 
    その修正結果より、下記のタグ対応要否が判定されること。                                                                                                 
        cw:dynamiclabel                                                                                             

        cw:dynamictextfield                                                                                             

        cw:dynamictextarea                                                                                              

        cw:dynamiccheckbox                                                                                              
ardygithub commented 5 years ago

⑯ 全般、sタグからspringタグに改修するときに、まず当該タグのNameはFormに存在するかを確認する必要ある。
もしFormタグに存在しなかった場合に、相応するHtmlタグに改修しなければならない

⑰ JSに改修するタグのIDを使っているかどうかを確認する必要ある。
もし使っていれば、<Formタグにidを指定する必要ある。

※<sタグがhtmlタグに解析するときに、もしID指定していなければ、Form名をNameの先頭に追加し、"."を"_"に変換して、htmlタグのIDとする。             

⑱ <s:radio ⇒ <form:radiobuttons </s:radio>

⑲ 全般、属性の名前は先頭2ケタが大文字ある場合に、ELが識別できないので、小文字に修正する 関連するBean,XMLのところは全部修正する