Hello everyone, I was going through "viralpatel.net" website to learn Spring3. So far things were good till the time I was planning to do something different as follows. As I am stuck here, therefore seeking help from you all. Please tell me where is my problem. Always thankful to you guys.
UseCase: I have three
JSP pages. First one "index.jsp" is just redirecting the App to "contact.jsp" page. "contact.jsp" is a form page where user submit their info. As soon as they will submit the form, the app will bring the user to another page "hello.jsp", where the App will print welcome message as well as user firstname. For "contact.jsp", I am using "ContactController.java" < as my Controller class and "Contact.java" < as the for bean for this App and for "hello.jsp", I am using "HelloWorldController.java" < as another controller class.
Problem: From controller "ContactController.java", I can redirect the App to "hello.jsp" where "HelloWorldController.java" nicely playing its role and printing the message as the code I am presenting below but when I am trying to pass the firstname or lastname or any other info from "ContactController.java" controller to "HelloWorldController.java", then getting error. Sometimes "hello.jsp" is coming just like a blanck pageand showing nothing.
So here I don't know how to pass variables and their values from one controller to another in Spring3. Will be glad also if any one can help me to get some tutorials on this please.
a) web.xml
b) spring-servlet.xml
c) index.jsp
d) contact.jsp
e) hello.jsp
f) ContactController.java
g) Contact.java
h) HelloWorldController.java
Note: The above code is working absolutely fine when I am commenting out this line: //String message = new ContactController().firstName; from "HelloWorldController.java".
Question is why I can't access any elements from "ContactController.java" or what is the right way to do so? Thanks again