You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vishal <kn...@yahoo.com> on 2006/09/09 00:39:23 UTC
question in html select and html option, and logic iterate
Hi,
I am stumped with something which i thought would not take that long and I would appreciate any help i can get from you all. I am pasting below the code.
org.act.rsp.util.Utils.java
---------------------------------
public class Utils {
............
private Map passwordQuestion = new HashMap();
...........
public Utils() {
passwordQuestion.put("Your pet's name","Text.ChangePasswordForm.passwordHint.petName");
passwordQuestion.put("Your first school name","Text.ChangePasswordForm.passwordHint.firstSchool");
}
...........
public Map getPasswordQuestion()
{
return passwordQuestion;
}
}
In change.jsp i have
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/taglib.tld" prefix="auth" %>
<%@ page import="org.act.rsp.util.*" %>
<%@ page import="java.util.*" %>
<jsp:useBean id="passwordHintQuestionsList" scope="application" class="org.act.rsp.util.Utils"/>
<html:form action="/Change">
.....
.....
........
<table>
<tr>
<td>
<font color="red"> begin</font>
</td>
</tr>
<tr>
<td>
<html:select property="passwordQuestion">
<logic:iterate name="passwordQuestion" id="listEntry">
<html:option value="value" key="listEntry">
<bean:write name="listEntry" property="label"/>
</html:option>
<bean:define name="key" property="listEntry" id="key" type="java.lang.String"/>
<html:option value="<%=key%>">
<bean:message name="listEntry" property="value"/>
</html:option>
</logic:iterate>
</html:select>
</td>
</tr>
<tr>
<td>
<font color="red"> end </font>
</td>
</tr>
</table>
....
.........
When i run it i get the error
[ServletException in:/WEB-INF/jsps/account/ChangePassword.jsp] No getter method available for property passwordQuestion for bean under name org.apache.struts.taglib.html.BEAN'
But when i comment out the whole <table> part and run it by putting the following snippet,
<%
Map passwordQsn = passwordHintQuestionsList.getPasswordQuestion();
request.setAttribute("passwordQuestion",passwordQsn);
out.println(request.getAttribute("passwordQuestion"));
%>
it runs perfectly.
I am not sure if my question is clear enough but i will really appreciate any help i can get on this topic
Thanks a lot in advance
Vj
---------------------------------
All-new Yahoo! Mail - Fire up a more powerful email and get things done faster.
Re: question in html select and html option, and logic iterate
Posted by Wendy Smoak <ws...@gmail.com>.
On 9/8/06, Vishal <kn...@yahoo.com> wrote:
> I am stumped with something which i thought would not take that long and I would appreciate any help i can get from you all. I am pasting below the code.
> <html:form action="/Change">
What does the corresponding action mapping in struts-config.xml look like?
> <html:select property="passwordQuestion">
By default, the <html:select> tag will look to the form bean from the
enclosing <html:form>.
> [ServletException in:/WEB-INF/jsps/account/ChangePassword.jsp] No getter method available for property passwordQuestion for bean under name org.apache.struts.taglib.html.BEAN'
And this error most likely means that the form bean (from <action
name='...' > ) does not have a 'passwordQuestion' property.
> But when i comment out the whole <table> part and run it by putting the following snippet,
> <%
> Map passwordQsn = passwordHintQuestionsList.getPasswordQuestion();
> request.setAttribute("passwordQuestion",passwordQsn);
> out.println(request.getAttribute("passwordQuestion"));
> %>
What is 'passwordHintQuestionsList' and how does it relate to the form
bean (if any) for this action?
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org