jsp最基本的问题

dxhhhbbb 2004-09-13 11:56:26
我写了一个test3.htm文件
和一个test2.jsp文件

test3.htm
<body>
<form name="form1" method="post" action="Text2.jsp">
<input name="Text1" type="text" id="Text1">
<input type="submit" name="Submit" value="提交">
</form>

</body>

test2.jsp
<%

String str1=request.getParameter(Text1);
out.println(str1);
%>

Text2.jsp提示:description The requested resource (/Text2.jsp) is not available.
我以前用Asp,现在想用一下Jsp,怎么回事呢?请高手赐教


...全文
136 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
power17 2004-09-13
  • 打赏
  • 举报
回复
你提交的页面错了,是text2.jsp。这个一定要注意。

java大小写区分,就连文件夹都要注意,经常用给文件夹用小写字母命名,不然以后带来的

麻烦可不小啊。至于文件名就更不用说了。
sandsworlf 2004-09-13
  • 打赏
  • 举报
回复
<form name="form1" method="post" action="Text2.jsp">

test2.jsp
<%

String str1=request.getParameter(Text1);
out.println(str1);
%>
jsp中的代码是区分大小写的,你的action="Text2.jsp"
你的test2.jsp的名称改为 Text2.jsp就可以了.
JeromeLiu 2004-09-13
  • 打赏
  • 举报
回复
error1:

<form name="form1" method="post" action="Text2.jsp">
--
提交到Text2.jsp与test2.jsp不一,文件名字要一致,而且还需要注意大小写。

error2:
String str1=request.getParameter(Text1);
参数应该是"Text1"

apicescn 2004-09-13
  • 打赏
  • 举报
回复
其中有两个地方错误:
  第一:String str1=request.getParameter(Text1);
应该修改为:
String str1=request.getParameter("Text1");

第二:<form name="form1" method="post" action="Text2.jsp">中提交的是Text2.jsp
那么你那个test2.jsp就应该改命名为Text2.jsp或者将<form name="form1" method="post" action="Text2.jsp">修改为<form name="form1" method="post" action="test2.jsp">
即可,这是细节上一些的问题,你注意一下大小写以及文件名称。
farmer0512 2004-09-13
  • 打赏
  • 举报
回复
action="Text2.jsp" ? 还是test2.jsp?

还有,JSP容器区分大小写,文件名的大小写,
闷头挣钱 2004-09-13
  • 打赏
  • 举报
回复
失败,居然没有看到代码得错误,^_^
yunxiang 2004-09-13
  • 打赏
  • 举报
回复
因该双引号。
yunxiang 2004-09-13
  • 打赏
  • 举报
回复
String str1=request.getParameter("Text1");
miaoliujun 2004-09-13
  • 打赏
  • 举报
回复
你的jsp文件位置对不?
你直接敲jsp的地址也应该不可以访问吧?
如果可以访问,那就是html和jsp不在一个级别里
闷头挣钱 2004-09-13
  • 打赏
  • 举报
回复
出现这个提示好像是你的jsp文件名不对(注意大小写)或者你的目录配置得不正确
gumplei 2004-09-13
  • 打赏
  • 举报
回复
第一:String str1=request.getParameter(Text1);
应该修改为:
String str1=request.getParameter("Text1");


第二:你提交的目录是<form name="form1" method="post" action="Text2.jsp">中的Text2.jsp,改为test2.jsp!
syh55555 2004-09-13
  • 打赏
  • 举报
回复
第一:String str1=request.getParameter(Text1);
应该修改为:
String str1=request.getParameter("Text1");


第二:你提交的目录是<form name="form1" method="post" action="Text2.jsp">中的Text2.jsp,改为test2.jsp!

我以测是正确
AHUA1001 2004-09-13
  • 打赏
  • 举报
回复
补充一点,那个错误提示是提交后,找不到提交的目标页,也就是找不到Text2.jsp。
AHUA1001 2004-09-13
  • 打赏
  • 举报
回复
楼主老大,拜托!能不能仔细点?
你提交的目录是<form name="form1" method="post" action="Text2.jsp">
也就是Text2.jsp,而你接收的页名字是test2.jsp!
不说大小写的问题也不对啊!
这个错误太低级了!

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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