急:无法向Bean提交值~!!

icecloud 2002-12-20 03:22:45
忙了好几天,终于配置好了IIS+Resin服务器装上了jbuilder。
然后用jbulider8写的第一个测试程序。
就是jbuilder内置的那个JBuilder Generated JSP。代码如下:
LoginBean.java
--
package works;

public class LoginBean {
private String sample = "Start value";
//Access sample property
public String getSample() {
return sample;
}
//Access sample property
public void setSample(String newValue) {
if (newValue!=null) {
sample = newValue;
}
}
}
---
login.jsp

<%@ page contentType="text/html; charset=gb2312" %>
<html>
<head>
<title>
login
</title>
</head>
<jsp:useBean id="loginBeanId" scope="session" class="works.LoginBean" />
<jsp:setProperty name="loginBeanId" property="*" />
<body bgcolor="#ffffff">
<h1>
JBuilder Generated JSP
</h1>
<form method="post" action="">
<br>Enter new value : <input name="sample"><br>
<br><br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" value="Reset">
<br>
Value of Bean property is :<jsp:getProperty name="loginBeanId" property="sample" />
</form>
</body>
</html>

执行后在jbuilder中的tomcat测试通过,程序完全正确。
在resin中执行时候,能显示得到start value,但是按Submit无法提交新的值

resion和iis的默认目录都是jbuilder产生的defaultroot
目录设定如下:
projectroot
+-- defaultroot
| +----WEB-INF
| +---classes
| +-----works
| + LoginBean.class
+ login.jsp

另外,请问如何提交给Bean中文参数?返回回来的都是乱码和问号
...全文
51 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zxhong 2002-12-20
  • 打赏
  • 举报
回复
action=""是提交给本页
csdn_search 2002-12-20
  • 打赏
  • 举报
回复
中文转换问题
public static final String readstr(String str)
{
try{
byte[] temp_t=str.getBytes("ISO8859-1");
String temp=new String(temp_t,"gb2312");
return temp;
}catch(Exception e){}
return "null";
}
public static final String writestr(String str)
{
try{
byte[] temp_t=str.getBytes("gb2312");
String temp=new String(temp_t,"ISO8859-1");
return temp;
}catch(Exception e){}
return "null";
}
icecloud 2002-12-20
  • 打赏
  • 举报
回复
我想应该是resin的配置不对吧,可是又不知道哪里不对。resin打开一般的jsp页面是没有问题的啊。
icecloud 2002-12-20
  • 打赏
  • 举报
回复
............. 顶~~
icecloud 2002-12-20
  • 打赏
  • 举报
回复
to zxhong(红) : 难道不是提交到本页吗??那如何提交给本页的Bean?
to csdn_search(世纪传人):收到!

继续关注ing...

81,091

社区成员

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

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