unclever 2011-01-13 22:01
浏览 1278
已采纳

jsp页面,点击了提交按钮,没反应,跳转不到action

用SSH2在搭一个网站,出现一个jsp页面无法跳转到action。 麻烦大家帮忙看看

[code="java"]
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">



维护单资料


<body>
    <!--标题-->
    <div id="title">
        <div id="font">
            <div id="task">
                维护单资料
            </div>
        </div>
    </div>
    <!--查询
公司编号:
公司名称:


-->


<!--按钮-->



onClick="javascript:window.location.href='Fmcf2050.jsp'"
target="ab">




            </div>
            <!--分页-->
            <div id="pagination">

            </div>
            <!--下面主体-->
            <div id="underside"
                style="height: expression(body .     offsetHeight-80);">
                <!--空白间隔-->
                <!--表格-->
                <div id="mostly">

                    <table width="200" border="1" id="table" class="tab">
                        <tr>
                            <td width="30%" class="td_right">
                                设备编号:
                            </td>
                            <td width="70%" class="td_left">
                                <input type="text" name="equipmentID">
                            </td>
                        </tr>
                        <tr>
                            <td class="td_right">
                                报修人员:
                            </td>
                            <td class="td_left">
                                <input type="text" name="client">
                            </td>
                        </tr>
                        <tr>
                            <td class="td_right">
                                报障时间:
                            </td>
                            <td class="td_left">
                                <input type="text" name="submitTime">
                            </td>
                        </tr>
                        <tr>
                            <td class="td_right">
                                报障部门:
                            </td>
                            <td class="td_left">
                                <select name="department">
                                    <option value=""></option>
                                    <option value="chuyun">
                                        储运车间
                                    </option>
                                    <option value="tieban">
                                        铁板车间
                                    </option>
                                    <option value="duxin">
                                        镀锌车间
                                    </option>
                                    <option value="tieta">
                                        铁塔车间
                                    </option>
                                    <option value="gangguanta">
                                        钢管塔车间
                                    </option>
                                    <option value="guanta">
                                        管塔二车间
                                    </option>
                                    <option value="bangongshi">
                                        办公室
                                    </option>
                                    <option value="renshi">
                                        人事部
                                    </option>
                                    <option value="caiwu">
                                        财务部
                                    </option>
                                    <option value="caigou">
                                        采购部
                                    </option>
                                    <option value="yingxiao">
                                        营销部
                                    </option>
                                    <option value="houqin">
                                        后勤部
                                    </option>
                                    <option value="anjian">
                                        安监部
                                    </option>
                                    <option value="zhiguan">
                                        质管部
                                    </option>
                                    <option value="qiye">
                                        信息部
                                    </option>
                                    <option value="shengchan">
                                        生产调度部
                                    </option>
                                    <option value="jishu">
                                        技术设备部
                                    </option>
                                    <option value="dangqun">
                                        党勤工作部
                                    </option>
                                    <option value="qiye">
                                        企业管理部
                                    </option>

                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td class="td_right">
                                维护类型:
                            </td>
                            <td class="td_left">
                                <select name="repairType">
                                    <option value=""></option>
                                    <option value="systemFailure">
                                        系统故障
                                    </option>
                                    <option value="newLine">
                                        增加网线
                                    </option>
                                    <option value="networkFailure">
                                        网络故障
                                    </option>
                                    <option value="softwareFailure">
                                        软件故障
                                    </option>
                                    <option value="softwareInstall">
                                        安装新软件
                                    </option>
                                    <option value="printerFailure">
                                        打印机故障
                                    </option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td class="td_right">
                                故障表征:
                            </td>
                            <td class="td_left">
                                <textarea name="mainContent" cols="1" rows="5"
                                    style="width: 200px;"></textarea>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </form>
    </div>
</body>

[/code]

对应的ApplyAction 代码是这样:
[code="java"]
package com.demo.struts2.actions;

import java.util.ArrayList;

