Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with struts-config.xml

 
Jim Patrick
Ranch Hand
Posts: 42
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 326
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 42
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show us your quote.jsp.
 
Jim Patrick
Ranch Hand
Posts: 42
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Merrill Higginson:
Show us your quote.jsp.


hi Merrill,

Here is the code for quote.jsp:

 
Jim Patrick
Ranch Hand
Posts: 42
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pls try to set "/Lookup.do" rather than "/Lookup" in the attribute "action" of form.

Since the configuration in web.xml is "*.do":
 
Jim Patrick
Ranch Hand
Posts: 42
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agree with Brent, you can try that way.
 
Jim Patrick
Ranch Hand
Posts: 42
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your suggestions guys..
anyway it doesnt seem to work..
im formatting the system again..
 
Mike Sever
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 42
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
am i missing something while configuring struts1.1 with tomcat 5.0.16?
 
Yogendra Joshi
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jim Patrick
Ranch Hand
Posts: 42
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the suggestions Joshi!!..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic