当前位置: 代码迷 >> Java Web开发 >> 关于mutlibox与LabelValueBean的问题
  详细解决方案

关于mutlibox与LabelValueBean的问题

热度:153   发布时间:2008-05-21 00:02:36.0
关于mutlibox与LabelValueBean的问题
想做一个 复选框的提交页面
我用的是struts1.x框架
form文件
private LabelValueBean[] mstra;//setter getter

jsp文件
<%

UserUtil mm = new UserUtil();
LabelValueBean[] ms =  mm.getmstr();
session.setAttribute( "ms", ms);
%>

<td>
     <logic:iterate id = "mstra"  name= "ms">   
        <html:multibox name = "mstra" property="value">
            <bean:write name = "mstra" property="value"/>
        </html:multibox >
       <bean:write name = "mstra" property="label"/>
    </logic:iterate >
</td>


getmstr()方法是UserUtil 中的提取数据库数据的
public LabelValueBean[] getmstr() throws Exception{
     LabelValueBean[] mstra1 = new LabelValueBean[20];
     DBConnect conn = new DBConnect();
     String key = null;
     String value = null;
     String mslist = "select MID,MName from ADMIN_MODULE";
     conn.getConn();
     ResultSet rs1 = conn.getrs(mslist);
     int i =0;
    try{
        while(rs1.next()){
            key = Integer.toString(rs1.getInt("MID"));
            value = (String)rs1.getString("MName");
            mstra1[i++] = new LabelValueBean(key,value);
        }
    }catch(SQLException e) {
        System.out.print("Exception in getmid() error!");
    }finally {
      conn.close();
    }
        return mstra1;
    }

执行页面时提示
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 16 in the jsp file: /sysmanage/NewRole.jsp
The method getmstr() is undefined for the type UserUtil
13: UserUtil mm = new UserUtil();
14: //mMap = mm.getModulemap();
15: //session.setAttribute( "mMap", mMap);
16: LabelValueBean[] ms =  mm.getmstr();
17: session.setAttribute( "ms", ms);
18: %>
19: <head>
Stacktrace:
    at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:93)
    at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
    at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    at java.lang.Thread.run(Thread.java:595)


请问大家这是怎么回事??
搜索更多相关主题的帖子: mutlibox  

----------------解决方案--------------------------------------------------------
  相关解决方案