菜鸟求解答……

waterfirecrazy 2011-10-03 05:25:41
想用SSH写个列车查询,技术很菜……求指点0-0
刚开始就卡壳了……
写“车次查询”这个功能,就是输入个车次,出现该车次的始发、终点、车型,可是老是出现500错误,新手求教;
JSP:

<%@ page language="java" import="java.util.*,com.train.Model.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
TrainMain trainmain = new TrainMain();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'QTrainId.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>
<s:form action="actions/QBid.action?trainmain.tid=%{#trainmain.tid}" method="post">
<s:textfield name="trainmain.tid" label="车次"></s:textfield>
<s:submit value="查询"></s:submit>
</s:form>
</body>
</html>


Action:

package com.train.action;

import java.util.Map;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.train.Model.TrainMain;
import com.train.Model.TrainMainDAO;

public class QBidAction extends ActionSupport
{
/**
* @return the trainmain
*/
public TrainMain getTrainmain()
{
return trainmain;
}

/**
* @param trainmain the trainmain to set
*/
public void setTrainmain(TrainMain trainmain)
{
this.trainmain = trainmain;
}

/**
* @return the message
*/
public String getMessage()
{
return message;
}

/**
* @param message the message to set
*/
public void setMessage(String message)
{
this.message = message;
}

private TrainMain trainmain;
private String message;

/**
* @return
*/
public String execute() throws Exception
{
BeanFactory factory = new ClassPathXmlApplicationContext("applicationContext.xml");
TrainMainDAO dao = (TrainMainDAO)factory.getBean("TrainMainDAO");
Map request = (Map)ActionContext.getContext().get("request");

trainmain = (TrainMain) dao.findByTid(trainmain.getTid());
request.put("list", dao.findById(trainmain.getId()));

// TODO Auto-generated method stub
return SUCCESS;
}
}

list1页面:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%
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 'list1.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>
<table border="1" width="80%" align="center">
<tr>
<td>车次</td>
<td>始发</td>
<td>终点</td>
<td>车型</td>
</tr>

<s:iterator value="#request.list" id="train">
<tr>
<td>
<s:property value="#train.tid"/>
</td>
<td>
<s:property value="#train.start"/>
</td>
<td>
<s:property value="#train.over"/>
</td>
<td>
<s:property value="#train.kind"/>
</td>
</tr>
</s:iterator>


</table>
</body>
</html>


最后显示的是500错误……
The server encountered an internal error () that prevented it from fulfilling this request.
...全文
141 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
亵渎之月 2011-10-03
  • 打赏
  • 举报
回复
错误贴出来啊
waterfirecrazy 2011-10-03
  • 打赏
  • 举报
回复
揉脸…………

67,515

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