1.     一个静态网页: input.html
(1)   两个输入框:一个输入 x, 一个输入 y(2)   一个提交按钮(3)   一个显示区域提交后,调用 calc.jsp, 计算 100*x-3*y 的结果,并把结果输出到显示区域2.     一个动态网页: calc.jsp
获取 input.html 的输入值x,y计算后,将结果输出
我写好了 也处理完了就是不知道怎么吧处理后的结果传给html页面了
帮帮忙吧

解决方案 »

  1.   

    如果计算在server端计算的,你可以用setAttribute把结果告诉client端
    或者直接往out上写也行如果是client端计算的,那就用javascript显示
      

  2.   

    是在服务器端计算然后返回到客户端
    而且一个是HTML页面一个是JSP页面
    在静态页面不能用request.getAttribute吧?
      

  3.   

    把结果放到表单里,提交到html,跟从html提交到jsp一样的
      

  4.   

    我用ajax做了
    我对AJAX的理解不是很深刻
    用的不熟
    我写完一提交
    他就显示第二个页面
    值怎么都不出现在第一个页面里
    郁闷!!!
      

  5.   

    在第一个页面加一个iframe,把第二个页面放进去,OK.
    html不具备读取request的功能吧~
      

  6.   

    input.html:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <title>input.html</title>

        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="this is my page">
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        
        <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->  </head>
      
      <body>
      <form action="/webTest/calc.jsp" method="post">
        <input type="text" id="x" name="x" value="x"><br>
        <input type="text" id="y" name="y" value="y"><br>
        <input type="submit" value="submit" name="submit">
        </form>
      </body>
    </html>calc.jsp:<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
    + request.getServerName() + ":" + request.getServerPort()
    + path + "/";
    %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <base href="<%=basePath%>"> <title>My JSP 'calc.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    --> </head> <body>
    <%
    long x = new Long(request.getParameter("x"));
    long y = new Long(request.getParameter("y"));
    long z = 100 * x - 3 * y;
    %>
    result is: 
    <%=z%>.
    <br>
    </body>
    </html>
      

  7.   

    先吧z这个值request.setAttribute
    然后让他自动跳转response.setHeader("refresh","秒数;url")
    带那个区域用${}显示出来
    呵呵~~我是初学者~
      

  8.   

    如果要出结果的话,JavaScript不是更快么?
      

  9.   

    一个Action就可以解决了! 把页面参数提交给Action 然后处理下 setAttribute里 然后在页面里接受下显示即可!如 request.setAttribute("result",result)-----jsp
    ${requestScope.result}---ok