Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hi All Struts error

 
suneel surya
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote a DispatchAction program using DynaActionForm

Iam Getting this error always can any one help me out

My config.xml is this

<form-bean name="sunil" type="org.apache.struts.validator.DynaValidatorActionForm">
<from-property name="id" type="java.lang.String"/>
<from-property name="pass" type="java.lang.String"/>
<from-property name="function" type="java.lang.String"/>
</form-bean>

THANK YOU IN ADVANCE
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sunI,

Welcome to JavaRanch! We're glad you're here. I do need to remind you, though, that the name you are currently displaying does not meet the guidelines of the JavaRanch Naming Policy. In particular, the name you display must be a first and last name, and must not be obviously fictitious. Please change the Publicly Displayed Name in your user profile so that it meets the guidelines.

This may seem trivial to you, but it's an important part of the culture at JavaRanch, and we do appreciate your compliance with it.

Regarding your question: You haven't told us what error message you're getting. Please post the complete error message along with a portion of the stack trace. It would be helpful to see the action mapping and portions of the JSP as well.
 
suneel surya
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Merrill Higginson ,
Thanks for correcting me, though i was JavaRanch member long back I dint use it. Well Iam Sorry I forgot to paste the error I am facing, heres the error

javax.servlet.ServletException: No getter method for property id of bean org.apache.struts.taglib.html.BEAN

and keep up the good work of correcting people mistakes. Nice to meet a person like you
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
suneel,

Thanks for taking the time to change the name in your profile. However, you're not quite there yet. The policy states that you must have both a first and a last name. I realize that in some cultures this model doesn't exactly fit, but try to make your name fit into this pattern as best you can. Even if it isn't your real name, as long as it's not obviously fictitious, it will be fine.

Regarding your problem: Make sure that the JSP you're trying to display has an <html:form> tag and that the action attribute points to an action mapping whose name attribute is sunil. If you still can't get it to work, please show us your JSP, particularly the <html:form> tag and the and any other html tag that references the id property. Also show us the portion of your struts-config.xml file containing the action mapping you're using.
 
suneel surya
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
My Name is Just Suneel so i cant add any sur names.Coming to my problem Here is my code

Error is:
javax.servlet.jsp.JspException: No getter method for property id of bean org.apache.struts.taglib.html.BEAN

Config.xml is:

<struts-config>
<form-beans>
<form-bean name="bean" type="org.apache.struts.validator.DynaValidatorActionForm">
<from-property name="id" type="java.lang.String"/>
<from-property name="pass" type="java.lang.String"/>
<from-property name="function" type="java.lang.String"/>
</form-bean>
</form-beans>

<global-exceptions>

</global-exceptions>

<global-forwards>
<forward name="success" path="/success.jsp" redirect="false"/>
<forward name="failure" path="/failure.jsp" redirect="false"/>
</global-forwards>

<action-mappings>
<action path="/controller1" name="bean" type="myapp.OurAction"
parameter="function" validate="true" input="/error.jsp" scope="request"/>
<action path="/controller2" name="bean" type="myapp.OurAction"
parameter="function" validate="true" input="/error.jsp" scope="request"/>
<action path="/add" type="org.apache.struts.actions.ForwardAction" parameter="/AddUser.jsp"/>
<action path="/delete" type="org.apache.struts.actions.ForwardAction" parameter="/DeleteUser.jsp"/>
<action path="/modify" type="org.apache.struts.actions.ForwardAction" parameter="/ModifyUser.jsp"/>
<action path="/home" type="org.apache.struts.actions.ForwardAction" parameter="/index.jsp"/>
</action-mappings>

My page AddUser.jsp:

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


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html:html>
<html:form action="/controller1" >
<center><br><br>
<table>
<caption>
<font size=6><u>Adding User</font></h2></u></caption>
<tr>
<td><bean:message key="form.id"/></td>
<td><html:text property="id"/></td>
</tr>
<tr>
<td><bean:message key="form.pass"/></td>
<td><html:text property="pass"/></td>
</tr>
</table>
<br>
<html:submit value="AddUser"/>
<html:hidden property="function" value="addUser"/>
</center>

</html:form>
</html:html>

now can you trace the bug
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suneel,

I understand that in a case such as yours, the naming policy may not seem to fit. The point of the policy is to encourage people to be up front about who they are and avoid cutesy names like "JavaDude" or "CodeGangsta".

To a person such as you who only has one name, this may seem odd, but to avoid future hassles, I'd recommend you come up with a surname that sounds real, and just use it for purposes of posting on JavaRanch.

I didn't write the policy, but as the moderator of this forum it is one of my responsibilities to see that it is followed as much as possible. Any time you post on JavaRanch with a name that does not meet the policy, you will likely get told to change it. The policy is not optional, so you may even have your profile removed if you don't follow it.

Now, regarding your problem:

I missed it before, but it's just a simple misspelling: In your form bean definition, change all instances of from-property to form-property.
[ June 29, 2007: Message edited by: Merrill Higginson ]
 
suneel surya
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
For the last few days i was sick and couldn't reply, thanks for your suggestion.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic