webapp help

Hi

Ive just started using JSP and am having some trouble.

Im following this tutorial to create a simple login/password page and then go to a welcome page.

I dont know how to get intelliJ to find this file Login.java. at the moment its in my src directory and the html/jsp files are in resources (default).

according to the tutorial this here
]]>
should be the Login.java file but no matter what i put in "Login" it wont find login.java.

Theres a light bulb that goes on that will create a Login.java (if "Login.java") in the resources but then thats got a red line through it and wont work either.

Can anyone please tell me what im doing wrong its driving me mad?

Thanks
Dave

4 comments
Comment actions Permalink

It sounds like you are new to the Servlet/JSP world. When you create a
Servlet (Login.java), it does not automatically become usable via the
web container. Even though Login.java extends HttpServlet, the web
container will have to be made aware of the class and how it is accessible.

LoginServlet com.this.and.that.LoginServlet LoginServlet /Login servlet-name is a arbitrary name that is used to decouple the name of the class from the URL that will be used to access it. This one says that any requests for /Login will be handled by the .doGet or .doPost methods of the LoginServlet class. This looks like what you may need David wrote: >Hi > >Ive just started using JSP and am having some trouble. > >Im following this tutorial to create a simple login/password page and then go to a welcome page. > >I dont know how to get intelliJ to find this file Login.java. at the moment its in my src directory and the html/jsp files are in resources (default). > >according to the tutorial this here >

>should be the Login.java file but no matter what i put in "Login" it wont find login.java. > >Theres a light bulb that goes on that will create a Login.java (if "Login.java") in the resources but then thats got a red line through it and wont work either. > >Can anyone please tell me what im doing wrong its driving me mad? > >Thanks >]]>Dave

>

0
Comment actions Permalink

Norris Shelton wrote:

It sounds like you are new to the Servlet/JSP world. When you create a
Servlet (Login.java), it does not automatically become usable via the
web container. Even though Login.java extends HttpServlet, the web
container will have to be made aware of the class and how it is accessible.

<servlet>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>com.this.and.that.LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/Login</url-pattern>
</servlet-mapping>


servlet-name is a arbitrary name that is used to decouple the name of
the class from the URL that will be used to access it. This one says
that any requests for /Login will be handled by the .doGet or .doPost
methods of the LoginServlet class. This looks like what you may need


It might be added that that's supposed to go into a file called
"web.xml" in the directory called "WEB-INF" below the root of the web
application.

/Kreiger



Attachment(s):
signature.asc
0
Comment actions Permalink

Hi

Thanks for the reply's

It seems to be working now thanks

Can anyone recommend some decent tutorials or if theres an absolutely must have book (which if is not too expensive) i might buy?

battling a bit... my university project...

Thanks

0
Comment actions Permalink

http://www.amazon.com/exec/obidos/tg/detail/-/0596005407/qid=1125509232/sr=8-1/ref=pd_bbs_1/104-9733525-4915114?v=glance&s=books&n=507846

It's a certification guide, but it covers all the basics and is very
easy to read.

David wrote:

>Hi
>
>Thanks for the reply's
>
>It seems to be working now thanks
>
>Can anyone recommend some decent tutorials or if theres an absolutely must have book (which if is not too expensive) i might buy?
>
>battling a bit... my university project...
>
>Thanks

>

0

Please sign in to leave a comment.