码迷,mamicode.com
首页 > 其他好文 > 详细

个人提问模块

时间:2015-06-29 06:12:26      阅读:91      评论:0      收藏:0      [点我收藏+]

标签:

个人提问功能

1提问模块:

技术分享

代码:

<body >
     <div id="bg" style="position:absolute; width:100%; height:100%; z-index:-1"> 
        <img src="img/tools25.gif" height="100%" width="100%" >
     </div>
     <div id="mq" >
        <form id="mqform" action="<%=basePath%>AddMessageServlet" method="get" >
        <br>
                      问题类型:<select name="classify" size="1">
                                               <option value="软件工程">软件工程</option>
                                               <option value="数据挖掘">数据挖掘</option>
                                               <option value="嵌入式操作系统">嵌入式操作系统</option>
                                               <option value="EDA技术与应用">EDA技术与应用</option>
                                               <option value="Linux">linux语言</option>
                                               <option value="大型数据库">大型数据库</option>              
                                       </select><br><br>
                    留   言   者:<input type="text" name="author" size="20"><br><br>
                          留言标题:<input type="text" name="topic" size="50">
                    <p id="matter" align="left">   内   容:</p>  <textarea id="matterright" name="mainbaby" rows="8" cols="70" >
                                     </textarea><br>
             
             <p id="mqp">
               <input type="submit" value="提交" >  <input type="reset" value="重置">   
             <a href="dealing/showMessage.jsp">查看留言</a></p>
        </form>
      </div>
  </body>

  

2.显示提问模块:

技术分享

代码:

 <body>
  
        <%
          String userName =(String)session.getAttribute("userName");
            if(userName==null) {
                String msg="请先登陆账户!";
                int type=JOptionPane.YES_NO_CANCEL_OPTION;
                String title="信息提示";
                JOptionPane.showMessageDialog(null, msg, title, type);
                response.sendRedirect("tishi.jsp");
            }else {
          Connection con=null;
          Statement stmt=null;
          ResultSet rs=null;
          String author;
          String topic;
          int i=0;
          Class.forName("com.mysql.jdbc.Driver");
          String url="jdbc:mysql://localhost:3306/learning?useUnicode=true&characterEncoding=gbk";
          con=DriverManager.getConnection(url,"root","root");
          stmt=con.createStatement();
          String query="select distinct * from showframe where author=‘"+userName+"‘ ";
          rs=stmt.executeQuery(query);
          %>
    <table align="center" width="100%" border="1">
        <tr background="#22dcff" >
            <th>编号</th>
            <th>类型</th>
            <th>主题</th>
            <th>回复</th>
            <th>操作</th>
        </tr>
          <%
          while(rs.next()){  
          author=rs.getString("author");
          topic=rs.getString("topic"); 
          i++; 
           %>
          <tr height="40" >
              <td align="center"><%=i %></td>
              <td align="center"><%=rs.getString("classify") %></td>
              <td align="center"><a href="dealing/response.jsp?author=<%=author%>&topic=<%=topic%>"><%=topic%></a></td>
              <td align="center"><%=rs.getString("total")%></td>
              <td align="center"><a href="dealing/delete.jsp?author=<%=author%>&topic=<%=topic%>">删除</a></td>
          </tr>
          <%
            }
            }
           %>
     </table>
  </body>

  

个人提问模块

标签:

原文地址:http://www.cnblogs.com/fellerlong/p/4606422.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!