Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error while using getProperty of Bean in JSP

Status
Not open for further replies.

rverma

Programmer
Aug 14, 2000
2
US
Hi,<br><br>I am trying to use the value of bean in JSP by using the getProperty,but I am getting the following error<br><br>500 Internal Server Error<br><br>Can't find resource key &quot;BeanUtils.NoGetter&quot; in base name allaire/jrun/jsp/resource.properties<br>java.util.MissingResourceException: Can't find resource key &quot;BeanUtils.NoGetter&quot; in base name allaire/jrun/jsp/resource.properties<br><br>Get method is there in bean,I don't know,where is the problem.Moreover while setting the property,if I have to put quotes around the value,I get error<br><br>This works fine <br>&lt;jsp:useBean id=&quot;sa&quot; class=&quot;pmis.SecurityAudit1&quot; scope=&quot;session&quot;/&gt;<br>&lt;jsp:setProperty name=&quot;sa&quot; property=&quot;domain&quot; value=&quot;Boston&quot; /&gt;<br><br><br>But when I set the value using the following code<br>&lt;jsp:setProperty name=&quot;sa&quot; property=&quot;domain&quot; value=&quot;&lt;%=request.getParameter(&quot;domain&quot;)%&gt;&quot; /&gt;<br><br>I get the lexical error,is this wrong way to put value in quotes.<br><br>Any help will be highly appreciated.<br><br>Thanks<br>Rajit<br><br><br><br>
 
Dear Rajit,

You might try this instead:
//in bean code
public class SecurityAudit1
{
private String _domain = new String(&quot;&quot;);

public void setDomain(String sdomain){
_domain = sdomain;
}
public String getDomain(){ return _domain; }

... rest of class
}

<jsp:useBean id=&quot;sa&quot; class=&quot;pmis.SecurityAudit1&quot; scope=&quot;session&quot;/>
<%
sa.setDomain(&quot;Boston&quot;);
%>
<p>Your domain is: <%=sa.getDomain()%></p>


&quot;But, that's just my opinion... I could be wrong&quot;.
-pete
 
Isn't that defeating the object (no pun!) of having beans though? I have the same problem whereby I create a bean in a controller servlet, set its properties and then redirect to a jsp, which in my mind should be able to get those properties set in the servlet. The servlet can read the bean properties and add them to the session and the JSP can read them from the session, but that doesn't seem quite right.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top