aspose file tools*
The moose likes Struts and the fly likes problem with struts-config.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem with struts-config.xml " Watch "problem with struts-config.xml " New topic
Author

problem with struts-config.xml

Jim Patrick
Ranch Hand

Joined: Dec 27, 2005
Posts: 42

Hi

This is my web.xml:




This is my struts-config.xml:




when i launch this example,

an index page should be displayed:
this is the index.jsp:



this jsp is displayed after i start the server.
but when i click on submit, it displays this in the URL with a blank page



what might be the error?, i suspect it has something to do with DOCTYPE in the xml files..

i am using struts1.1, tomcat5.0.16, jdk 1.4, eclipse 3.1 for this example.


Rgds,
Jim.
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
What result are you expecting?
Other than no output from LookupAction, there's nothing wrong.
What is the last line of LookupAction.execute()?
Jim Patrick
Ranch Hand

Joined: Dec 27, 2005
Posts: 42

Originally posted by Ray Stojonic:
What result are you expecting?
Other than no output from LookupAction, there's nothing wrong.
What is the last line of LookupAction.execute()?


This is my action:




and this is the LookupForm:



It has to return the price for symbol.

Rgds,
Jim.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Show us your quote.jsp.


Merrill
Consultant, Sima Solutions
Jim Patrick
Ranch Hand

Joined: Dec 27, 2005
Posts: 42

Originally posted by Merrill Higginson:
Show us your quote.jsp.


hi Merrill,

Here is the code for quote.jsp:

Jim Patrick
Ranch Hand

Joined: Dec 27, 2005
Posts: 42

this is the log in tomcat/log/ folder:



is it the problem in browser? i am thinking of formatting the system again..
any suggestions?
Mike Sever
Ranch Hand

Joined: Jul 24, 2006
Posts: 56
Pls try to set "/Lookup.do" rather than "/Lookup" in the attribute "action" of form.

Since the configuration in web.xml is "*.do":


<i>Mike</i>
Jim Patrick
Ranch Hand

Joined: Dec 27, 2005
Posts: 42

Hi Mike

thanks..i have tried as you said..
but its the same..it shows a blank page with this url:
http://localhost:8080/newstr/Lookup.do;jsessionid=A90B7428F39EE199177F6C1DA81A7637

Jim.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Are you using and IDE with a debugger? If so have you tried setting a break point in your action to see what is happening? At least you should be able to throw in some logging or System.out.println statements.

I typically do not include a / in the action attribute of my html:form tag, but I have seen other include this so I guess it does not make much difference. You also don't need to specify the name and type attributes (and in fact these have been removed in newer releases of Struts).

Also, by default validation is enabled for actions, so if you do not need to perform validation, I would add a validate="false" attribute to my action definition in struts-config. If you do need to validate, then specify and input attribute. I think that if validation fails without an input attribute, you will see a blank page like you are describing.

BTW, this code [String target = new String("success")] is slightly less efficient than this code [String target = "success"].

- Brent
Mike Sever
Ranch Hand

Joined: Jul 24, 2006
Posts: 56
Agree with Brent, you can try that way.
Jim Patrick
Ranch Hand

Joined: Dec 27, 2005
Posts: 42

thanks for your suggestions guys..
anyway it doesnt seem to work..
im formatting the system again..
Mike Sever
Ranch Hand

Joined: Jul 24, 2006
Posts: 56
Actually I've remembered to encounter this situation. You'd better first set validate="false" to try, because error in validation is one of the common reasons which result in blank page especally in struts.
Jim Patrick
Ranch Hand

Joined: Dec 27, 2005
Posts: 42

am i missing something while configuring struts1.1 with tomcat 5.0.16?
Yogendra Joshi
Ranch Hand

Joined: Apr 04, 2006
Posts: 213
Hey Jim ,

I think you are trying this Example of the Wrox Publication books which returns a quote symbol's price...

Anywayz , I also had used this example and it did not give me any problems , Make sure that the <html:form> contains only 1 attribute i.e action="/LookUp", this is what is done on my machine. Also if somethings doesn't work dont keep a habit of Formatting the machine or the Appliction Server. Also just a small note which i would like you to be aware of. Whenever you make a single line of change or may be a small character is amended to struts-config.xml file it needs a restart of the Tomcat Server and in this case HOT DEPLOYMENT doesn't work.

Also as Brent suggested , Breakpoint in Eclipse 3.1 is a good option to debug the problem or perhaps the best way is to debug it using Log4J or CommonsLogging API from Apache.

Hope this post helps you troublshoot your query.

Thanks and Take Care
Yogendra Joshi.


Meri Zindagi Hain Tab Tak.. Jab Tak Tera Sahara.... Har Taraf Tu Hi Tu Hain SAI Tera Hi Hain Nazara.....
Jim Patrick
Ranch Hand

Joined: Dec 27, 2005
Posts: 42

thanks for the suggestions Joshi!!..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with struts-config.xml