• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in accessing servlets

 
Pallavi Sikdar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a jsp which is trying to access a servlet(the servlet accesses an ejb).Come what may I cannot access my servlet in weblogic- it gives me Error:404.What is the path of the servlet that i should give in my jsp?(It is a form)
I have set the servlet mapping, uri etc in web.xml but to no avail!!
Using only jsp's the whole thing works fine.
What i did was manually created a
.war file( say login.war) using the jar utility which comes with j2sdk and deployed the war file using the WEBLOGIC administrative console.
login.war contained my jsps in a folder named jsps ,and the deployment descripters-web.xml and weblogic.xml inside WEB-INF folder.
though i did not mention any context root as such, I was able to successfully deploy the war file and access my jsps through the url- localhost:7001/login/jsps/myjsp.jsp.

But now i want a servlet. How should i proceed?Is the context path etc. server specific??
Here is the relevent part of web.xml:-
<servlet>
<servlet-name>control</servlet-name>
<servlet-class>friendwebapp.Control</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>control</servlet-name>
<url-pattern>/control</url-pattern>
</servlet-mapping>
This is the part of the jsp trying to acesss ControllerServlet
<form method="GET" action="/control">
Finally, the servlet class..
public class ControllerServlet extends HttpServlet {.....
Name of the war file login.war.For jsps weblogic automatically appends
/login .
Can anyone help?
Thanks.
 
Ram Mohan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i thought of posting this, but u beat me to it....maybe u should have posted this under BEA / Weblogic section
 
Pallavi Sikdar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well Ram mohan ,
I did post it under that section, but unfortunately not as a new topic
and got no replies.So i am hoping to get some now.
Patience. A minor form of despair disguised as a virtue. Ambrose Bierce
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is partly a general HTTP URL issue, and partly about app server behaviour.
In your HTML, you have specified a URL of /control. This is a relative URL, and because you have put a / at the start, it is relative to the "root" of the domain. If it is generated by a JSP at http://localhost:7001/login/jsps/myjsp.jsp, then it will resolve to the full URL http://localhost:7001/control.
Meanwhile, in your web.xml, you have mapped your servlet to the application path /control. Because this is an application path, not a full URL, this will resolve to the full URL http://localhost:7001/login/control.
As I hope you can see, the two full URLs are not the same, so your JSP will not send its form data to the right URL.
You should be able to make your JSP work by changing

to either

or

I hope that all makes sense.
 
Pallavi Sikdar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Frank, but unfortunately it did not work. I tried both ../control
and /login/control. Where else could the problem possibly lie?
My ejb jar is fine as I wrote a java application to access it.
After I click submit on the jsp page, the address bar shows:-
http://localhost:7001/login/control?user=a+pwd=a+ etc...
It's still giving Error 404.
Any more suggestions please?!!
Thanks!
Pallavi
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!