编码-jstl报错,在网上查了很久还是没能解决,求大神帮忙~~~跪谢~~没c币了

问题描述

jstl报错,在网上查了很久还是没能解决,求大神帮忙~~~跪谢~~没c币了

报的错:

 org.apache.jasper.JasperException: javax.el.ELException: Error reading 'stuname' on type model.StuInformationOne_$$_javassist_1

jsp:

 <table>
            <tbody>
                <c:forEach items="${requestScope.commPage.lists}" var="stu">
                    <tr>
                        <td class="table-content">${stu.stunameused}</td>
                        <td class="table-content">${stu.stuInformationOne.stuname}</td>
                    </tr>
                </c:forEach>
            </tbody>
        </table>

action:

 //查询
    public String serchStu() throws Exception {
               CommPage commPage;
               StringBuffer hql = new StringBuffer();
               hql.append("FROM StuInformationTwo");
                 session.put("AmaxR", cmaxR);
                 commPage=this.dao.findCommPageByhql(hql.toString(), null, currPage, (Integer)session.get("AmaxR"));

                requestMap.put("commPage", commPage);
                System.out.println("commPage"+commPage);
                return "fa";
    }

StuInformationTwo实体类:

 package model;

/**
 * StuInformationTwo entity. @author MyEclipse Persistence Tools
 */

public class StuInformationTwo implements java.io.Serializable {

    // Fields

    private Integer id;
    private StuInformationOne stuInformationOne;
    private String stunameused;
    private String stuvld;
    private String stuhousehold;
    private String stuccountnature;
    private String stuspecialty;
    private String stustuid;
    private String stugrade;
    private String stufaculty;
    private String stuclass;
    private String stuentrancetime;

    // Constructors

    /** default constructor */
    public StuInformationTwo() {
    }

    /** full constructor */
    public StuInformationTwo(StuInformationOne stuInformationOne,
            String stunameused, String stuvld, String stuhousehold,
            String stuccountnature, String stuspecialty, String stustuid,
            String stugrade, String stufaculty, String stuclass,
            String stuentrancetime) {
        this.stuInformationOne = stuInformationOne;
        this.stunameused = stunameused;
        this.stuvld = stuvld;
        this.stuhousehold = stuhousehold;
        this.stuccountnature = stuccountnature;
        this.stuspecialty = stuspecialty;
        this.stustuid = stustuid;
        this.stugrade = stugrade;
        this.stufaculty = stufaculty;
        this.stuclass = stuclass;
        this.stuentrancetime = stuentrancetime;
    }
 get,setlue
}

StuInformationTwo配置文件:

 <hibernate-mapping>
    <class name="model.StuInformationTwo" table="stu_information_two" catalog="select">
        <id name="id" type="java.lang.Integer">
            <column name="id" />
            <generator class="increment" />
        </id>
        <many-to-one name="stuInformationOne" class="model.StuInformationOne" fetch="select">
            <column name="oneid" />
        </many-to-one>
        <property name="stunameused" type="java.lang.String">
            <column name="stunameused" />
        </property>
        <property name="stuvld" type="java.lang.String">
            <column name="stuvld" />
        </property>
        <property name="stuhousehold" type="java.lang.String">
            <column name="stuhousehold" />
        </property>
        <property name="stuccountnature" type="java.lang.String">
            <column name="stuccountnature" />
        </property>
        <property name="stuspecialty" type="java.lang.String">
            <column name="stuspecialty" />
        </property>
        <property name="stustuid" type="java.lang.String">
            <column name="stustuid" />
        </property>
        <property name="stugrade" type="java.lang.String">
            <column name="stugrade" />
        </property>
        <property name="stufaculty" type="java.lang.String">
            <column name="stufaculty" />
        </property>
        <property name="stuclass" type="java.lang.String">
            <column name="stuclass" />
        </property>
        <property name="stuentrancetime" type="java.lang.String">
            <column name="stuentrancetime" />
        </property>
    </class>
</hibernate-mapping>

StuInformationOne实体类:

 package model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

public class StuInformationOne implements java.io.Serializable {

