RequestDispatcher not working in Servlet.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
However, the above functionality does not seem to work?
How do I fix it?
index.html
RegisterServlet.java
web.xml
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Sourabh Chavan wrote:... the above functionality does not seem to work
You will need to provide some details.
What were you expecting, and what did you observe?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Sourabh Chavan wrote:However, the above functionality does not seem to work?
What makes you think that it doesn't work? (Or are you still unsure whether it works or not?)
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Ron McLeod wrote:
Sourabh Chavan wrote:... the above functionality does not seem to work
You will need to provide some details.
What were you expecting, and what did you observe?
I was expecting that when I run the app on netbeans and don't click on terms and conditions agree the browser displays the form with details with the text "the terms and consitions have not been agreed"
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Paul Clapham wrote:
Sourabh Chavan wrote:However, the above functionality does not seem to work?
What makes you think that it doesn't work? (Or are you still unsure whether it works or not?)
I was expecting that when I run the app on netbeans and don't click on terms and conditions agree the browser displays the form with details with the text "the terms and consitions have not been agreed. However, the form is displayed without the details I entered. "
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Sourabh Chavan wrote:I was expecting that when I run the app on netbeans and don't click on terms and conditions agree the browser displays the form with details with the text "the terms and consitions have not been agreed"
And what was actually displayed?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Ron McLeod wrote:
Sourabh Chavan wrote:I was expecting that when I run the app on netbeans and don't click on terms and conditions agree the browser displays the form with details with the text "the terms and consitions have not been agreed"
And what was actually displayed?
However, the form is displayed without the details I entered.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Ron McLeod wrote:I guess that is because if your check for the conditions being accepted (condition!=null) returns false, then you send back the same static HTML content that you sent originally, which does not include any values.
So, how to fix?
I am new to servlets
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
To fix this, modify your existing code:
To include values for male and female:
Or even better, using labels:
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Ron McLeod wrote:Something else I noticed ... I'm assuming that since you are not specifying specific values for for the radio input elements, that you are seeing a value of on for gender, and are unable to distinguish between male/female.
To fix this, modify your existing code:
To include values for male and female:
Or even better, using labels:
Can you help me about ,y form problem?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Sourabh Chavan wrote:Can you help me about ,y form problem?
Sorry - all I can suggest is that if you want to use server-side rendering with dynamic content, then maybe take a look at JSPs. Hopefully others can make better recommendations.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Ron McLeod wrote:I haven't worked with Servlets for a while, so I am probably not the best one to answer, but one solution would be to use JSPs (Java Server Pages) and java.lang.EL (Java Expression Language).
I had some time today so I reworked your project to use JSP and EL. It's not perfect, but it should be good-enough provide an example of how to use JSPs. Reply-back here if you have any questions.
RegisterServlet.java
RegisterData
web.xml
index.jsp
display.jsp
pom.xml
Source tree
| And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad: Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |











