• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

weird functioning of servlet

 
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
reply
    Bookmark Topic Watch Topic
  • New Topic