- This topic has 3 replies, 2 voices, and was last updated 19 years ago by
Riyad Kalla.
-
AuthorPosts
-
sunil1808MemberHi,
I’m new to Web Component development.Having said that, I tried to create a test web application.
I created a MyEclipse, Web Project.
I wrote a HTML with form (please find the HTML page below).
The HTML is housed under WebRoot\InputSimpleData.htmlI’m trying to invoke the servlet ReadFormData on ACTION(HTML Form).
The servlet location is WebProject\src\package.locationThe class file is getting generated properly (for the servlet) under the WEB-INF\Classes folder.
But when I load the HTML using MyEclipse’s default browser, I get the page corresponding to the HTML, but on clicking submit, the servlet doesn’t get invoked.
I’m not sure whether there’s a problem with the deployment; since with the code or the HTML I don’t see there’s any problem because it’s so simple. Problem is “ACTION” on Form is not loading the servlet.
<body>
<form name=”f1″ id=”f1″ action=”/servlet/ReadFormData” method=”post”>
<table border=”0″>
<tr>
<td>Login:</td>
<td><input type=”text” name=”login” id=”login”></td>
</tr>
<tr>
<td>Password:</td>
<td><input type=”password” name=”password” id=”password”></td>
</tr>
<tr>
<td colspan=”2″ align=”center”><input type=”submit”></td>
</tr>
</table>
</form>
</body>[/b][/code]
Riyad KallaMemberMoving to OT > Soft Dev
Try making the appropriate additions to your web.xml file.
sunil1808Member@support-rkalla wrote:
Moving to OT > Soft Dev
Try making the appropriate additions to your web.xml file.
Hi Riyad,
I had been fighting with this for sometime. I’m able to load the HTML page but the submit is not working, some debugging tips or what kind of change (in the web.xml) would help me?Here’s my web.xml,
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE web-app PUBLIC “-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN” “http://java.sun.com/dtd/web-app_2_3.dtd”>
<web-app>
<servlet>
<servlet-name>ReadFormData</servlet-name>
<display-name>ReadFormDataServlet</display-name>
<description>This servlet is used to read the data submit using HTML form</description>
<servlet-class>com.web.app.practise.ReadFormData</servlet-class>
</servlet><servlet-mapping>
<servlet-name>ReadFormData</servlet-name>
<url-pattern>/servlet/ReadFormData</url-pattern>
</servlet-mapping>
</web-app>Thanks for your help&support,
Sunil.
Riyad KallaMemberGet rid of your servlet-mapping section completely, and re-run your app. The reason I am saying that is because the url-pattern you gave there is the *default* path that the servlet will be mapped to. Also the pattern parser is sort of picky about patterns, I really wants something like *.html, so just remove it.
-
AuthorPosts