This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes Problem with Struts1.2.7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with Struts1.2.7" Watch "Problem with Struts1.2.7" New topic
Author

Problem with Struts1.2.7

Abhishek Asthana
Ranch Hand

Joined: Sep 08, 2004
Posts: 146
Hi,

I am not entirely new to struts, hence this problem is bothering me even more!

I made a simple struts application: Passing a value from a JSP and returning a corresponding result from ActionForm to another JSP. The problem is that the after I press the submit button, the control is not able to detect the ActionServlet.

Here is the code of JSP and the .xml files:



The web.xml is:


Struts-Config.xml:


On pressing the submit button, the URL visited is http://localhost:8080/Lookup?symbol=value

Clearly it is not going to .do! What can be the problem? I am working on Tomcat 5.5 and Struts1.2.7


Please help.Thanks
Abhishek
Eric Gero
Ranch Hand

Joined: Jul 20, 2005
Posts: 73
I noticed that in the JSP, you have type="pkg1.LookupForm" yet the form bean declaration in struts-config.xml says type="ch03.LookupForm". Maybe you have the packages switched?
Abhishek Dwaraki
Ranch Hand

Joined: Feb 13, 2006
Posts: 44
I completely agree with Eric. The type attribute in your form bean definition is supposed to be the fully qualified class name of that bean in the package. Since your's says pkg1 as the package, its supposed to be pkg1.LookupAction something where LookupAction is the name of your class. As a further practice, just make sure that you name your classes in correspondence with the base classes they extend. It will make it easier for you to debug them later. If they extend ActionForm, add a Form to the class name at the end, or Action at the end if they extend Action. It looks like a simple mapping error. Hope this helps...


Regards,
Abhishek Dwaraki
Dept of Electrical and Comp Engg
University of Massachusetts, Amherst
Abhishek Dwaraki
Ranch Hand

Joined: Feb 13, 2006
Posts: 44
And I noticed the thing about the naming. You have followed it pretty much to the letter. I just mentioned it as an afterthought. Cheers.
Abhishek Asthana
Ranch Hand

Joined: Sep 08, 2004
Posts: 146
Uhhh

I am sorry I misspelt some things. But now I managed to make some changes and some progress was made but I didn't reach anywhere!
First of all, I started using the struts html tags so on the click of submit button, the path of ActionServlet is being displayed in the browser's address bar, but the Servlet is not getting invoked! I checked the log files of Tomcat, even there there is no trace of Servlet getting executed.
What can be the error?

Please tell.
Abhishek
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem with Struts1.2.7