You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "G.L. Grobe" <ga...@grobe.org> on 2001/04/24 06:17:35 UTC

struts accessing bean:message tags from somewheres

How can I still get the following error if I've commented all my
<bean:message tags out from the below file? It still says key not found and
w/ these tags commented, it shouldnt' even try to pull a key, correct? I do
a println on the resource below to see that i'm getting the correct resource
file.

500 Internal Server Error
javax.servlet.jsp.JspException: Missing message for key main.title at
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:242) at
/index.jsp._jspService(/index.jsp.java:159) (JSP page line 133) at
com.orionserver[Orion/1.4.8 (build 10374)].http.OrionHttpJspPage.service

Any ideas/help appreciated.

----------------- my index.jsp --------------------------

 <%@ page language="java" %>
<%@ taglib uri="WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="WEB-INF/struts-bean.tld" prefix="bean" %>

<html:html>
<head>

<title>
   <!-- bean:message key="main.title" /-->
</title>

<%@ include file="menubar.js" %>
<%@ include file="main.css" %>

</head>

<body bgcolor="white">
<html:errors/>

<%
   System.out.println("HERE ... " +
this.getClass().getClassLoader().getResource("cais.properties"));    // ...
this show's i'm accessing the right *.properties file
%>

<%@ include file="header.jsp" %>
<%@ include file="mainMenu.jsp" %>

<html:form action="view.do">

<table border="0" cellspacing="2" cellpadding="0" align="left">
   <tr>
      <td>
         <html:radio property="view" value="Master View">
         <!-- bean:message key="main.master" / -->&nbsp;
         </html:radio>
      </td>
      <td>
         <html:radio property="view" value="Details View">
         <!-- bean:message key="main.detail" / -->
         </html:radio>
      </td>
      <td>
         <center>
         <html:submit value="View"/>
         </center>
      </td>
   </tr>
</table>

</html:form>

<br> <br> <br> <br> <br>
<%@ include file="footer.jsp" %>

</body>
</html:html>


Re: its very strange.

Posted by Jean-Noel Ribette <je...@improve.fr>.
This is due to the javabean convention. If the method name begins with two uppercase letters, the property name is the
same as the method name.
For example getXXX() => property XXX.
                    getXxX() => xxX

There are more messages about this problem on the mail archives.

Jean-Noël

----- Original Message -----
From: alex <zh...@alegria.co.jp>
To: <st...@jakarta.apache.org>
Sent: Tuesday, April 24, 2001 6:56 AM
Subject: its very strange.


> hello all.
>
> i found a problem, i am not sure whether its a bug in struts.
> but i really dont understand why this happened.
>
> i created one bean which extended from ActionForm named as ProfileForm.
> and one variable named as "fName"
>
> class final class ProfileForm extends ActionForm {
> private String fName;
>
> public void setFName(String fName) {
>    this.fName = fName;
>  }
>
> public String getFName() {
>    return this.fName;
>  }
> }
>
> i got the following error message when i try to access fName property in jsp
> .
> "javax.servlet.jsp.JspException: No getter method for property fName of bean
> org.apache.struts.taglib.html.BEAN"
>
>
> buf if i change the property name to selfName,  there are no such kind
> problem.
> i am confused.
>
> thank in advance.
>
> redbeebird
>
>
>


its very strange.

Posted by alex <zh...@alegria.co.jp>.
hello all.

i found a problem, i am not sure whether its a bug in struts.
but i really dont understand why this happened.

i created one bean which extended from ActionForm named as ProfileForm.
and one variable named as "fName"

class final class ProfileForm extends ActionForm {
private String fName;

public void setFName(String fName) {
   this.fName = fName;
 }

public String getFName() {
   return this.fName;
 }
}

i got the following error message when i try to access fName property in jsp
.
"javax.servlet.jsp.JspException: No getter method for property fName of bean
org.apache.struts.taglib.html.BEAN"


buf if i change the property name to selfName,  there are no such kind
problem.
i am confused.

thank in advance.

redbeebird



RE: struts accessing bean:message tags from somewheres

Posted by Abraham Kang <ab...@infogain.com>.
Hi G.L.,

   I don't know if this helps but can you do a global search for all
*.properties files on the classpath (including your web-app classpaths) and
put main.title in them.  I have a feeling Orion is reading the wrong
*.properties file on your system.

Good Luck,
Abraham

> -----Original Message-----
> From: G.L. Grobe [mailto:gary@grobe.org]
> Sent: Monday, April 23, 2001 9:18 PM
> To: struts-user@jakarta.apache.org
> Subject: struts accessing bean:message tags from somewheres
>
>
> How can I still get the following error if I've commented all my
> <bean:message tags out from the below file? It still says key not
> found and
> w/ these tags commented, it shouldnt' even try to pull a key,
> correct? I do
> a println on the resource below to see that i'm getting the
> correct resource
> file.
>
> 500 Internal Server Error
> javax.servlet.jsp.JspException: Missing message for key main.title at
> org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.jav
> a:242) at
> /index.jsp._jspService(/index.jsp.java:159) (JSP page line 133) at
> com.orionserver[Orion/1.4.8 (build 10374)].http.OrionHttpJspPage.service
>
> Any ideas/help appreciated.
>
> ----------------- my index.jsp --------------------------
>
>  <%@ page language="java" %>
> <%@ taglib uri="WEB-INF/struts-html.tld" prefix="html" %>
> <%@ taglib uri="WEB-INF/struts-bean.tld" prefix="bean" %>
>
> <html:html>
> <head>
>
> <title>
>    <!-- bean:message key="main.title" /-->
> </title>
>
> <%@ include file="menubar.js" %>
> <%@ include file="main.css" %>
>
> </head>
>
> <body bgcolor="white">
> <html:errors/>
>
> <%
>    System.out.println("HERE ... " +
> this.getClass().getClassLoader().getResource("cais.properties"));
>    // ...
> this show's i'm accessing the right *.properties file
> %>
>
> <%@ include file="header.jsp" %>
> <%@ include file="mainMenu.jsp" %>
>
> <html:form action="view.do">
>
> <table border="0" cellspacing="2" cellpadding="0" align="left">
>    <tr>
>       <td>
>          <html:radio property="view" value="Master View">
>          <!-- bean:message key="main.master" / -->&nbsp;
>          </html:radio>
>       </td>
>       <td>
>          <html:radio property="view" value="Details View">
>          <!-- bean:message key="main.detail" / -->
>          </html:radio>
>       </td>
>       <td>
>          <center>
>          <html:submit value="View"/>
>          </center>
>       </td>
>    </tr>
> </table>
>
> </html:form>
>
> <br> <br> <br> <br> <br>
> <%@ include file="footer.jsp" %>
>
> </body>
> </html:html>
>
>