views:

156

answers:

2

Hi all,

I created the the file index.jsp as below

<form action="" method="POST"><br>
    First Name: <input type="text" name="firstName" size="20"><br>
    Surname: <input type="text" name="surname" size="20"><br>
    <input type="submit" value="Submit"><br>
</form>

I export it to .war and everything works fine. Then later I modified index.jsp, added in the form action to

<form action="GreetingServlet" method="POST"><br>
    First Name: <input type="text" name="firstName" size="20"><br>
    Surname: <input type="text" name="surname" size="20"><br>
    <input type="submit" value="Submit"><br>
</form>

I exported it again to .war, but the changes were not reflected. When I view source, the form action is still equal to blank. I have restarted apache as well. I view the log, it shows me that it has been redeployed.. but the changes were not reflected.

I have tried with different browsers, restart eclipse to see if the changes are saved, restart apache. Any advice? Thank you

+1  A: 

What does "export to WAR" mean to you? I assume you mean create a new WAR and redeploy that to Tomcat. Please confirm if this is true.

I'd also wonder if that action URL should be "/GreetingServlet".

Is GreetingServlet in a package? Is it mapping in your web.xml file? Can you invoke GreetingServlet by typing the URL into a browser? If you can't contact it, I wouldn't expect your index.jsp to do so, either.

Is the index.jsp a <welcome-file> in your web.xml?

Leave Eclipse out of the picture for a moment. Can you create a WAR file and deploy it to Tomcat successfully?

Which version of Tomcat are you running? JDK? Operating system?

It would help in the future if you would provide these kinds of details in your original question. Help us help you.

duffymo
+3  A: 

What you are doing, the tools you are using, how you are using them, etc is totally unclear. It would be really helpful if you could give more details on your context and clarify what actions you are performing exactly. Currently, it's pretty hard to help you without guessing...

Just in case, my guess is that you actually didn't redeploy the WAR i.e. you didn't copy it to the webapps directory of Apache Tomcat (the fact that you are using Apache Tomcat is my second guess as Apache commonly refers to Apache HTTPD, the web server).

Pascal Thivent
Yes. Unfortunately with open source things there is no clear distinction for products. There is Apache the web server, Tomcat the Java implementation, bundle-specific web console for deployment of wars, perhaps commerical or open source J2EE product for ear like deployments (why did poster tagged it J2EE ?) etc. The toolchain details will help to get better answer
RocketSurgeon
@RocketSurgeion: Au contraire - open source 'things' are very well differentiated. The fact that many of them wear the Apache badge, doesn't make them non-distinct. Servlets are part of J2EE.
Bozho
@RocketSurgeon Well, I don't really agree. An apple isn't an orange but both are fruits. It's the same thing with open source software, people just need to use the right name :)
Pascal Thivent