2017-03-14 2 views
1

최근에 struts2의 'S2-045' 문제가 해결되었습니다. 모두 업데이트되었습니다. struts2과 관련된 jar 파일은 freemarker, ognl, xWork 등입니다. 동적 웹 프로젝트를 배포하려면 tomcat8을 사용합니다. tomcat-server를 시작하는 동안 Exceptions이 없습니다. 그러나 일부 문제이 발생했습니다. db30에서 가져온 일부 값은 페이지가 나타나지 않아야합니다.. 던진 Exceptions가 없다. Action Classes에 이미 정확하게 객체가 있음을 볼 수도 있습니다. struts2를 2.3.16에서 2.3.32로 업데이트 한 후 (S2-045 수정) JSP 파일에서 일부 객체 필드를 확인할 수 없음


다음이 아마 원인이 내가 생각하는 ralated 필드 ID를
// News.java (**just some ralated fields**) 
    class News{ 
     @Id 
     @GeneratedValue(generator = "system-uuid") 
     @GenericGenerator(name = "system-uuid", strategy = "uuid") 
     @Column(name = "f_uuid", length = 32, unique = true) 
     private String UUID; 

     @Column(name = "f_title", length = 200) 
     private String fTitle; 

     @Transient 
     private String fCreatetime_s; 

     public String getUUID() { 
      return UUID; 
     } 
     public void setUUID(String uuid) { 
      UUID = uuid; 
     } 

     public String getFTitle() { 
      return fTitle; 
     } 


     public void setFTitle(String title) { 
      fTitle = title; 
     } 

     public String getFCreatetime_s() { 
      SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); 
      return formatter.format(Long.valueOf(fCreatetime)); 
     } 


     public void setFCreatetime_s(String createtime_s) { 
      fCreatetime_s = createtime_s; 
     } 
    } 

News.java

다음 GetarcList.java

//GetarcList.java (just include some related fields) 
    class GetarcList{ 
     private List list; 

     public void setList(List list) { 
      this.list = list; 
     } 

     //!!!!!!$$$$$$$$--- Attention -----$$$$$$$$$!!!!!!!!!!! 
     // this method returns a List<News> , I can successfully get every value of 'News' in the list 
     public List getList() throws AuctionException{ 
      String orderby_str = (String) OrderByMap.get(String.valueOf(orderby)); 
      list = webTagManager.getArcList(row, typeid, titlelen, infolen, orderby_str + " " + orderway); 
      return list; 
     } 

    } 

되어 다음 몇 가지 예


// index.jsp ----- here is the list I want to show on the page. 
    // the list is the type of List<News> (Class News is my bussiness Class). 
    // I want to get the 'fTitle' and 'fCreatetime_s' from 'News' but they 
    //  do not show up! (This used to be working very well.) 
    <s:bean name="org.ulibrary.web.Getarclist"> 
     <s:iterator value="list"> 
     <li> 
      <span class="listTitle"> 
       <a target="_blank" href="ViewArc.action? uuid=${UUID}">${fTitle}</a> 
      </span> 
      <span class="listDate">${fCreatetime_s}</span> 
     </li> 
     </s:iterator> 
    </s:bean> 
    //================================================================= 

입니다 OGNL 또는 JSP에 의한 ted jar-files. 내 index.jsp 또는 java-files에서 문제를 찾지 못했습니다.

+0

'UUID'필드가 페이지에서 해결 될 수 있음을 잊어 버렸습니다. –

+0

https://struts.apache.org/docs/struts-23-to-25-migration.html –

답변

1

getter/setters를 다음 형식으로 사용해야합니다. 하나의 소문자로 시작하는 속성은 대문자로 표시되지 않습니다.

public String getfTitle() { 
     return fTitle; 
    } 


    public void setfTitle(String title) { 
     fTitle = title; 
    } 
+0

정말 고마워요. 나는 전에 그것을 알아 차리지 못했다. –

+0

이 잘못된 getter 및 setter 이름은 이전 버전 (2.3.16)에서도 작동합니까? 또는 2.3.32 버전의이 부분은 명시 적으로 명시 적입니다. @Roman 이전에 부울 세터에 대한 토론이 있었음을 알고 있습니다. http://stackoverflow.com/q/36909947/5086633 – yeppe

+1

@yeppe 버전 2.3.32 이상에만 해당됩니다. OGNL 버전 3.0.11 (OgnlRuntime)은 Struts2 프레임 워크와 번들로 제공됩니다. –

관련 문제