This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

weird functioning of servlet

 
adeeb alexander
Ranch Hand
Posts: 268
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 268
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
adeeb alexander
Ranch Hand
Posts: 268
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic