⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tempconvert1.jsp

📁 这是另一部分..只是供大家参考下拉..到时候有什么不明白的可以
💻 JSP
字号:
<!-- tempconvert1.jsp 
     A document that collects a Celsius temperature from a
     client and uses a scriptlet to convert it to Fahrenheit
     -->

<html xmlns = "http://www.w3.org/1999/xhtml">
  <head>
    <title> Temperature converter </title>
  </head>
  <body>
    <p>
      <%

// Get the Celsius temperature from the form 

         String strCtemp = request.getParameter("ctemp");
         float ftemp;

// If this is not the first request (there was a form value),
// convert the value to Fahrenheit
if (strCtemp != null) {  
           ftemp = 1.8f * Integer.parseInt(strCtemp) + 32.0f;
       %>

<!-- Use an expression to display the value of the 
     Fahrenheit temperature -->

     Fahrenheit temperature:

       <%= ftemp %>

<!-- Code for the end of the then clause compound 
     statement -->

       <%
         }  //** end of if (strCtemp != ...
         else {
       %>

<!-- This is the first request, so display the form
     to collect the Celsius temperature -->

       <form action = "tempconvert1.jsp" method = "get" >
         Celsius temperature: 
         <input type = "text" name = "ctemp" />
         <input type = "submit" />
       </form>
     </p>

<!-- Code for the end of the else clause compound
     statement -->

     <%
         } //** end of else clause
     %>
  </body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -