aspose file tools*
The moose likes Servlets and the fly likes weird functioning of servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
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: 268
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: 268
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 ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
adeeb alexander
Ranch Hand

Joined: May 29, 2008
Posts: 268
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.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: weird functioning of servlet