    private Integer id;
    private String stuname;
    private String stusex;
    private String stubirthday;
    private String stunativeplace;
    private String stunation;
    private String stucountry;
    private String stutypeofidentity;
    private String stuidentity;
    private String stucverseaschinese;
    private String stuhealth;
    private String stupoliticalstatus;
    private Date date;
    private Set stuInformationThrs = new HashSet(0);
    private Set stuFamilyOnes = new HashSet(0);
    private Set stuInformationTwos = new HashSet(0);
    private Set stuFamilyTwos = new HashSet(0);

    public StuInformationOne(String stuname, String stusex, String stubirthday,
            String stunativeplace, String stunation, String stucountry,
            String stutypeofidentity, String stuidentity,
            String stucverseaschinese, String stuhealth,
            String stupoliticalstatus, Date date, Set stuInformationThrs,
            Set stuFamilyOnes, Set stuInformationTwos, Set stuFamilyTwos) {
        this.stuname = stuname;
        this.stusex = stusex;
        this.stubirthday = stubirthday;
        this.stunativeplace = stunativeplace;
        this.stunation = stunation;
        this.stucountry = stucountry;
        this.stutypeofidentity = stutypeofidentity;
        this.stuidentity = stuidentity;
        this.stucverseaschinese = stucverseaschinese;
        this.stuhealth = stuhealth;
        this.stupoliticalstatus = stupoliticalstatus;
        this.date = date;
        this.stuInformationThrs = stuInformationThrs;
        this.stuFamilyOnes = stuFamilyOnes;
        this.stuInformationTwos = stuInformationTwos;
        this.stuFamilyTwos = stuFamilyTwos;
    }

    get,set略

}

StuInformationOne配置文件:

 <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
    Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
    <class name="model.StuInformationOne" table="stu_information_one" catalog="select">
        <id name="id" type="java.lang.Integer">
            <column name="id" />
            <generator class="increment" />
        </id>
        <property name="stuname" type="java.lang.String">
            <column name="stuname" />
        </property>
        <property name="stusex" type="java.lang.String">
            <column name="stusex" />
        </property>
        <property name="stubirthday" type="java.lang.String">
            <column name="stubirthday" />
        </property>
        <property name="stunativeplace" type="java.lang.String">
            <column name="stunativeplace" />
        </property>
        <property name="stunation" type="java.lang.String">
            <column name="stunation" />
        </property>
        <property name="stucountry" type="java.lang.String">
            <column name="stucountry" />
        </property>
        <property name="stutypeofidentity" type="java.lang.String">
            <column name="stutypeofidentity" />
        </property>
        <property name="stuidentity" type="java.lang.String">
            <column name="stuidentity" />
        </property>
        <property name="stucverseaschinese" type="java.lang.String">
            <column name="stucverseaschinese" />
        </property>
        <property name="stuhealth" type="java.lang.String">
            <column name="stuhealth" />
        </property>
        <property name="stupoliticalstatus" type="java.lang.String">
            <column name="stupoliticalstatus" />
        </property>
        <property name="date" type="java.util.Date">
            <column name="date" length="10" />
        </property>
        <set name="stuInformationThrs" inverse="true" cascade="all">
            <key>
                <column name="twoid" />
            </key>
            <one-to-many class="model.StuInformationThr" />
        </set>
        <set name="stuFamilyOnes" inverse="true" cascade="all">
            <key>
                <column name="thrid" />
            </key>
            <one-to-many class="model.StuFamilyOne" />
        </set>
        <set name="stuInformationTwos" inverse="true" cascade="all">
            <key>
                <column name="oneid" />
            </key>
            <one-to-many class="model.StuInformationTwo" />
        </set>
        <set name="stuFamilyTwos" inverse="true" cascade="all">
            <key>
                <column name="fouid" />
            </key>
            <one-to-many class="model.StuFamilyTwo" />
        </set>
    </class>
</hibernate-mapping>

解决方案

猜测是页面解析不了${stu.stuInformationOne}对象,而是把stuInformationOne解析成一个字符串。
你可以重写stuInformationOne的toString方法来验证一下。

个人觉得hibernate的关联查询有的时候真的很不方便,取值时还会报错(session已关闭)。还不如直接写sql语句。

解决方案二:

