1、product.jsp文件部分代码(可以只看红色部分):
function del() {
var id= document.getElementsByName("id");
if(checkCheckboxIsSelected(id,"请选择要删除的商品!")){
if(window.confirm('确定要删除么?')==true){
document.getElementById("fom").action = "<%=request.getContextPath()%>/product.do?method=delProduct";
document.getElementById("fom").submit();
}
}
}
2、web.xml文件:
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
3、struts-config.xml文件:
<action-mappings>
<action name="uploadForm" path="/product" type="com.example.redbaby.action.ProductAction" parameter="method" scope="request">
<forward name="toList" path="/jsp/product_list.jsp"/>
<forward name="toListAction" path="/product.do?method=toList" redirect="true"/>
<forward name="toEdit" path="/jsp/product_edit.jsp"/>
</action>
</action-mappings>
跪求各位大婶!
问题:1、"<%=request.getContextPath()%>/product.do?method=delProduct";访问的路径详细的过程是怎么样的呢?
为什么不是这样的呢?
2、为什么这样能访问到ProductAction类里面呢?