zoukankan      html  css  js  c++  java
  • 从servlet跳到jsp页面,并用jstl 进行判断和显示方法

    以上是list集合的遍历方式

    租房网的detailsServlet

    public void doPost(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            String id=request.getParameter("id");
            IHouseDAO hd=new HouseDAO();
            House house=hd.findById(Integer.parseInt(id));
            request.getSession().setAttribute("house", house);
            request.getRequestDispatcher("page/details.jsp").forward(request, response);
            out.flush();
            out.close();
        }

    租房网的detail.jsp页面

    <c:if test="${sessionScope.house ne null}">
    <DIV class=lefter>
    <H1>${house.getTitle()}</H1>
    <div class=subinfo><div id="myclock"></div></DIV>
    <div class=houseinfo>
    <P>户  型:<SPAN>${house.getTypes().getName()}</SPAN></P>
    <P>面  积:<SPAN>${house.getFloorage()}m<SUP>2</SUP></SPAN></P>
    <P>位  置:<SPAN>${house.getStreet().getDistrict().getName()}${house.getStreet().getName()}</SPAN></P>
    <P>联系方式:<SPAN>${house.getContact()}</SPAN></P>
    </div>
    </div>
    </c:if>

    时钟的js实现

    <script type="text/javascript">
    function clock_24h()
    {
     var today = new Date(); //获得当前时间
     //获得年、月、日,Date()函数中的月份是从0-11计算
     var year = today.getFullYear();  //
     var month = today.getMonth()+1;//
     var date = today.getDate();//
     var hour = today.getHours();  //获得小时、分钟、秒
     var minute = today.getMinutes();
     var second = today.getSeconds();
     
     
      /*设置div的内容为当前时间*/
     document.getElementById("myclock").innerHTML="<h2>"+year+"-"+month+"-"+date+"&nbsp;"+hour+":"+minute+":"+second+"&nbsp;"+"</h2>";
    
    }
    /*使用setInterval()每间隔指定毫秒后调用clock_12h()*/
    var myTime = setInterval("clock_24h()",1000);
    
    </script>
  • 相关阅读:
    汇编实验程序
    javascript事件列表解说
    c#自动向网页Post信息并提取返回的信息
    C# 全半角转换
    判断 wp 是否是活跃页面
    Font Support for Windows Phone
    C# sqlite for wp7
    C#例子 易懂故事 接口 委托 事件 异步通知 好玩.
    C#用事件模式实现通知 from: http://www.cnblogs.com/guilin_gavin/archive/2011/08/18/2144397.html
    wp7 webclient 的 post 方式获取数据
  • 原文地址:https://www.cnblogs.com/jimorulang/p/5532701.html
Copyright © 2011-2022 走看看