开启lazy模式。。。。

时间: 2024-10-28 07:11:56

编码-jstl报错,在网上查了很久还是没能解决,求大神帮忙~~~跪谢~~没c币了的相关文章

sap-wsdl2java调用webservce报错,但是用soapui调用没问题,求大神帮忙分析下

问题描述 wsdl2java调用webservce报错,但是用soapui调用没问题,求大神帮忙分析下 AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server faultSubcode: faultString: System Error faultActor: faultNode: faultDetail: {http://sap.com/xi/WebService/xi2.0}SystemError:RCV

html-插入jstl标签报错,求大神帮忙看下,网上解决方案都是错的

问题描述 插入jstl标签报错,求大神帮忙看下,网上解决方案都是错的 com.neusoft.unieap.action.EAPActionServlet.process(EAPActionServlet.java:814) >> org.apache.jasper.JasperException: Validation error messages from TagLibraryValidator for c null: org.xml.sax.SAXParseException: Attr

树形 递归-java 递归报错 求大神帮忙

问题描述 java 递归报错 求大神帮忙 private List<Post> getPostLower(List<Post> PostTops){ List<Post> postAll=new ArrayList<Post>(); // 上级 for(Post post:PostTops){ //查询到下级 List<Post> posts=basService.queryPostByParentId(post.getPostId()); //

aspectjrt-求解:AOP编程时@Aspect注解运行期报错,已经一天了,还是没有头绪,希望大神解答一下。

问题描述 求解:AOP编程时@Aspect注解运行期报错,已经一天了,还是没有头绪,希望大神解答一下. 在做Spring的AOP时,运行tomcat出现了这些异常,当我去掉@Aspect注解的时候,这些异常就没有了,我尝试替换过aspectjrt1.6.jar和aspectjweaver1.6.jar,可还是不行,我的JDK是1.7的.请问这是什么情况造成的呢?肯定是@Aspect,不过还是不太清楚具体是什么?希望大神解答一下,高分. 解决方案 有个bean创建失败了,看看不是哪里的注解冲突或遗

在tomcat上运行没有问题,在weblogic上运行就报下面的错,跪求大神帮忙

问题描述 在tomcat上运行没有问题,在weblogic上运行就报下面的错,跪求大神帮忙 java.sql.SQLException: Statement cancelled, probably by transaction timing out at weblogic.jdbc.wrapper.Statement.postInvocationHandlerNoWrap(Statement.java:128) at weblogic.jdbc.wrapper.PreparedStatement

为什么把eclipse的版本设置为1.7,还会报错,求大神帮忙

问题描述 为什么把eclipse的版本设置为1.7,还会报错,求大神帮忙 package java_grammar; public class Example3_1 { public static void main(String arg[]){ int []a={1,2,3,4,5,6,7,8}; for(int i:a){ System.out.println(i); } } } 解决方案 for(int i:a){//不是for,是foreach System.out.println(i)

spring 注入 多线程-spring多线程注入报错,求大神帮忙解决一下。。谢谢!!

问题描述 spring多线程注入报错,求大神帮忙解决一下..谢谢!! Error creating bean with name 'transactionManager': Singleton bean creation not allowed while the singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implement

c#项目,用的是vs2012打开的,报错没有工具集,求大神帮忙解决一下,谢谢了!!拜托拜托!

问题描述 c#项目,用的是vs2012打开的,报错没有工具集,求大神帮忙解决一下,谢谢了!!拜托拜托! 项目文件包含 ToolsVersion="12.0".此工具集可能未知或缺失(您可以通过安装相应版本的 MSBuild 来解决该问题),或者该生成因策略原因已被强制更改为特殊 ToolsVersion.将此项目视作具有 ToolsVersion="4.0".有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkId=2913

mvc4-asp.net mvc 项目,发布后服务器后有的求情会报错,求大神帮忙啊!!

问题描述 asp.net mvc 项目,发布后服务器后有的求情会报错,求大神帮忙啊!! asp.net mvc 项目,本地运行没有任何问题,发布到服务器后,有的请求会报:处理您的请求时出错,求大神帮忙. 解决方案 到服务器上运行一下项目,查看具体的错误信息