读书人

大家来看看这个有关问题是出在页面下

发布时间: 2012-10-26 10:30:59 作者: rapoo

大家来看看这个问题,是出在页面上还是配置文件上
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

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

<title>景点添加</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>
<center>

景点添加
<form action="<%=path %>/scenery/scenicAdd.action" enctype="multipart/form-data" method="post">
<table style="text-align: center">
<tr>
<td> 景点名称</td>
<td> <input type="text" name="scenery.sname"/></td>
</tr>
<tr>
<td> 交通信息</td>
<td> <input type="text" name="scenery.strafficInfo"/></td> </tr>
<tr>
<td> 景点设施</td>
<td> <input type="text" name="scenery.sfacility"/></td>
</tr>
<tr>
<td> 景点主题</td>
<td> <input type="text" name="scenery.stheme"/></td>
</tr>
<tr>
<td> 景点星级</td>
<td> <input type="text" name="scenery.slevel"/></td></tr>
<tr>
<td> 鹏运价格</td>
<td> <input type="text" name="scenery.spyPrice"/></td>
</tr>
<tr>
<td> 市场价格</td>
<td> <input type="text" name="scenery.smarketPrice"/></td></tr>
<tr>
<td> 景点描述</td>
<td> <textarea name="sdescription" style="height: 100px; width: 200px;"></textarea></td>
<tr>
<td> 景点图片</td>
<td> <input type="file" name="img"/></td>
</tr>
<td colspan="2">
<input type="submit" value="提交">
<input type="reset" value="重置"/>
</td>
</table>
</form>
${message}
</center>
</body>
</html>
以上是JSP页面

<action name="scenicAdd" class="SceneryListAction" method="scenicAdd">


<interceptor-ref name="fileUpload">
<param name="allowedTypes">image/bmp,image/png,image/gif,image/pjpeg</param>
</interceptor-ref>
<interceptor-ref name="defaultStack">
<param name="savePath">fileupload/</param>
</interceptor-ref>
<result name="success">/page/background/scenic/scenicAdd.jsp</result>
<result name="input">/page/background/scenic/scenicAdd.jsp</result>
</action>
以上是Struts2配置


<bean id="sceneryDao" class="com.pengyun.dao.impl.SceneryDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="sceneryService" class="com.pengyun.service.impl.SceneryServiceImpl">
<property name="sceneryDao" ref="sceneryDao"></property>
</bean>
<bean id="SceneryListAction" class="com.pengyun.action.SceneryAction">
<property name="sceneryService" ref="sceneryService"></property>
</bean>

Spring管理配置,



问题是,在前台点击submit,跳转不到Action中,打了断点。而且Dbug模式。另外,浏览器和myeclipse都没有异常信息,配置文件我也看了很多遍,,但是还是没看出来问题所在,希望大家帮帮忙啊,调好了给分

[解决办法]
打了断点,停在哪呢?

你可以通过删减可疑或不必要代码来进行减量测试
[解决办法]
你点提交的时候是报错action没找到么?还是其他?
form 的action直接=scenicAdd.action看看吧
[解决办法]
没有报异常可能说明已经成功跳转过action了,楼主struts配置文件中的这句:

<result name="success">/page/background/scenic/scenicAdd.jsp</result>

你返回SUCCESS还返回添加页面,这能看出来啥啊。。。。

读书人网 >Java Web开发

热点推荐