我的页面 是
tiaojia.jsp
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<%
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Expires", "0");
String path=request.getContextPath();
%>
<%@ include file="/taglibs.jsp"%>
<%@ include file="/checkSession.jsp"%>
<html>
  <head>
    <title>加中科技医院信息系统</title>
    <link href="inc/style.css" rel="stylesheet">
  </head>
  <body >
  <form action="tiaojiaAction.do" method="post"> 
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" height="100" class="tableborder">
    <tr>
    <th class="th" height="30" colspan="7">调价盈亏统计</th>
    </tr>
    <tr align="center">
    <td class="row" height="30" >时间段:</td>
    <td class="row" height="30" ><input name="timefrom" type="text" style="width:100px">至</td>
    <td class="row" height="30" ><input  name="timeto" type="text" style="width:100px"></td>
    <td class="row" height="30" >消耗品名称:</td>
    <td class="row" height="30" ><input name="customername" type="text" style="width:100px"></td>
   
    </tr>
    <tr align="center">
    <td class="row" height="30" >消耗品分类:</td>
    <td class="row" height="30">
<select  name="customersort"  style="width:100px"  >

  <option value="xiyao" selected="selected">xiyao</option>
  </select>
</td>
<td class="row" height="30">
<input type="submit" name="Submit" value="统计" />
</td>
<td class="row" height="30">
<input type="submit" name="Submit" value="统计全部" />
</td>
<td  class="row" height="30">
<input type="submit" name="Submit" value="打印" />
</td>
    </tr>
   
    <tr>
    <td colspan="7">
    <table align=center border="0"  cellspacing="1" cellpadding="0" class="tableborder" width="100%">
    <tr align="center">
    <td class="th" height="30" >调价日期</td>
    <td class="th" height="30" >名称</td>
    <td class="th" height="30" >规格</td>
    <td class="th" height="30" >厂家</td>
    <td class="th" height="30" >单位</td>
    <td class="th" height="30" >调价数量</td>
    <td class="th" height="30">原零售价</td>
    <td class="th" height="30" >零售金额</td>
    <td class="th" height="30" >现零售价</td>
    <td class="th" height="30" >零售金额</td>
    <td class="th" height="30" >调价盈亏</td>
    </tr>
    <logic:present name="list">
<logic:iterate id="element" name="list">
    <tr align="center">
    <td class="row" height="30" ><bean:write name='element' property='timefrom'/></td>
    <td class="row" height="30" ><bean:write name='element' property='timeto'/></td>
    <td class="row" height="30" ><bean:write name='element' property='customername'/></td>
    <td class="row" height="30" ><bean:write name='element' property='customername'/></td>
    <td class="row" height="30" ><bean:write name='element' property='customersort'/></td>
    <td class="row" height="30" ><bean:write name='element' property='customersort'/></td>
    <td class="row" height="30" ><bean:write name='element' property='customersort'/></td>
    <td class="row" height="30" ><bean:write name='element' property='customername'/></td>
    <td class="row" height="30" ><bean:write name='element' property='timefrom'/></td>
    <td class="row" height="30" ><bean:write name='element' property='customersort'/></td>
    <td class="row" height="30" ><bean:write name='element' property='timefrom'/></td>
    </tr>
    </logic:iterate>
</logic:present>
    </table>
    </td>
    </tr>
    </table>
    </form>
  </body>
</html>
我的struts的配置文件是<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"><struts-config>
  <data-sources />
  <form-beans >
    <form-bean name="userloginForm" type="com.cader.web.form.UserloginForm" />
    <form-bean name="tiaojiaForm" type="com.cader.web.form.TiaojiaForm" />
  </form-beans>  <global-exceptions />
  <global-forwards >
   <forward name="sessionFailure" path="/checkSession.jsp" />
  </global-forwards>
  <action-mappings >
    <action attribute="userloginForm" input="/userlogin.jsp" name="userloginForm" parameter="modelname" path="/userlogin" scope="request" type="org.springframework.web.struts.DelegatingActionProxy">
      <forward name="success" path="/h_index.jsp" />
      <forward name="failure" path="/userlogin.jsp" />
      <forward name="info" path="/information.jsp" />
    </action>
    <action path="/modleflagFind" type="org.springframework.web.struts.DelegatingActionProxy">
      <forward name="menuGo" path="/menu.jsp" />
      <forward name="failGo" path="/fail.jsp" />
    </action>
    
     <action input="/tiaojia.jsp" name="tiaojiaForm" path="/tiaojiaAction" scope="request" type="org.springframework.web.struts.DelegatingActionProxy" validate="true">
       <forward name="success" path="/tiaojia.jsp" />
      <forward name="failure" path="/failure.jsp" />
    </action>
    
     </action-mappings>  <message-resources parameter="ApplicationResources" />
  
  <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
    <set-property property="contextConfigLocation" value="/WEB-INF/applicationContextT.xml,/WEB-INF/applicationContextB.xml,/WEB-INF/applicationContextA.xml,/WEB-INF/applicationContextF.xml,/WEB-INF/applicationContextC.xml,/WEB-INF/applicationContextE.xml,/WEB-INF/applicationContextD.xml,/WEB-INF/applicationContextG.xml,/WEB-INF/applicationContextX.xml,/WEB-INF/applicationContextH.xml,/WEB-INF/applicationContext.xml"/>
  </plug-in>
</struts-config>

解决方案 »

  1.   

    显示http://localhost:8080/chis/tiaojiaAction.do
      

  2.   

    <form action="tiaojiaAction.do" method="post"> 改为:
    <form action="/tiaojiaAction.do" method="post">
      

  3.   

    这样就报错,说是请求的action不可用。怎么回事啊?
      

  4.   

    那说明你原来那种写法是对的,至少找到action了。
    你的后台就没有什么错误提示信息?
      

  5.   

    <form action="tiaojiaAction.do" method="post"> 
    --》
    <html:form action="tiaojiaAction.do" method="post"> 
    <form action="/你的应用工程名称/tiaojiaAction.do" method="post">
      

  6.   

    既然是struts就用标签
    <html:form action="/tiaojiaAction">
      

  7.   

    那对了,那我action怎么接收不到jsp页面上的值呢?
    我的TiaojiaAction.java的代码
    /*
     * Generated by MyEclipse Struts
     * Template path: templates/java/JavaClass.vtl
     */
    package com.cader.web.action;import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;import com.cader.business.SelectTiaojiaInterface;
    import com.cader.web.form.TiaojiaForm;import java.util.List;
    /** 
     * MyEclipse Struts
     * Creation date: 03-27-2007
     * 
     * XDoclet definition:
     * @struts.action validate="true"
     * @struts.action-forward name="success" path="/tiaojia.jsp"
     * @struts.action-forward name="failure" path="/failure.jsp"
     */
    public class TiaojiaAction extends Action {
    /*
     * Generated Methods
     */
    SelectTiaojiaInterface tiaojiaBean=null; public void setTiaojiaBean(SelectTiaojiaInterface tiaojiaBean) {
    this.tiaojiaBean = tiaojiaBean;
    } /** 
     * Method execute
     * @param mapping
     * @param form
     * @param request
     * @param response
     * @return ActionForward
     */
    String timefrom=null;
    String timeto=null;
    String customername=null;
    String customersort=null;
    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response) 
    {
    // TODO Auto-generated method stub
    try{
    System.out.println("11111111111111111111111111111111111111111111111111111111111111111111111111111111");
    TiaojiaForm tiaojiaForm=(TiaojiaForm)form;
     timefrom=new String(tiaojiaForm.getTimefrom().getBytes("iso8859-1"),"GB2312");
     timeto=new String(tiaojiaForm.getTimeto().getBytes("iso8859-1"),"GB2312");
     customername=new String(tiaojiaForm.getCustomername().getBytes("iso8859-1"),"GB2312");
    customersort=new String(tiaojiaForm.getCustomersort().getBytes("iso8859-1"),"GB2312");
    }
    catch (Exception e){}
            System.out.println("启始时间是:"+timefrom);
            System.out.println(timeto);
            System.out.println(customername);
            System.out.println(customersort);
    List result= this.tiaojiaBean.doselectTiaojia(timefrom,timeto,customername,customersort);

    if((result==null)||(result.size()==0))
     {
     return mapping.findForward("failue");
     }
     else
       {
     request.setAttribute("list", "result");
     return mapping.findForward("success");
       }


      
    }
    }
      

  8.   

    jsp页面使用struts的标签才能使用Struts的form传递数据
    <html:form action="/tiaojiaAction.do">
    <html:text property="timefrom"/>
    ....
    </html:form>
      

  9.   

    如果不用<html:form>用的是html的<form>后台接收数据的应该用
    String timefrom = request.getParameter("timefrom");
      

  10.   

    你们说我的action怎么没打印出这个值,看起来action就没执行啊??
    11111111111111111111111111111111111111111111111111111111111111111111111111111111
      

  11.   

    恩,楼上的不是已经说的很清楚了吗,
    如果不用<html:form>用的是html的<form>后台接收数据的应该用
    String timefrom = request.getParameter("timefrom");
    在Action里面直接接收ActionForm的话就要把标签改了,不改就如上面的了,
      

  12.   

    <form action="tiaojiaAction.do" method="post"> 改成
    ====>
    <html:form action="tiaojiaAction.do">
    不行吗?
      

  13.   

    终于解决了,谢谢各位了,
    在页面 上用普通的标签就行,也能往action里面传,我就吧action里的Form 该成了actionForm。
    就ok了,还是谢谢各位了
      

  14.   

    你好,我的action压根没执行过,给点经验