关于相对路径和绝对路径,懂的进 <form action="/website/forum.action" method="post">是不是也可以用<form action="forum.action" method="post">website是我的工程名 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 /就到website项目根了,不要website啊 你理解错了,website不是工程名,是eclipse给你设置的web-context自己可以修改,所以你要改成你那种形式应该是不可能得。 这个要看你的url是上面样的了。 可以。只要JSP和action在同级,如:jsp在web根目录下而action正好是/forum.action。如果级别不一样,用..找上层路径,用/找下层路径。 http://code.google.com/p/simplejee/source/browse/trunk/simplejee/WebContent/html/examples/path.html看看这个或许有点用处 lz说的第二种好像这样比较保险<%@ 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> <head>//这里要加上 <base href="<%=basePath%>"> <title>My JSP 'index.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> </body></html> <form action="${pageContext.request.contextPath}/forum.action" method="post"> 如果是struts2的话,就用标签啊,就不用管路径了,它会自动补上去<%@ taglib prefix="s" uri="/struts-tags" %>...<s:form action="forum">....</s:form> 不用这么麻烦啊 <%=request.getContentPath() %>/form.action完事 这个路径貌似是不行的, LZ输出看看吧?没有不是我们常见的localhost:8080/appName java 代码生成cer证书文件,然后可以获取公钥和私钥, jsp 与servlet 的连接 使用HP Compaq Presario 3800系列的V3814TU进行开发配置是否够用? 理论性问题:hibernate应用在复杂情况可能会大大降低性能吗 java中怎么读取.pem格式文件中的 PrivateKey java的一个问题,请大家帮下我。 struts-menu的样式显示问题,请教各位高手. 有人用过xerces的XSD验证功能么? 给点支持!! 有没有研究jmx的兄弟,大家一起交流一下。 servlet, struts的安全问题。 js动态提交到Action
自己可以修改,所以你要改成你那种形式应该是不可能得。
只要JSP和action在同级,如:
jsp在web根目录下
而action正好是/forum.action。如果级别不一样,用..找上层路径,用/找下层路径。
//这里要加上
<%
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 'index.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>
</body>
</html>
...<s:form action="forum">
....
</s:form>
不用这么麻烦啊 <%=request.getContentPath() %>/form.action完事