• <i id='ZHioG'><tr id='ZHioG'><dt id='ZHioG'><q id='ZHioG'><span id='ZHioG'><b id='ZHioG'><form id='ZHioG'><ins id='ZHioG'></ins><ul id='ZHioG'></ul><sub id='ZHioG'></sub></form><legend id='ZHioG'></legend><bdo id='ZHioG'><pre id='ZHioG'><center id='ZHioG'></center></pre></bdo></b><th id='ZHioG'></th></span></q></dt></tr></i><div id='ZHioG'><tfoot id='ZHioG'></tfoot><dl id='ZHioG'><fieldset id='ZHioG'></fieldset></dl></div>

    • <bdo id='ZHioG'></bdo><ul id='ZHioG'></ul>

    <legend id='ZHioG'><style id='ZHioG'><dir id='ZHioG'><q id='ZHioG'></q></dir></style></legend>

    <tfoot id='ZHioG'></tfoot>
  • <small id='ZHioG'></small><noframes id='ZHioG'>

        将struts2从2.3.16更新到2.3.32后(修复S2-045),JSP文件无法解析一些Objects的字段

        时间:2023-09-24
        <tfoot id='Ee288'></tfoot>
        <legend id='Ee288'><style id='Ee288'><dir id='Ee288'><q id='Ee288'></q></dir></style></legend>
          1. <i id='Ee288'><tr id='Ee288'><dt id='Ee288'><q id='Ee288'><span id='Ee288'><b id='Ee288'><form id='Ee288'><ins id='Ee288'></ins><ul id='Ee288'></ul><sub id='Ee288'></sub></form><legend id='Ee288'></legend><bdo id='Ee288'><pre id='Ee288'><center id='Ee288'></center></pre></bdo></b><th id='Ee288'></th></span></q></dt></tr></i><div id='Ee288'><tfoot id='Ee288'></tfoot><dl id='Ee288'><fieldset id='Ee288'></fieldset></dl></div>
                <bdo id='Ee288'></bdo><ul id='Ee288'></ul>

                • <small id='Ee288'></small><noframes id='Ee288'>

                    <tbody id='Ee288'></tbody>

                • 本文介绍了将struts2从2.3.16更新到2.3.32后(修复S2-045),JSP文件无法解析一些Objects的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  最近我们修复了struts2的'S2-045'问题.我更新了所有与struts2相关的jar文件,包括freemarkerognlxWork 等.我使用 tomcat8 来部署我的动态 Web 项目.启动 tomcat-server 时没有任何 Exceptions.但是似乎出现了一些问题:一些值(从 db 获取)应该显示在 jsp 页面上不再显示.没有抛出 Exceptions.我还可以看到我已经在 Action Classes 中正确获取了对象.


                  以下是一些例子

                  Recently we fixed the struts2's 'S2-045' problem.I updated all the struts2 related jar files including freemarker, ognl, xWork,etc. I use tomcat8 to deploy my dynamic web project. There were not any Exceptions while starting the tomcat-server. But some problems seemed occur: some values(got from db) should be displayed on the jsp pages dose not show up any more. There is no Exceptions thrown. I also can watch that I have already got the very Objects correctly in the Action Classes.


                  the following is some examples

                      // 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>
                      //=================================================================
                  

                  以下是相关字段 id News.java

                  Following is the ralated fields id News.java

                      // 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;
                          }
                      }  
                  

                  然后是 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;
                           }
                  
                      }
                  

                  我认为这可能是由 OGNL 或 JSP 相关的 jar 文件引起的.我在 index.jsp 或 java-files 中没有发现任何问题.

                  I think this maybe caused by the OGNL or JSP related jar-files. I didn't find any problems in my index.jsp or java-files.

                  推荐答案

                  你需要使用如下格式的getter/setter.只有一个小写字母开头的属性不是大写的.

                  You need to use getters/setters in the following format. Properties with only one starting lowercase letter are not uppercased.

                      public String getfTitle() {
                          return fTitle;
                      }
                  
                  
                      public void setfTitle(String title) {
                          fTitle = title;
                      }
                  

                  这篇关于将struts2从2.3.16更新到2.3.32后(修复S2-045),JSP文件无法解析一些Objects的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Struts 2 - HTTP 状态 404 - 没有为操作定义结果 下一篇:使用 Struts 2 REST 插件的带有附加参数的自定义函数

                  相关文章

                      <bdo id='sLmbL'></bdo><ul id='sLmbL'></ul>
                      <tfoot id='sLmbL'></tfoot>

                    1. <legend id='sLmbL'><style id='sLmbL'><dir id='sLmbL'><q id='sLmbL'></q></dir></style></legend>
                    2. <small id='sLmbL'></small><noframes id='sLmbL'>

                    3. <i id='sLmbL'><tr id='sLmbL'><dt id='sLmbL'><q id='sLmbL'><span id='sLmbL'><b id='sLmbL'><form id='sLmbL'><ins id='sLmbL'></ins><ul id='sLmbL'></ul><sub id='sLmbL'></sub></form><legend id='sLmbL'></legend><bdo id='sLmbL'><pre id='sLmbL'><center id='sLmbL'></center></pre></bdo></b><th id='sLmbL'></th></span></q></dt></tr></i><div id='sLmbL'><tfoot id='sLmbL'></tfoot><dl id='sLmbL'><fieldset id='sLmbL'></fieldset></dl></div>