File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes weird functioning of servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "weird functioning of servlet" Watch "weird functioning of servlet" New topic
Author

weird functioning of servlet

adeeb alexander
Ranch Hand

Joined: May 29, 2008
Posts: 255
Hi.

First i will paste all my code here.

DataPage.jsp


DataServlet.java


This two are dependent on each other, wright? I have other jsp page which is dependent on other servlet. Code is below


Insert.jsp


Insert.java



Now. The insert.jsp works fine, when I give data and click add button, the database is also updated. Till here its fine

THE PROBLEM:
In DataPage.jsp I am viewing the list sent by the servlet "DataServlet". So if i run the DataPage.jsp directly I get an error at the itterator. However, I accessed the DataServlet from the browser then i get this error "HTTP method GET is not supported by this URL" which i used to not get in the beginning. This started after I added the Insert.jsp and Insert.java files. I am unable to solve it. Someone please point out the problem.


Thanks and regards
Adeeb
adeeb alexander
Ranch Hand

Joined: May 29, 2008
Posts: 255
Hey i missed this point. I tried to access DataServlet from different jsp file using a submit button and form with method as post and all.. Here the URL Shows up with /mypath/DataServlet. But the most annoying thing is its not behaving as it should i.e displaying database table by redirecting to DataPage.jsp, as the code is written, instead it shows the window of same Insert. NOTE:In URL name is DataServlet, but it shows Insert page. How come??? I restarted Apche many times, recompiled the code. Dont know the problem. Please help me out.


Thanks.
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50691

adeeb alexander wrote:In URL name is DataServlet, but it shows Insert page. How come?

You are forwarding from the servlet to the JSP. So why is this a surprise? It's doing exactly what you told it to do.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
adeeb alexander
Ranch Hand

Joined: May 29, 2008
Posts: 255
The problem is I dint know about xml tags. I wrote like this
<servlet>
<servlet-name>DataServlet</servlet-name>
<servlet-class>DataServlet</servlet-class>

<servlet-name>Insert</servlet-name>
<servlet-class>Insert</servlet-class>
</servlet>

instead of writing individually.
I was surprised cauz, even the URL was wright, but page displayed was different..
Now its resolved. Thanks.

 
 
subject: weird functioning of servlet
 
Threads others viewed
please any one cleare my error
retreiving data through jsp
retreiving all rows from a mysql table to a jsp page
problem in retrieving data from a DB to HTML through JSP
problem calling servlet to build a list of data from a database and display a jsp page
IntelliJ Java IDE