Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

Basic Servlet help

Thread view: 
Dakota Mon - 12 Feb 2006 22:12 GMT
Ok heres my situation....

I am using NetBeans 4.1 and just doing a simpler than "Hello World" web
app.
I have a web module which has a servlet called "Control1". I have 4
JSPs. There is the "index.jsp" which comes by default and then there
are 3 which I Created. One if called "mainPage.jsp".

Here is what I want to have happen. When someone goes to my webpage,
the servlet "Control1" is called and instantly passes control over to
and displays "mainPage.jsp".

My questions are ...
1) What is the default page used when the URL is invoked?

2) If the default page is not the servlet then how do I set it to be
the servlet "Control1"?

3) How then do I pass on to a JSP to display? This also includes the
question of how do I make the JSP page available/visible to the
servlet?

4) Within "mainPage.jsp" I want to collect info. How do I then pass
this info back to the servlet "Control1"?

I will eventually deploy to the Sun Applicationn Server but right now I
am just working with this within the NetBeans environment.
trippy - 12 Feb 2006 23:15 GMT
In article <1139782371.390599.206360@g14g2000cwa.googlegroups.com>,
Dakota Mon took the hamburger, threw it on the grill, and I said "Oh
wow"...

> Ok heres my situation....
>
[quoted text clipped - 10 lines]
> My questions are ...
> 1) What is the default page used when the URL is invoked?

mainPage.jsp

> 2) If the default page is not the servlet then how do I set it to be
> the servlet "Control1"?

Just put the servlet up if you're gonna do that and lose the .jsp pages.

> 3) How then do I pass on to a JSP to display? This also includes the
> question of how do I make the JSP page available/visible to the
> servlet?

You do this with the action attribute of the form element.

<form action="/servlet/path.to.your.servlet" method="get" >
</form>

You can also use method="post". Anything more complicated than that and
you'll have to find someone who knows more than I do.

> 4) Within "mainPage.jsp" I want to collect info. How do I then pass
> this info back to the servlet "Control1"?

request.getParameter("textFieldID");

Signature

trippy
mhm31x9 Smeeter#29 WSD#30
sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM

NP: "Jelly Roll" -- Blue Murder

"Now, technology's getting better all the time and that's fine,
but most of the time all you need is a stick of gum, a pocketknife,
and a smile."

-- Robert Redford "Spy Game"

viraj - 13 Feb 2006 05:04 GMT
hi

>> My questions are ...
>> 1) What is the default page used when the URL is invoked?
when you want to pass control to some servlet first.. and then to
main.jsp.. you should have some URL like /controlServlet.do and map
this pattern to Controll servlet using web.xml

2) If the default page is not the servlet then how do I set it to be
the servlet "Control1"?
again.. use web.xml and same approach

3) How then do I pass on to a JSP to display? This also includes the
question of how do I make the JSP page available/visible to the
servlet?
you dont have to do anything to make it visible to servlet..
there are various way you can pass the control from servlet to jsp..
response.sendredirect for example

4) Within "mainPage.jsp" I want to collect info. How do I then pass
this info back to the servlet "Control1"?
again.. you will have to call that URL which is mapped to controll
servlet


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.