import com.demo.hibernate.dao.ApplyDAO;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class ApplyAction extends ActionSupport {

private ApplyDAO applyDAO=new ApplyDAO();  // 这个bean属性前千万不能缺少;
private int listID;
private String client;
private String name;
private String department;
private String deviceType;
private String equipmentID;
private String deviceModle;
private String mainContent;
private String repairType;
private String submitTime;
private String finishTime;
private String repairman;
private String isSigned;
private boolean mark=true;
public void isOK(String s){

}
@Override

public void validate() {
    // TODO Auto-generated method stub
    //申请进行维修要验证。
    System.out.println("applyAction验证了");


}

@Override
public String execute() throws Exception {
    System.out.println("applyAction执行");
    // TODO Auto-generated method stub
    if(this.mark==false){
        return Action.INPUT;
    }
    return Action.SUCCESS;
}

public String insert(){
    System.out.println("插入新的维修申请单");
    ArrayList<String> list=new ArrayList<String> ();
    list.add(client);
    list.add(department);
    list.add(deviceType);
    list.add(equipmentID);
    list.add(deviceModle);
    list.add(mainContent);
    list.add(repairType);
    list.add(submitTime);
    list.add(repairman);
    list.add(isSigned);
    //当出现一个填写项为空就不行。
    for(String s:list){
        if(s.equals("")||s==null){
            this.mark=false;
            break;
        }else{
            System.out.println(s);
        }
    }
    if(!mark){
        return Action.ERROR;
    }

    return "";
}

public ApplyDAO getApplyDAO() {
    return applyDAO;
}

public void setApplyDAO(ApplyDAO applyDAO) {
    this.applyDAO = applyDAO;
}

public int getListID() {
    return listID;
}

public void setListID(int listID) {
    this.listID = listID;
}

public String getClient() {
    return client;
}

public void setClient(String client) {
    this.client = client;
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public String getDepartment() {
    return department;
}

public void setDepartment(String department) {
    this.department = department;
}

public String getDeviceType() {
    return deviceType;
}

public void setDeviceType(String deviceType) {
    this.deviceType = deviceType;
}

public String getEquipmentID() {
    return equipmentID;
}

public void setEquipmentID(String equipmentID) {
    this.equipmentID = equipmentID;
}

public String getDeviceModle() {
    return deviceModle;
}

public void setDeviceModle(String deviceModle) {
    this.deviceModle = deviceModle;
}

public String getMainContent() {
    return mainContent;
}

public void setMainContent(String mainContent) {
    this.mainContent = mainContent;
}

public String getRepairType() {
    return repairType;
}

public void setRepaitType(String repairType) {
    this.repairType = repairType;
}

public String getSubmitTime() {
    return submitTime;
}

public void setSubmitTime(String submitTime) {
    this.submitTime = submitTime;
}

public String getFinishTime() {
    return finishTime;
}

public void setFinishTime(String finishTime) {
    this.finishTime = finishTime;
}

public String getRepairman() {
    return repairman;
}

public void setRepairman(String repairman) {
    this.repairman = repairman;
}

public String getIsSigned() {
    return isSigned;
}

public void setIsSigned(String isSigned) {
    this.isSigned = isSigned;
}

}
=[size=large][/size]
[/code]

  • 写回答

1条回答 默认 最新

  • laonie1234 2011-01-13 22:06
    关注


    换成

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ansys fluent计算闪退
  • ¥15 有关wireshark抓包的问题
  • ¥15 需要写计算过程,不要写代码,求解答,数据都在图上
  • ¥15 向数据表用newid方式插入GUID问题
  • ¥15 multisim电路设计
  • ¥20 用keil,写代码解决两个问题,用库函数
  • ¥50 ID中开关量采样信号通道、以及程序流程的设计
  • ¥15 U-Mamba/nnunetv2固定随机数种子
  • ¥15 vba使用jmail发送邮件正文里面怎么加图片
  • ¥15 vb6.0如何向数据库中添加自动生成的字段数据。