Struts 里的javabean对象的大小写问题?

Javcs 2005-07-27 03:35:37
<%@ page contentType = "text/html;charset=UTF-8" language = "java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix = "bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix = "html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix = "logic" %>

<html:html locale="true">
<head>
<title><bean:message key="hello.jsp.page.heading"/></title>
<html:base/>
</head>

<body bgcolor = "Red" > <P>
<h2><bean:message key="hello.jsp.page.heading"/></h2><P>
<html:errors/><p>

<logic:present name = "personbean" scope = "request">
<h2>
<bean:message key="hello.jsp.page.hello"/>
<bean:write name="personbean" property="userName"/>!<p>
</h2>
</logic:present>

<html:form action="/HelloW.do" focus="userName">
<bean:message key="hello.jsp.prompt.person"/>
<html:text property="userName" size="16" maxlength="16"/><br>
<html:submit property="submit" value="提交"/>
<html:reset/>
</html:form><br>
<html:img page="/struts-power.gif" alt="Powered by Structs"/>
</body>
</html:html>

为什么
<h2>
<bean:message key="hello.jsp.page.hello"/>
<bean:write name="personbean" property="userName"/>!<p>
</h2>

里的javabean 必须要小写了?写成PersonBean就不能完成功能了?

...全文
82 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Javcs 2005-07-27
  • 打赏
  • 举报
回复
呵呵,不是的,自己明白了

是request.setAttribute(Constants.PERSON_KEY,pb);

PERSON_KEY = "personbean";
哎~~~
simon0512 2005-07-27
  • 打赏
  • 举报
回复
看struts-config.xml中的配置
Javcs 2005-07-27
  • 打赏
  • 举报
回复
开始编译生成的JAVA类文件名为:PersonBean,不知道这里为什么要小写成personbean~~~

81,091

社区成员

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

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