• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts starting problems.

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I am new to struts but I have to start. I have only some minor idea.

I am stating my problem below.

Wrote a simple JSP page using struts frame work.
NOw the problem with the code is , its stating an exception showing that.


org.apache.jasper.JasperException: /index.jsp(5,0) Unable to find setter method for attribute: name
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94

what could be the solution for this exception.
Remember we don't have any property by name . "name" but still its throwing this exception.

jsp code:

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



<html:form action="Welcome" name="WelcomeForm" type="Gan_Struts.WelcomeForm">

Dear Users, pls enter your name to view a welcome greetings here

<html:text property="User"/>

<html:submit/>

</html:form>

..........................

And my action tag in struts config . xml.

<action-mappings>
<action path="/Welcome"
name="WelcomeForm"
type="Gan_Struts.WelcomeAction"
input="index.jsp">

<forward name="success" path="JSP/WelcomeAuthor.jsp"/>
<forward name="success" path="JSP/Welcomeothers.jsp"/>
</action>

</action-mappings>
........


plz get me the solution.

Also I don't have these following jar files. if u have that plz send it to me.


common-validator.jar
common-pool.jar
xerces.jar
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


org.apache.jasper.JasperException: /index.jsp(5,0) Unable to find setter method for attribute: name
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94


I think the complier is complaining the name attribute of the tag <html:form>


Could you also show the source code WelcomeForm?

Usually, at least me, we will not specify the name and type of the form inside the JSP. Instead, we will configure it in the struts-config.xml.



and inside the JSP, we use:
<html:form action="Welcome"/>

Then, Struts know how to get the form, and store the values into it.

I think you may need to add the <form-bean> tag, and then reference it inside the *name* attribute of *action* inside *action-mappings*.


Also I don't have these following jar files. if u have that plz send it to me.

common-validator.jar
common-pool.jar
xerces.jar


common-validator.jar contains the ValidatorForm and DynaValidatorForm objects for checking the values of the forms.
xerces.jar contains a XML parser that used to parse XML documents. Like the Struts' config files, SOAP messages, etc.

For common-pool.jar, as I never use it, maybe others can help.

Nick
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Arun,

Since your display name doesn't comply with our naming policy as it is, I have to ask you to edit it accordingly (both first name and last name required).

Thanks.
 
Arun M'Purushothaman
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nicholas Cheung,

Thanx for the Help dude, but.. DynaValidator is the next level...we are in the first level..okay...that we wil keep as the next step...i too know that I handle with DynaXXX...but we have to do with out that..and thatis the task, and need ur help for that.

There was lot of humeour ending with face!!!

I got some o/p in some other way but still not fully satisfied.
One change I made was

<form-bean name="WelcomeForm"type="Gan_Struts.WelcomeForm"/>
this I changed to

<html:form name="WelcomeForm" action="Welcome" method = "post" >

Then it shown the first page.
Thx again.
 
Arun M'Purushothaman
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Lasse Koskela:
Hello Arun,

Since your display name doesn't comply with our naming policy as it is, I have to ask you to edit it accordingly (both first name and last name required).

Thanks.



Hi Koskela,

Hope the name Arun is not owned by any Celebrity. Its My own Name. what should I do. I couldn't find any other problems with the naming policy. If anything else is there plz advise.

Thx,
Arun
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At least I'm not aware of a celebrity named Arun. I was referring to the following paragraph in the naming policy:

I understand that in some cultures there is no such thing as "first name and last name" - there is just one name. If you are one of these people, I would like to humbly ask you to sacrifice a piece of your culture to help me build this culture. In the past, permitting single names has inspired less wholesome "creative" aliases. The job of keeping names professional grew exponentially. The result is that exceptions to the naming rule are no longer permitted.

 
Arun M'Purushothaman
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Lasse Koskela:

Okay.. Koskela... I got it. Actully I searched for the second name in the edit's entry, But I didnt find anything like that, so only I thought not to add any.

Anyways thank u for putting in my notice.
I added my initial. Now don't call me Memeber of Parliament.

 
Arun M'Purushothaman
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then Here is the current problem I am facing.

I feels there is some compatibility problem with .the Tomacat and the Jdk version and the Struts??? Any conflicts?

(StandardWrapperValve.java:214Here is the error display I got in explorer

javax.servlet.ServletException: Servlet.init() for servlet jsp threw exception
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:871)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:615)
at org.apache.catalina.core.StandardWrapperValve.invoke
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is your Tomcat's version?

I guess J2EE 1.3 is fine enough to play around with Struts 1.1.

I used WSAD 5.1 to develop J2EE applications with Struts 1.1, we also add the EL into our system, and still, it works fine.

In fact, I do suspect that the error is due to the incorrect setting inside the struts-config.xml, and that's why the container cannot locate (or initialize) the Struts, or loading it with some problems. Please do check it.

Nick
[ May 20, 2004: Message edited by: Nicholas Cheung ]
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


<form-bean name="WelcomeForm"type="Gan_Struts.WelcomeForm"/>
this I changed to

<html:form name="WelcomeForm" action="Welcome" method = "post" >


I guess you have mixed up some concepts.

The <form-bean> tag should be defined in the struts-config.xml, while the <html:form> tag should be used inside the JSP.

If you use <form-bean> inside your JSP, surely it will result in errors.

In addition, you dont even need to set the method to post, as by default, Struts' action submits forms with POST.

Nick
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyways thank u for putting in my notice.
I added my initial. Now don't call me Memeber of Parliament.


Actually we don't consider initials to be a valid "real name" for the last name. It's OK the first name though. We want the name spelled out more than that. Note that Mahalakshmi Annadurai was OK as Maha Anna, but she wouldn't have been OK as Maha A. Please edit your display name once more, thanks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic