Tuesday, January 25, 2011

Balayya Jokes


Balayya desperately wanted to rope in the India's sizzling hot actess Aishwarya Rai in his next movie - Ambika Productions or whatever. So he called up Aish. This is how the conversation happened: 
Balayya - Hello Aishwarya jee, I am balakrishna
Aish - Aish: WHO???
Balayya - It is me Aish jee, late N.T Rama Rao son. You don't know me?
Aish - Which one? I heard he's got almost a dozen of them.
Balayya - Even I don't remeber which one. Do you read news papers?
Aish - Yes, I do. why?
Balayya - I did shooting last year and it came in all newspapers. It was shown in TV also
Aish - Oh... So you just started ur career?
Balayya - ababa nee yabba. No Aish jee. I mean not film shooting. Gun shooting.
Aish - What? You shot someone?
Balayya - Yes. I shot the producer and one more guy. but i shot in the back seat. So no death happened. You don't worry. I don't shoot heroines
Aish - You shot someone and You still doing films? How come? Aren't u supposed to be in Jail?
Balayya - hahahaha. kya Aish jee. tum bhi. I said I have mental. but in real I dont have mental. I just acted. very big action. It is in our family.
Aish - What is that in your family? Mental?
Balayya - No Aish jee. Action is in our family. in our blood.
Aish - oh!
Balayya - And they really belived i am mental. hahaha
Aish - You bet. I have already started to believe it.
Balayya - what?
Aish - Nothing. You go ahead
Balayya - I want u act with me as heroine in my new film.
Aish - Let me see ur pic? where can i see it?
Balayya - You go to www.ihatebalayya.com and see my pics. Aish - Yeah. I am there. What do I have to look for?
Balayya - I don't know. I don't know internet. My director showed me on his computer
Aish - Oh! Ok I will find myself.
Balayya - By the way it's katrina kaif not katarnak kaif: But I call ker kathi. It is easy for me.
Aish - You look very short. How tall are u?
Balayya - 5'5"
Aish - What?? I am 5'9"
Balayya - So what? I wear very high heel shoes. always u dont wear shoes. Problem solve. You acted in one movie with salman no?
Aish - Yeah but he has a great body and u r a fat azz with a big tummy
Balayya - That no problem. I never do in-shirt. Always shirt outside only
Aish - Was that a wig u wearing in the pics?
Balayya - Yes. I have hair. But not enough for films you know. But don't worry. I have hair all over my body except on head.
Aish - In all my previous movies i ran my fingers through hero's hair? I can't do that to u right?
Balayya - No problem. You can do with my chest hair. that way it is romantic also. My fans like my romance very much.
Aish - Ok. I wanna know u better. tell me about your last film
Balayya - Oh. It is a movie called vijayendra varma. Power of Indian. in that I made lot of actions. u shud see that film. i fight with Pakistan. i don't know Hindi no? so i speak telugu with them. they understood. but public did not understand. that’s why it became flop. i wanted to shoot producer gain but already one case was going on no?
Aish - u spoke in telugu with Pakistanis? wow! why you talking to me in English?
Balayya - you very beautiful gal no? that’s why. so when u coming Hyderabad for my film?
Aish - whattttt? do u think i am crazy to do a film with you?
Balayya - why? how much money u want? my producer will pay any much u want otherwise i will shoot him no?
Aish - these days telugu songs are being played in channel V and MTV. what would my friends think about me if they see me dancing with you?
Balayya - pleaseeeeeeeeeeee
Aish - shut up and go shoot urself.


Joke-1 
SIR: Nuvvu em kaavalukuntunav?
STUDENT: Nenu MBBS chadivi, Police Ayyi,Manchi software company lo, lawyerga work chesi pedda pedda building lu kattukuntu collector ga job chesukunta
SIR: orey nijam chepu ra nuvu balakrishna fan kada..,??


Joke-2 
Balayya: Nenu kuda jagan la odarpu yatra cheddam anukuntunnara
Zunior N: enduku babai?
Balayya: mana cinemalu choosi chanipoyina varikosam
Zunior N: nuvu keka babai


Joke-3 
Balaya: Doctor, this Bucket has got a hole. Can you please repair it?
Doctor: Stupid. you knw who iam?
Balaya: Of course I heard that you are a famous "Plastic Surgeon"


Joke-4 
Jr N: Babai naa celllo charging ledu,nee cell ivvu
Balayya: Naa cell full charginglo undi bluetooth on chey pampistaaaa
Jr N: wat a great idea babai!!!!!!!

Joke-5 
Jr N: Enti babay kotta kurchi ekkadidi?
Balayya: Adem ledura ninna interview ki vellin'te take your seat annaaru. Andike pattukochchaaaaaa.


Joke-6 
balayya goes to the programme "koun banega karod pathi". the conversation between amitabachchan and balayya.
Amitab: In which state godavari flows?
Balayya: Liquid State (some one is clapped amitab is shocked ) (balayya looked behind) Jr N: Babai super!!!


Joke-7 
American: First we land on moon
Russian: First we land on jupitor
Balayya from India: Said first we land on sun
America: How is it possible itso hot
Balayya: Ore swamy memu night land ayyamura


Joke-8 
Balayya's 60th B'day
NTR - Cake meeda BULB endhuku petav babai?
Balayya - 60 Candels pettadam kastam kada andhukani, 60 wats bulb pettanu..!
NTR - Nuvvu keka babai


Joke-9 
Movie Dialogues about Balayya
Pokiri: Evadi cinima chusthe, dimma dirigi mind block avuthundo vaade ballayy
Aadi: Ammathodu addanga narukkunta Avadikanna Balayya theliyaka pothey?


Joke-10 
BALLAYA KI PELLI PELLI CHUPULU.............
Balayya - Entha varaku chadivavu
Ammayi: B.A
Balayya - chadivinave 2 mukkalu avi kuda malla reverse lona....!!!!!!!!!


Joke-11 
Balayya - "batta tala" vunte chala goppa vallu avtaranta nijamena???
Lecturer - "Cheviti na kodaka 'batta tala' kadu ra 'pattudala'


Joke-12 
Once a Donkey Kicked Balayya & Ran away.
Balayya started chasing & found a zebra & started beating by saying
"dress maruste kanipettalena !!!!!!!!!!!!


Joke-13 
Aghora tells ballaya abt magadheera
"vadu mande agni golam la kanipistadu"
Balayya - Mari Tuesday ela untadu?
AGHORA: Inko 400 years ayna nuv marav ra baaliga


Joke-14 
Jr.NTR - Adenti babai pinni pregnant kada mari delivari ki hospital kakunda pizza shop ki enduku teeskellav?
Balayya - Aare pizza shop lo delivery free anta ra....!!!!!!!


Joke-15 
Balayya - Arey na lover ki msg pampali ra.
Jr NTR - BABAI NEN PAMPISTA na mobile ivu.
Balayya - Aare jagrata hand writing teda rakunda chudu..!!!


Joke-16 
Ballaya calling 2 customer care, a girl received the call
Balayya - hello evaru?
Girl - I am sita
Balayya - Ayyo devuda..idhi AYODHYA ki vellinda!! Sorry sitamma !!!!!


Joke-17 
Jr NTR - Babai 4 x 3 entha ????
Balayya - Adhi kooda teliyadanu kunnava 4 x 3 = 12 ra.
Jr NTR - Aithe 3 x 4 entha ???
Balayya - abbaa question reverse ga adigithe answer cheppa lenani anukunnava ??? 3 x 4 = 21


Joke-18 
Yamudu - I'm Going to Take ur life . Tell ur last wish
Balayya - pls come and watch my film : simha
Yamudu - Rascal.. Nenu neeku Sketch veste, nuvvu naaku sketch vesthava ???


Joke-19 
Balayya Proposes her college mate : Rani I LOVE YOU!!
RANI - Poyi Principal ki cheptha.
Balayya - Principal ki already pelli ayipoyindha gaaa..


Joke-20 
Once Balayya & Jr.NTR will go to shop for re-charging mobile with top up card
Shop Keeper - 30 Rs. Card re-charge chesukunte 26 Rs talk time vasthundhi.
Balayya - aithe migatha 4 Rs. Ki Biscuits ivvu
Jr NTR - Babai. Cream biscuits ivvamani cheppu


Joke-21 
Once there was an offer in a shop "Take anything for Rs.1000 and get 1 saree free"..
Balayya goes into the shop takes change for Rs.1000 and asks for Free saree


Joke-22 
Balayya to Jr NTR - Velli chetlaki(Tree) ki nilu pattu
Jr NTR - It's already raining.
Balayya - So what take an umbrella and go.
Jr NTR - Nuvu Keka babai


Joke-23 
Balayya - I'll never marry in my life and I'll give same advice to my children also


Joke-24 
Laxmi pranitha asked Jr NTR what sort of books you like
Jr NTR - Check books.

Joke-25 
Ballaya giving exam while standing at the door.
Jr NTR - Babai Why are you standing at the door?
Balayya - Abbai, I am giving entrance test


Joke-26 
Jr NTR - Babai nenu ivala Rs 1000/- odipoyanu
Balayya - Ela abbai
Jr NTR - Morning cricket match lo Rs 500/- bet kattanu, INDIA Match odipoyindhi
Balayya - Abbai 500 ee kada, maari migitha 500
Jr NTR - Night high lights mida 500 petta babai, malli odipoyindhi


Joke-27 
Balayya participated in cycle race..Baaga thokkadu kani Odipoyadu
Jr NTR - Enduku odipoyawu babai
Balayya - Evado cycle ki stand vesadu ra..


Joke-28 
BREAKING NEWS 
ISRO DOES NOT EXISTS ANYMORE.....!!
Balayya - PURCHASED ALL THE ROCKETS FOR DIWALI. CELEBRATION!!!!!!!!!!!!!!!!!!!!!!!


Joke-29 
Lecturer asked Jy NTR as:
THINK WHAT WOULD HAVE HAPPENED IF BALAYYA WOULD HAVE BORN 150 YEARS AGO..?????
Jr NTR - - BRITISH WOULD HAVE FOUGHT FOR INDEPENDANCE...


Joke-30 
Lecturer asked Jy NTR as:
THE PYRAMIDS IN EGYPT ARE ACTUALLY what?
Jr NTR - - Thet are Babai PRIMARY SCHOOL CRAFT PROJECTS!!!!!!!!!!!!


Joke-31 
DEFINITION OF SOLAR ECLIPSE:
WHEN BALAYYA STARES AT SUN WITH ANGER, SUN HIDES BEHIND THE MOON.
THIS GREATEST PHENOMENA IS CALLED SOLAR ECLIPSE.........!!!!!


Joke-32 
Lecturer asked Jy NTR as:
Do you know what Ghajini never forgets?
Jr NTR - - GHAJINI never forgets BALAYYA name!!!! Ghajini has a tatto with Babai name on his soul


Joke-33 
Balayyas next project.
Titanic in Telugu .
Climax revised.
Both survive. Balayya swims across the Atlantic Ocean with heroine in one hand and Titanic in the other.


Joke-34 
THE SARDARJIS ASSOCIATION HAS DECIDED TO DONATE ONE HUNDRED BILLION DOLLARS TO BALAYYA AS A TOKEN OF THANKS FOR SHIFTING PEOPLES FOCUS AWAY FROM THEM!!!!! :p




Joke-35 
Balayya gets an message on his cell:
kannayya your son is dead
Balayya jumps from the 50th floor
at 45th floor he remembers that he did not have a son
at 23rd floor he remmebers that he is not married
at 3rd floor "shit my name is not kannayya it is Balayya"


Joke-36 
Jr NTR asked Balayya do you know MS Office?
Balayya - Give me the address, i will GO


Joke-37 
Ballaya buy coffee for Jr NTR
Ballaya says... Drink quickly..
Jr NTR - Enduku babai
Balayya - says hot coffee Rs5 and cold coffee Rs10


Joke-38 
American - Do any great man born your village??
Balayya - No only small babies born here.


Joke-39 
Once Balayya attended an Interview.
Interviewer - Give me the opposite words.
Balayya - Ok
Interviewer - Made in India
Balayya - Destroyed in Pakistan
Interviewer - Good Keep it Up
Balayya - Bad Put it Down
Interviewer - Maxi Mum
Balayya - Mini Dad
Interviewer - Enough! Take your Seat
Balayya - Insufficient! Don’t take my seat
Interviewer - Idiot! Take your seat
Balayya - Clever! Don’t take my seat
Interviewer - I say you get out!
Balayya - You didn’t say I come in
Interviewer - I reject you!
Balayya - You appoint me


Joke-40 
Jr.Ntr&balaya walking on the road.
They saw 1000Rs note on the road.
Jr NTR - Manam fifty fifty theesukundam babai.
Balayya - Migilina 900 em chedam ra


Joke-41 
Balakrishna went to cloth market
Balayya - Manchi cloth chupinchandi..
Salesman - plane lo chupinch mantara….
Balayya - Nee yabba plane lo kadu ra ikkade chupinchu…


Joke-42 
Interviewer - Me birth place ekkda…?
Balayya - Tiruvnannthapuram….
Interviewer - Tell me the spelling…?
Balayya - Indaka joke chesa, nenu GOA lo puttanu…


Joke-43 
NTR - Babai ratri mobile charging petti padukoku..
Balayya - : Endukura …?
NTR - Battery blast avutundanta…
Balayya - Telusura bacha anduke nenu Battery teesi charging Pettanu…


Joke-44 
NTR - Adenti Babai Tablet sides cut chesi vesukuntunnavu…?
Balayya - Side effects rakunda untayani..
NTR - Rakhi Bagundi evaru kattaru babai…?
Balayya - Abundance na Lovertho nene kattiinchukunna…


Joke-45 
“SPIDER MAN” remaking BALAIAH and the Title will be.
“SEEMALO SALEPURUGU”
CAPTION: Veedu paakaledu yem Peekaledu


Joke-46 
Balakrishna and Jr NTR iddaru Raylaseema ki vellaru.
Rayala seema lo adugupettagane Balakrishna ventane Mattini pattukoni vasan choossadu antha lone face change chesukunnadu. Ventane….
Jr NTR - Babai em ayyendi face ala change chesukunnavu
Balayya - Mattivasana maripoyindi raaa
Jr NTR - Nuvvu pattukunnadi matti kaadu babai PEDA…..


Joke-47 
Teacher - Balayya how many fingers in your hand?
Balayya - '6'madam.
Teacher - neeku enni sarlu cheppanu, nikkar lo cheyyi petti answer cheppoddani..


Joke-48 



Joke-49 
Balayya in flight shouts: I have reached Bangalore. I have reached Bangalore.
Air hostess: B silent Balayya.
Balayya shouts: I have reached Angalore Angalore


Joke-50 
Balayya - Abbai Look out of the window and tell me if the indicator lights are working or not.
Jr NTR - Yes, No Yes No Yes No
Balayya - Correct ga chepu raa, vasthunaya leda
Jr NTR - Yes, No Yes No Yes No


Joke-51 
Balayya - writing something very slowly.
Jr NTR - Babai Why are you writing slowly?
Balayya - Em ledu raa, mana Tarak ki letter rasthunanu vadu fast ga chadava ledu ga..
Jr NTR - Nuvu keka Babai


Joke-52 
Balayya is setting up a new college in Hyderabad and decided to name it as "Balayya Medical college of Engineering"


Joke-53 
A bird SHITS on BALAYYA-
He shouts Angrily, "NEE YANKAMMA DRAWYER ESUKOACHU KADA"
then Bird shouted Back,"NEE AYYA NUV DRAWYER LO VELTHAVA ENTRA!"


Joke-54 
Balayya in a Computr LAB lecturer questioned, what is Microsoft Excel?
Balayya - "It is a powder like Surf Excel to clean computer


Joke-55 
BALAIAH English exam kosam "FRIEND" ane essay prepare ayyadu.
Kani examlo "FATHER" ane essay vachindi.
FRIND place lo FATHER petti ila rasadu.
= = I AM A VERY FATHER'LY PERSON.
I HAVE LOTS OF FATHER'S.
SOME OF MY FATHER'S ARE MALE AND SOME ARE FEMALE.
MY TRUE FATHER IS MY NEIGHBOUR .
Jr NTR - Nuvu keka babai


Joke-56 
Balayya's wife: Yemandi.. ikkada lifeboy soap pettanu ledhe?
Balayya - TV lo arogyaniki rakshana isthundhi lifeboy ani add vasthunte chusi soap thinesa.


Joke-57 
Balayya - Doctorgaru, meeru raasina mandullo (medicines) anni dorikayi kaani... aa last medicine maatram dorakatam ledu...
Doctor - Stupid, ela dorukuthundi... adi naa signature ra JAFFA...


Joke-58 
A friend of Balayya asks him a question:

Friend - khali kadupuna(empty stomach) nuvvu enni idlilu tinagalavu?
Balayya - 6
Friend - kaadu nuvvu okkati kante ekkuva tinalevu....
Balayya - Ala ela autundi.. sare naaku prove chesi chupinchu. ani antadu..
Friend - ok.. nuvvu okka idli thinna ventane.. adi khali kadupu avvadu kada???
Balayya - abba super joke cheppav ra.. maa Jr.NTR ni kuda aduguthanu.. ani akkadi nundi vellipothadu...

Balayya goes to Jr.NTR & asks him the same question:
Balayya - Orey khali kadupuna nuvvu enni idlilu tinagalavu..
Jr.NTR:10
Balayya - Cha 6 ani cheppi unte neekoka super joke cheppevadini...


Joke-59 
Balayya has applied for a job in mobile company and he was thrown out for answering the first question itself... you know what was the question?
Interviewer - Which is the best and biggest network and the answer was an amazing one.....
Balayya - CARTOON NETWORK.


Joke-60 
Balayya goes to a shop for buying shampoo.
Balayya - Ee shampoo entha?
Shopkeeper - 110Rs
Balayya - Deenitho paatu emanna free unda?
Shopkeeper - Emiledu sir.
Balayya - Enduku abaddam cheptav.. deeni meeda dandruff free ani raasi undi kada? mari emi free ledu antaave???


Joke-61 
Ballaya to shopkeeper: oka 8th class book ivvandi
Shopkeeper - Stock ledu
Balayya - Aithe rendu 4th class books ivvandi repu exam undi naku


Joke-62 
Lecturer - Why did Balayya put his radio in his refrigerator
Jr Ntr - Because he wanted to hear cool music.


Joke-63 
Lecturer - Why did Balayya sleep with a scale?
Jr Ntr - Because he wanted to measure how long he has Slept


Joke-64 
Balayya - All over my body where I press I have pain.
Doctor - Take whole body scan.
Balayya - Ok
Doctor - Result of scan: finger fractured!


Joke-65 
Balayya - Orey abbai, samudram enduku 'uppongu tundi'?
Jr Ntr - Babai, samudram lo uppu untundi kabatti.. edi kuda teliyadha?


Joke-66 
Oneday Balayya was walking in the rain.
Jr Ntr - Asked why there is a hole in the Umrella?
Balayya - How do I know if rain stops, that's why this hole


Joke-67 
JAILER - asked Balayya nuvvu jail ku endhuku vachav?
Balayya - oka lady journalist T shirt midha "press" ani rasi unte press chesaa anthe !


Joke-68 
Balayya - Whats your car name
Jr Ntr - I dont know but it starts with T
Balayya - You are very Lucky my Car starts with Petrol !


Joke-69 
Balayya - Lost His Cheque Book.!
Bank Manager - Be Careful, Any1 Can Put Ur Sign.
Balayya - I m Not Fool, I Have Already Signed All Cheques


Joke-70 
Balayya - Was putting dogs tail into a pipe.
Jr Ntr - Babai dogs tail never become straight.
Balayya - Orey idiot I am trying to bend the pipe.


Joke-71 
Balayya - sir, phone lo roju bedhirimpu calls vastunnai
Police - Emani?
Balayya - Recharge cheskokapothe connection cut chestamani sir!


Joke-72 
Balayya - orey dheeni meaning cheppu ra’I AM GOING “ante enti?
Jr Ntr - 'nenu velthunna’.
Balayya - plz ra answer cheppi pora.


Joke-73 
Balayya - I am soooo happy to share with u all that Rakhi Savanth is in my next movie........!
Jr Ntr - Oooh God!! Babai.......You have no Idea what you are saying..........!!!!
Balayya - Yes, I have no Idea, mine is Airtel...........!!!! from that only I am saying....


Joke-74 
Balayya - Balayya circle ga theruguthu vuntadu
Jr Ntr - Enduku babai circle ga theruguthu vunnavu
Balayya - Nenu okadiki call chesthe vallu therigi prayatnenchandhi ani annaru andhuke!
Jr Ntr - Nevvu keka babai!!


Joke-75 
Balayya - Balayya Thalakendhuluga velladuthunnadu
Jr Ntr - Enduku babai thalakendhuluga velladuthunnadu.
Balayya - Thala noppiraa..
Jr Ntr - Ayethe tablet vesuko
Balayya - Nenu fool ne anukuntunnava, nenu tablet vesukunna kani adhi kadupuloki vellindhi, kabbati adhi thalaloke vellalanee thalakendhuluga velladuthunnadu.
Jr Ntr - Nuvvu keka babai


Joke-76 
Jr Ntr - Babai water nundi current enduku teetharu...?
Balayya - Aala tiyakapothe manamu snanam chesetapudu shock kodatadi kadara..


Joke-77 
Old & Blind Man - Babu idi pagala rathra?
Balayya replied- Ammo thatha garu nenu kuda e vuriki kothe.
Old & Blind Man - Ori baaliga nuvva ra.


Joke-78 
Nurse - Congrats sir me intlo mahalakshmilanti kuthuru putindi ...
Balayya - Are yem technology, wife hospital lo unite Kuthuru intlo ela putindi..........????


Joke-79 
Jr Ntr - Enduku babai umpire ni kottavu...?
Balayya - Nenu bowling chestunnapudu vadu nannu "OVER AINDI" ani Thittadura anduke kottanu ra .....!


Joke-80 
Balayya bobo joke
Bobo speed 1 bit memory 1 bite

Presentation scene:
Question-1: who is the worst actor hari krishna or tarak?
Ans: hypothetical question
Question-2: Mee daggarnunchi andariki nacche film eppudu vastundi?
Ans: adi meeru 100 yrs wait chesina raadu
Last Question: Devudu vunnada leda?
Ans: kaleja cinema chusa devudu unnadu...


Joke-81 
Balayya Next Movie Dialogue - ప్రజల కోసం కుక్కనవుత, ఊర కుక్కనవుతా, పిచ్చి కుక్కనవుతా, ఇంకా ఊర పందిని కూడా అవుతా!!


Joke-82 
Jr Ntr - Babai....antha cool water tho bath ela chesthunav, chali veyatleda...
Balayya - Arey jaffa nenu already sweeter vesukoni chesthunanu:) Nevu kaka Babai


Funny Dialogue from parama veera chakra: 
Balayya - Avasaram ithe prajala kosam acting manesthadu,fighting manesthadu, dance manesthadu,inka avasaram ithey maro cinema tiyadam apesthadu.
Prajalu - Neeku adey correct decision


Song from salute. 
Ninnena nenu chusthundi adavi pandina.
Nuvvena neku la unna seema pandina.
Kopamlo adavi dunna la. Rupam lo gunna enugula.
Chupullo pandi kokkula.
Chinnarula chaddilo pad la.
Intaki nuvvu manishiva balayya va.
Entaki nuv mammalni vadalava.
from balayya veerabhimani sandy

Saturday, January 22, 2011

JSP Interview Questions and Answers


What is a JSP and what is it used for? 
Java Server Pages (JSP) is a platform independent presentation layer technology that comes with SUN s J2EE platform. JSPs are normal HTML pages with Java code pieces embedded in them. JSP pages are saved to *.jsp files. A JSP compiler is used in the background to generate a Servlet from the JSP page.

What is difference between custom JSP tags and beans? 
Custom JSP tag is a tag you defined. You define how a tag, its attributes and its body are interpreted, and then group your tags into collections called tag libraries that can be used in any number of JSP files. To use custom JSP tags, you need to define three separate components:
The tag handler class that defines the tag\'s behavior
The tag library descriptor file that maps the XML element names to the tag implementations
the JSP file that uses the tag library
When the first two components are done, you can use the tag by using taglib directive:
Then you are ready to use the tags you defined. Let's say the tag prefix is test:
MyJSPTag or
JavaBeans are Java utility classes you defined. Beans have a standard format for Java classes. You use tags
to declare a bean and use
to set value of the bean class and use
to get value of the bean class.
Custom tags and beans accomplish the same goals — encapsulating complex behavior into simple and accessible forms. There are several differences:
Custom tags can manipulate JSP content; beans cannot.
Complex operations can be reduced to a significantly simpler form with custom tags than with beans. Custom tags require quite a bit more work to set up than do beans.
Custom tags usually define relatively self-contained behavior, whereas beans are often defined in one servlet and used in a different servlet or JSP page.
Custom tags are available only in JSP 1.1 and later, but beans can be used in all JSP 1.x versions.

What are the two kinds of comments in JSP and what's the difference between them. 
<%– JSP Comment –%>
<!– HTML Comment –>

What is JSP technology?
Java Server Page is a standard Java extension that is defined on top of the servlet Extensions. The goal of JSP is the simplified creation and management of dynamic Web pages. JSPs are secure, platform-independent, and best of all, make use of Java as a server-side scripting language.
What is JSP page?
A JSP page is a text-based document that contains two types of text: static template data, which can be expressed in any text-based format such as HTML, SVG, WML, and XML, and JSP elements, which construct dynamic content.
What are the implicit objects?
Implicit objects are objects that are created by the web container and contain information related to a particular request, page, or application. They are:
–request
–response
–pageContext
–session
–application
–out
–config
–page
–exception
How many JSP scripting elements and what are they?
There are three scripting language elements:
–declarations
–scriptlets
–expressions
Why are JSP pages the preferred API for creating a web-based client program?
Because no plug-ins or security policy files are needed on the client systems(applet does). Also, JSP pages enable cleaner and more module application design because they provide a way to separate applications programming from web page design. This means personnel involved in web page design do not need to understand Java programming language syntax to do their jobs.
Is JSP technology extensible?
YES. JSP technology is extensible through the development of custom actions, or tags, which are encapsulated in tag libraries.
Can we use the constructor, instead of init(), to initialize servlet?
Yes , of course you can use the constructor instead of init(). There’s nothing to stop you. But you shouldn’t. The original reason for init() was that ancient versions of Java couldn’t dynamically invoke constructors with arguments, so there was no way to give the constructur a ServletConfig. That no longer applies, but servlet containers still will only call your no-arg constructor. So you won’t have access to a ServletConfig or ServletContext.
How can a servlet refresh automatically if some new data has entered the database?
You can use a client-side Refresh or Server Push.
The code in a finally clause will never fail to execute, right?
Using System.exit(1); in try block will not allow finally code to execute.
How many messaging models do JMS provide for and what are they?
JMS provide for two messaging models, publish-and-subscribe and point-to-point queuing.
What information is needed to create a TCP Socket?
The Local Systems IP Address and Port Number. And the Remote System’s IPAddress and Port Number.
What Class.forName will do while loading drivers?
It is used to create an instance of a driver and register it with the DriverManager. When you have loaded a driver, it is available for making a connection with a DBMS.
How to Retrieve Warnings?
SQLWarning objects are a subclass of SQLException that deal with database access warnings. Warnings do not stop the execution of an application, as exceptions do; they simply alert the user that something did not happen as planned. A warning can be reported on a Connection object, a Statement object (including PreparedStatement and CallableStatement objects), or a ResultSet object. Each of these classes has a getWarnings method, which you must invoke in order to see the first warning reported on the calling object
SQLWarning warning = stmt.getWarnings(); 
if (warning != null) 
{ 
  while (warning != null) 
  { 
    System.out.println("Message: " +     warning.getMessage()); 
    System.out.println("SQLState: " +     warning.getSQLState()); 
    System.out.print("Vendor error code: ");     System.out.println(warning.getErrorCode()); 
    warning = warning.getNextWarning();
   } 
}

17. How many JSP scripting elements are there and what are they?
There are three scripting language elements: declarations, scriptlets, expressions.
In the Servlet 2.4 specification SingleThreadModel has been deprecated, why?
Because it is not practical to have such model. Whether you set isThreadSafe to true or false, you should take care of concurrent client requests to the JSP page by synchronizing access to any shared objects defined at the page level.
What are stored procedures? How is it useful?
A stored procedure is a set of statements/commands which reside in the database. The stored procedure is pre-compiled and saves the database the effort of parsing and compiling sql statements everytime a query is run. Each database has its own stored procedure language, usually a variant of C with a SQL preproceesor. Newer versions of db’s support writing stored procedures in Java and Perl too. Before the advent of 3-tier/n-tier architecture it was pretty common for stored procs to implement the business logic( A lot of systems still do it). The biggest advantage is of course speed. Also certain kind of data manipulations are not achieved in SQL. Stored procs provide a mechanism to do these manipulations. Stored procs are also useful when you want to do Batch updates/exports/houseKeeping kind of stuff on the db. The overhead of a JDBC Connection may be significant in these cases.
How do I include static files within a JSP page?
Static resources should always be included using the JSP include directive. This way, the inclusion is performed just once during the translation phase. Do note that you should always supply a relative URL for the file attribute. Although you can also include static resources using the action, this is not advisable as the inclusion is then performed for each and every request.
Why does JComponent have add() and remove() methods but Component does not?
because JComponent is a subclass of Container, and can contain other components and jcomponents. How can I implement a thread-safe JSP page? - You can make your JSPs thread-safe by having them implement the SingleThreadModel interface. This is done by adding the directive <%@ page isThreadSafe="false" % > within your JSP page.
How can I enable session tracking for JSP pages if the browser has disabled cookies?
We know that session tracking uses cookies by default to associate a session identifier with a unique user. If the browser does not support cookies, or if cookies are disabled, you can still enable session tracking using URL rewriting. URL rewriting essentially includes the session ID within the link itself as a name/value pair.
However, for this to be effective, you need to append the session ID for each and every link that is part of your servlet response. Adding the session ID to a link is greatly simplified by means of of a couple of methods: response.encodeURL() associates a session ID with a given URL, and if you are using redirection, response.encodeRedirectURL() can be used by giving the redirected URL as input.
Both encodeURL() and encodeRedirectedURL() first determine whether cookies are supported by the browser; if so, the input URL is returned unchanged since the session ID will be persisted as a cookie. Consider the following example, in which two JSP files, say hello1.jsp and hello2.jsp, interact with each other.
Basically, we create a new session within hello1.jsp and place an object within this session. The user can then traverse to hello2.jsp by clicking on the link present within the page.Within hello2.jsp, we simply extract the object that was earlier placed in the session and display its contents. Notice that we invoke the encodeURL() within hello1.jsp on the link used to invoke hello2.jsp; if cookies are disabled, the session ID is automatically appended to the URL, allowing hello2.jsp to still retrieve the session object. Try this example first with cookies enabled. Then disable cookie support, restart the brower, and try again. Each time you should see the maintenance of the session across pages.
Do note that to get this example to work with cookies disabled at the browser, your JSP engine has to support URL rewriting.
hello1.jsp
hello2.jsp
hello2.jsp
<%
Integer i= (Integer )session.getValue("num");
out.println("Num value in session is "+i.intValue());


What is a output comment?

A:         A comment that is sent to the client in the viewable page source.The JSP engine handles an output comment as uninterpreted HTML text, returning the comment in the HTML output sent to the client. You can see the comment by viewing the page source from your Web browser.
JSP Syntax
<!-- comment [ <%= expression %> ] -->

Example 1
<!-- This is a commnet sent to client on
<%= (new java.util.Date()).toLocaleString() %>
-->

Displays in the page source:
<!-- This is a commnet sent to client on January 24, 2004 -->


Q:        
What is a Hidden Comment?

A:         A comments that documents the JSP page but is not sent to the client. The JSP engine ignores a hidden comment, and does not process any code within hidden comment tags. A hidden comment is not sent to the client, either in the displayed JSP page or the HTML page source. The hidden comment is useful when you want to hide or "comment out" part of your JSP page.
You can use any characters in the body of the comment except the closing --%> combination. If you need to use --%> in your comment, you can escape it by typing --%\>.
JSP Syntax
<%-- comment --%>

Examples
<%@ page language="java" %>
<html>
<head><title>A Hidden Comment </title></head>
<body>
<%-- This comment will not be visible to the colent in the page source --%>
</body>
</html>


Q:        
What is a Expression?

A:         An expression tag contains a scripting language expression that is evaluated, converted to a String, and inserted where the expression appears in the JSP file. Because the value of an expression is converted to a String, you can use an expression within text in a JSP file. Like
<%= someexpression %>
<%= (new java.util.Date()).toLocaleString() %>
You cannot use a semicolon to end an expression


Q:        
What is a Declaration?

A:         A declaration declares one or more variables or methods for use later in the JSP source file.
A declaration must contain at least one complete declarative statement. You can declare any number of variables or methods within one declaration tag, as long as they are separated by semicolons. The declaration must be valid in the scripting language used in the JSP file.

<%! somedeclarations %>
<%! int i = 0; %>
<%! int a, b, c; %>
  
Q:        
What is a Scriptlet?

A:         A scriptlet can contain any number of language statements, variable or method declarations, or expressions that are valid in the page scripting language.Within scriptlet tags, you can
1.Declare variables or methods to use later in the file (see also Declaration).

2.Write expressions valid in the page scripting language (see also Expression).

3.Use any of the JSP implicit objects or any object declared with a <jsp:useBean> tag.
You must write plain text, HTML-encoded text, or other JSP tags outside the scriptlet.

Scriptlets are executed at request time, when the JSP engine processes the client request. If the scriptlet produces output, the output is stored in the out object, from which you can display it.


Q:        
What are implicit objects? List them?

A:         Certain objects that are available for the use in JSP documents without being declared first. These objects are parsed by the JSP engine and inserted into the generated servlet. The implicit objects re listed below
request
response
pageContext
session
application
out
config
page
exception


Q:        
Difference between forward and sendRedirect?

A:         When you invoke a forward request, the request is sent to another resource on the server, without the client being informed that a different resource is going to process the request. This process occurs completly with in the web container. When a sendRedirtect method is invoked, it causes the web container to return to the browser indicating that a new URL should be requested. Because the browser issues a completly new request any object that are stored as request attributes before the redirect occurs will be lost. This extra round trip a redirect is slower than forward.

Q:        
What are the different scope valiues for the <jsp:useBean>?

A:        
The different scope values for <jsp:useBean> are

page
request
3.session
4.application


Q:        
Explain the life-cycle mehtods in JSP?

A:        
THe generated servlet class for a JSP page implements the HttpJspPage interface of the javax.servlet.jsp package. Hte HttpJspPage interface extends the JspPage interface which inturn extends the Servlet interface of the javax.servlet package. the generated servlet class thus implements all the methods of the these three interfaces. The JspPage interface declares only two mehtods - jspInit() and jspDestroy() that must be implemented by all JSP pages regardless of the client-server protocol. However the JSP specification has provided the HttpJspPage interfaec specifically for the JSp pages serving HTTP requests. This interface declares one method _jspService().
The jspInit()- The container calls the jspInit() to initialize te servlet instance.It is called before any other method, and is called only once for a servlet instance.
The _jspservice()- The container calls the _jspservice() for each request, passing it the request and the response objects.
The jspDestroy()- The container calls this when it decides take the instance out of service. It is the last method called n the servlet instance.



How do I prevent the output of my JSP or Servlet pages from being cached by the browser?

A:         You will need to set the appropriate HTTP header attributes to prevent the dynamic content output by the JSP page from being cached by the browser. Just execute the following scriptlet at the beginning of your JSP pages to prevent them from being cached at the browser. You need both the statements to take care of some of the older browser versions.
<%
response.setHeader("Cache-Control","no-store"); //HTTP 1.1
response.setHeader("Pragma\","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>



Q:        
How does JSP handle run-time exceptions?

A:         You can use the errorPage attribute of the page directive to have uncaught run-time exceptions automatically forwarded to an error processing page. For example:
<%@ page errorPage=\"error.jsp\" %> redirects the browser to the JSP page error.jsp if an uncaught exception is encountered during request processing. Within error.jsp, if you indicate that it is an error-processing page, via the directive: <%@ page isErrorPage=\"true\" %> Throwable object describing the exception may be accessed within the error page via the exception implicit object. Note: You must always use a relative URL as the value for the errorPage attribute.


Q:        
How can I implement a thread-safe JSP page? What are the advantages and Disadvantages of using it?

A:         You can make your JSPs thread-safe by having them implement the SingleThreadModel interface. This is done by adding the directive <%@ page isThreadSafe="false" %> within your JSP page. With this, instead of a single instance of the servlet generated for your JSP page loaded in memory, you will have N instances of the servlet loaded and initialized, with the service method of each instance effectively synchronized. You can typically control the number of instances (N) that are instantiated for all servlets implementing SingleThreadModel through the admin screen for your JSP engine. More importantly, avoid using the tag for variables. If you do use this tag, then you should set isThreadSafe to true, as mentioned above. Otherwise, all requests to that page will access those variables, causing a nasty race condition. SingleThreadModel is not recommended for normal use. There are many pitfalls, including the example above of not being able to use <%! %>. You should try really hard to make them thread-safe the old fashioned way: by making them thread-safe .


Q:        
How do I use a scriptlet to initialize a newly instantiated bean?

A:        
A jsp:useBean action may optionally have a body. If the body is specified, its contents will be automatically invoked when the specified bean is instantiated. Typically, the body will contain scriptlets or jsp:setProperty tags to initialize the newly instantiated bean, although you are not restricted to using those alone.

The following example shows the “today” property of the Foo bean initialized to the current date when it is instantiated. Note that here, we make use of a JSP expression within the jsp:setProperty action.

<jsp:useBean id="foo" class="com.Bar.Foo" >

<jsp:setProperty name="foo" property="today"
value="<%=java.text.DateFormat.getDateInstance().format(new java.util.Date()) %>" / >

<%-- scriptlets calling bean setter methods go here --%>

</jsp:useBean >




Q:        
How can I prevent the word "null" from appearing in my HTML input text fields when I populate them with a resultset that has null values?

A:        
You could make a simple wrapper function, like

<%!
String blanknull(String s) {
return (s == null) ? \"\" : s;
}
%>

then use it inside your JSP form, like

<input type="text" name="lastName" value="<%=blanknull(lastName)% >" >




Q:        
What's a better approach for enabling thread-safe servlets and JSPs? SingleThreadModel Interface or Synchronization?

A:         Although the SingleThreadModel technique is easy to use, and works well for low volume sites, it does not scale well. If you anticipate your users to increase in the future, you may be better off implementing explicit synchronization for your shared data. The key however, is to effectively minimize the amount of code that is synchronzied so that you take maximum advantage of multithreading.
Also, note that SingleThreadModel is pretty resource intensive from the server\'s perspective. The most serious issue however is when the number of concurrent requests exhaust the servlet instance pool. In that case, all the unserviced requests are queued until something becomes free - which results in poor performance. Since the usage is non-deterministic, it may not help much even if you did add more memory and increased the size of the instance pool.



Q:        
How can I enable session tracking for JSP pages if the browser has disabled cookies?

A:         We know that session tracking uses cookies by default to associate a session identifier with a unique user. If the browser does not support cookies, or if cookies are disabled, you can still enable session tracking using URL rewriting. URL rewriting essentially includes the session ID within the link itself as a name/value pair. However, for this to be effective, you need to append the session ID for each and every link that is part of your servlet response. Adding the session ID to a link is greatly simplified by means of of a couple of methods: response.encodeURL() associates a session ID with a given URL, and if you are using redirection, response.encodeRedirectURL() can be used by giving the redirected URL as input. Both encodeURL() and encodeRedirectedURL() first determine whether cookies are supported by the browser; if so, the input URL is returned unchanged since the session ID will be persisted as a cookie.

Consider the following example, in which two JSP files, say hello1.jsp and hello2.jsp, interact with each other. Basically, we create a new session within hello1.jsp and place an object within this session. The user can then traverse to hello2.jsp by clicking on the link present within the page. Within hello2.jsp, we simply extract the object that was earlier placed in the session and display its contents. Notice that we invoke the encodeURL() within hello1.jsp on the link used to invoke hello2.jsp; if cookies are disabled, the session ID is automatically appended to the URL, allowing hello2.jsp to still retrieve the session object. Try this example first with cookies enabled. Then disable cookie support, restart the brower, and try again. Each time you should see the maintenance of the session across pages. Do note that to get this example to work with cookies disabled at the browser, your JSP engine has to support URL rewriting.
hello1.jsp
<%@ page session=\"true\" %>
<%
Integer num = new Integer(100);
session.putValue("num",num);
String url =response.encodeURL("hello2.jsp");
%>
<a href=\'<%=url%>\'>hello2.jsp</a>

hello2.jsp
<%@ page session="true" %>
<%
Integer i= (Integer )session.getValue("num");
out.println("Num value in session is " + i.intValue());
%>


Q:        
What is the difference b/w variable declared inside a declaration part and variable declared in scriplet part?

A:         Variable declared inside declaration part is treated as a global variable.that means after convertion jsp file into servlet that variable will be in outside of service method or it will be declared as instance variable.And the scope is available to complete jsp and to complete in the converted servlet class.where as if u declare a variable inside a scriplet that variable will be declared inside a service method and the scope is with in the service method.


Q:        
Is there a way to execute a JSP from the comandline or from my own application?

A:        
There is a little tool called JSPExecutor that allows you to do just that. The developers (Hendrik Schreiber <hs@webapp.de> & Peter Rossbach <pr@webapp.de>) aim was not to write a full blown servlet engine, but to provide means to use JSP for generating source code or reports. Therefore most HTTP-specific features (headers, sessions, etc) are not implemented, i.e. no reponseline or header is generated. Nevertheless you can use it to precompile JSP for your website.


 What are the implicit objects? - Implicit objects are objects that are created by the web container and contain information related to a particular request, page, or application. They are: request, response, pageContext, session, application, out, config, page, exception.
Is JSP technology extensible? - Yes. JSP technology is extensible through the development of custom actions, or tags, which are encapsulated in tag libraries.
How can I implement a thread-safe JSP page? What are the advantages and Disadvantages of using it? - You can make your JSPs thread-safe by having them implement the SingleThreadModel interface. This is done by adding the directive <%@ page isThreadSafe="false" %> within your JSP page. With this, instead of a single instance of the servlet generated for your JSP page loaded in memory, you will have N instances of the servlet loaded and initialized, with the service method of each instance effectively synchronized. You can typically control the number of instances (N) that are instantiated for all servlets implementing SingleThreadModel through the admin screen for your JSP engine. More importantly, avoid using the <%! DECLARE %>tag for variables. If you do use this tag, then you should set isThreadSafe to true, as mentioned above. Otherwise, all requests to that page will access those variables, causing a nasty race condition. SingleThreadModel is not recommended for normal use. There are many pitfalls, including the example above of not being able to use <%! %>. You should try really hard to make them thread-safe the old fashioned way: by making them thread-safe
How does JSP handle run-time exceptions? - You can use the errorPage attribute of the page directive to have uncaught run-time exceptions automatically forwarded to an error processing page. For example: <%@ page errorPage="error.jsp" %>
redirects the browser to the JSP page error.jsp if an uncaught exception is encountered during request processing. Within error.jsp, if you indicate that it is an error-processing page, via the directive: <%@ page isErrorPage="true" %> Throwable object describing the exception may be accessed within the error page via the exception implicit object. Note: You must always use a relative URL as the value for the errorPage attribute.
How do I prevent the output of my JSP or Servlet pages from being cached by the browser? - You will need to set the appropriate HTTP header attributes to prevent the dynamic content output by the JSP page from being cached by the browser. Just execute the following scriptlet at the beginning of your JSP pages to prevent them from being cached at the browser. You need both the statements to take care of some of the older browser versions.
<%
response.setHeader("Cache-Control","no-store"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
How do I use comments within a JSP page? - You can use “JSP-style” comments to selectively block out code while debugging or simply to comment your scriptlets. JSP comments are not visible at the client. For example:
               <%-- the scriptlet is now commented out
               <%
               out.println("Hello World");
               %>
               --%>
You can also use HTML-style comments anywhere within your JSP page. These comments are visible at the client. For example:
<!-- (c) 2004 -->
Of course, you can also use comments supported by your JSP scripting language within your scriptlets. For example, assuming Java is the scripting language, you can have:
<%
//some comment
/**
yet another comment
**/
%>
Response has already been commited error. What does it mean? - This error show only when you try to redirect a page after you already have written something in your page. This happens because HTTP specification force the header to be set up before the lay out of the page can be shown (to make sure of how it should be displayed, content-type=”text/html” or “text/xml” or “plain-text” or “image/jpg”, etc.) When you try to send a redirect status (Number is line_status_402), your HTTP server cannot send it right now if it hasn’t finished to set up the header. If not starter to set up the header, there are no problems, but if it ’s already begin to set up the header, then your HTTP server expects these headers to be finished setting up and it cannot be the case if the stream of the page is not over… In this last case it’s like you have a file started with <HTML Tag><Some Headers><Body>some output (like testing your variables.) Before you indicate that the file is over (and before the size of the page can be setted up in the header), you try to send a redirect status. It s simply impossible due to the specification of HTTP 1.0 and 1.1
How do I use a scriptlet to initialize a newly instantiated bean? - A jsp:useBean action may optionally have a body. If the body is specified, its contents will be automatically invoked when the specified bean is instantiated. Typically, the body will contain scriptlets or jsp:setProperty tags to initialize the newly instantiated bean, although you are not restricted to using those alone.
The following example shows the “today” property of the Foo bean initialized to the current date when it is instantiated. Note that here, we make use of a JSP expression within the jsp:setProperty action.
<jsp:useBean id="foo" class="com.Bar.Foo" >
<jsp:setProperty name="foo" property="today"
value="<%=java.text.DateFormat.getDateInstance().format(new java.util.Date()) %>"/ >
<%-- scriptlets calling bean setter methods go here --%>
</jsp:useBean >
How can I enable session tracking for JSP pages if the browser has disabled cookies? - We know that session tracking uses cookies by default to associate a session identifier with a unique user. If the browser does not support cookies, or if cookies are disabled, you can still enable session tracking using URL rewriting. URL rewriting essentially includes the session ID within the link itself as a name/value pair. However, for this to be effective, you need to append the session ID for each and every link that is part of your servlet response. Adding the session ID to a link is greatly simplified by means of of a couple of methods: response.encodeURL() associates a session ID with a given URL, and if you are using redirection, response.encodeRedirectURL() can be used by giving the redirected URL as input. Both encodeURL() and encodeRedirectedURL() first determine whether cookies are supported by the browser; if so, the input URL is returned unchanged since the session ID will be persisted as a cookie. Consider the following example, in which two JSP files, say hello1.jsp and hello2.jsp, interact with each other. Basically, we create a new session within hello1.jsp and place an object within this session. The user can then traverse to hello2.jsp by clicking on the link present within the page.Within hello2.jsp, we simply extract the object that was earlier placed in the session and display its contents. Notice that we invoke the encodeURL() within hello1.jsp on the link used to invoke hello2.jsp; if cookies are disabled, the session ID is automatically appended to the URL, allowing hello2.jsp to still retrieve the session object. Try this example first with cookies enabled. Then disable cookie support, restart the brower, and try again. Each time you should see the maintenance of the session across pages. Do note that to get this example to work with cookies disabled at the browser, your JSP engine has to support URL rewriting.
               hello1.jsp
               <%@ page session="true" %>
               <%
               Integer num = new Integer(100);
               session.putValue("num",num);
               String url =response.encodeURL("hello2.jsp");
               %>
               <a href='<%=url%>'>hello2.jsp</a>
               hello2.jsp
               <%@ page session="true" %>
               <%
               Integer i= (Integer )session.getValue("num");
               out.println("Num value in session is "+i.intValue());
How can I declare methods within my JSP page? - You can declare methods for use within your JSP page as declarations. The methods can then be invoked within any other methods you declare, or within JSP scriptlets and expressions. Do note that you do not have direct access to any of the JSP implicit objects like request, response, session and so forth from within JSP methods. However, you should be able to pass any of the implicit JSP variables as parameters to the methods you declare. For example:
               <%!
               public String whereFrom(HttpServletRequest req) {
               HttpSession ses = req.getSession();
               ...
               return req.getRemoteHost();
               }
               %>
               <%
               out.print("Hi there, I see that you are coming in from ");
               %>
               <%= whereFrom(request) %>
               Another Example
               file1.jsp:
               <%@page contentType="text/html"%>
               <%!
               public void test(JspWriter writer) throws IOException{
               writer.println("Hello!");
               }
               %>
               file2.jsp
               <%@include file="file1.jsp"%>
               <html>
               <body>
               <%test(out);% >
               </body>
               </html>
Is there a way I can set the inactivity lease period on a per-session basis? - Typically, a default inactivity lease period for all sessions is set within your JSP engine admin screen or associated properties file. However, if your JSP engine supports the Servlet 2.1 API, you can manage the inactivity lease period on a per-session basis. This is done by invoking the HttpSession.setMaxInactiveInterval() method, right after the session has been created. For example:
               <%
               session.setMaxInactiveInterval(300);
               %>
would reset the inactivity period for this session to 5 minutes. The inactivity interval is set in seconds.
How can I set a cookie and delete a cookie from within a JSP page? - A cookie, mycookie, can be deleted using the following scriptlet:
               <%
               //creating a cookie
               Cookie mycookie = new Cookie("aName","aValue");
               response.addCookie(mycookie);
               //delete a cookie
               Cookie killMyCookie = new Cookie("mycookie", null);
               killMyCookie.setMaxAge(0);
               killMyCookie.setPath("/");
               response.addCookie(killMyCookie);
               %>
How does a servlet communicate with a JSP page? - The following code snippet shows how a servlet instantiates a bean and initializes it with FORM data posted by a browser. The bean is then placed into the request, and the call is then forwarded to the JSP page, Bean1.jsp, by means of a request dispatcher for downstream processing.
               public void doPost (HttpServletRequest request, HttpServletResponse response) {
               try {
                               govi.FormBean f = new govi.FormBean();
                               String id = request.getParameter("id");
                               f.setName(request.getParameter("name"));
                               f.setAddr(request.getParameter("addr"));
                               f.setAge(request.getParameter("age"));
                               //use the id to compute
                               //additional bean properties like info
                               //maybe perform a db query, etc.
                               // . . .
                               f.setPersonalizationInfo(info);
                               request.setAttribute("fBean",f);
                               getServletConfig().getServletContext().getRequestDispatcher
                      ("/jsp/Bean1.jsp").forward(request, response);
                               } catch (Exception ex) {
               . . .
                  }
               }
The JSP page Bean1.jsp can then process fBean, after first extracting it from the default request scope via the useBean action.
jsp:useBean id="fBean" class="govi.FormBean" scope="request"
/ jsp:getProperty name="fBean" property="name"
/ jsp:getProperty name="fBean" property="addr"
/ jsp:getProperty name="fBean" property="age"
/ jsp:getProperty name="fBean" property="personalizationInfo" /
How do I have the JSP-generated servlet subclass my own custom servlet class, instead of the default? - One should be very careful when having JSP pages extend custom servlet classes as opposed to the default one generated by the JSP engine. In doing so, you may lose out on any advanced optimization that may be provided by the JSP engine. In any case, your new superclass has to fulfill the contract with the JSP engine by:
Implementing the HttpJspPage interface, if the protocol used is HTTP, or implementing JspPage otherwise Ensuring that all the methods in the Servlet interface are declared final Additionally, your servlet superclass also needs to do the following:
The service() method has to invoke the _jspService() method
The init() method has to invoke the jspInit() method
The destroy() method has to invoke jspDestroy()
If any of the above conditions are not satisfied, the JSP engine may throw a translation error.
Once the superclass has been developed, you can have your JSP extend it as follows:
<%@ page extends="packageName.ServletName" %>
How can I prevent the word "null" from appearing in my HTML input text fields when I populate them with a resultset that has null values? - You could make a simple wrapper function, like
               <%!
               String blanknull(String s) {
               return (s == null) ? "" : s;
               }
               %>
               then use it inside your JSP form, like
               <input type="text" name="shoesize" value="<%=blanknull(shoesize)% >" >
How can I get to print the stacktrace for an exception occuring within my JSP page? - By printing out the exception’s stack trace, you can usually diagonse a problem better when debugging JSP pages. By looking at a stack trace, a programmer should be able to discern which method threw the exception and which method called that method. However, you cannot print the stacktrace using the JSP out implicit variable, which is of type JspWriter. You will have to use a PrintWriter object instead. The following snippet demonstrates how you can print a stacktrace from within a JSP error page:
               <%@ page isErrorPage="true" %>
               <%
               out.println("              ");
                PrintWriter pw = response.getWriter();
                exception.printStackTrace(pw);
               out.println(" ");
               %>
How do you pass an InitParameter to a JSP? - The JspPage interface defines the jspInit() and jspDestroy() method which the page writer can use in their pages and are invoked in much the same manner as the init() and destory() methods of a servlet. The example page below enumerates through all the parameters and prints them to the console.
               <%@ page import="java.util.*" %>
               <%!
               ServletConfig cfg =null;
               public void jspInit(){
               ServletConfig cfg=getServletConfig();
               for (Enumeration e=cfg.getInitParameterNames(); e.hasMoreElements();) {
               String name=(String)e.nextElement();
               String value = cfg.getInitParameter(name);
               System.out.println(name+"="+value);
               }
               }
               %>
How can my JSP page communicate with an EJB Session Bean? - The following is a code snippet that demonstrates how a JSP page can interact with an EJB session bean:
               <%@ page import="javax.naming.*, javax.rmi.PortableRemoteObject, foo.AccountHome, foo.Account" %>
               <%!
               //declare a "global" reference to an instance of the home interface of the session bean
               AccountHome accHome=null;
               public void jspInit() {
               //obtain an instance of the home interface
               InitialContext cntxt = new InitialContext( );
               Object ref= cntxt.lookup("java:comp/env/ejb/AccountEJB");
               accHome = (AccountHome)PortableRemoteObject.narrow(ref,AccountHome.class);
               }
               %>
               <%
               //instantiate the session bean
               Account acct = accHome.create();
               //invoke the remote methods
               acct.doWhatever(...);
               // etc etc...
%>



#1. What is JSP?
Ans:- JSP Stands for Java server pages. JSP is Java technology which is used by developers across the world to create dynamically generated websites with the easy use of other documents like HTML, XML. This technology of java allows developers to include java code and some pre defined actions into static content. Java server pages are compiled into java servlet by the java compiler or the java compiler may directly generate the byte code for the servlet.

> 
#2. How servlet differ from JSP?
Ans:- Both Servlet and Java Server Pages are API which generate dynamic web content. A servlet is nothing but a java class which implements the interface to run within a web and on the other hand Java server pages is a bit complicated thing which contain a mixture of Java scripts, Java directives, Java elements and HTML.  The main difference among both servlet and Java server pages is that JSP is document oriented and servlet on the other hand act likes a program.

> 
#3. What are the advantages of JSP?
Ans:- There are many advantages of JSP and JSP is very much preferred by every coder. The main advantage of JSP over anything is its auto compilation and the length of code is reduced by using custom tags and tag library. Secondly, it is portable that is it works on all operating system and non – Microsoft web servers. Java components can be easily embedded into the dynamic pages. JSP have all the features of java and can easily separate dynamic part from the static part of the page.

> 
#4. What are the implicit objects in JSP?
Ans:- There are all total 9 implicit objects in JSP. Application interface refers to the web application’s interface whereas Session interface refers to the user’s session. Request interface refers to the page which is currently requested whereas Response interface refers to the response which is currently made by the user. Config interface refers to the servlet configuration. Class like out, page, page Context and exception refers to the output stream of the page, servlet instance of the page, environment of the page, error handling respectively.

> 
#5. How JSP calls a stored procedure?
Ans:- Java Server Pages possess all the characteristics of java and to call and have similar syntax to call a function. Functions and stored procedures of a database can be called by using the statement callable. Another way to call the stored procedure is by writing the JDBC code in between the tag of scriptlet tab.write.

> 
#6. How to override the lifecycle methods of JSP?
Ans:- Lifecycle method jspService() cannot be overridden within a JSP page however methods like jspInit() and jspDestroy() can be overridden within a JSP page. Method jspInit() is used for allocating resource while method jspDestroy() is used to free allocated resource. But it should be kept in mind that during the lifecycle of a Java Server Page both the method jsplnit() and jspDestroy() is executed once and are declared as JSP declarations.

> 
#7. What is declaration in JSP?
Ans:- In Java Server pages Declaration is used to declare and define variables and methods that can be used in the Java Server Pages. The variable which is declared is initialized once and it retain its value for every subsequent client request.

> 
#8. How a run - time application is handled in JSP?
Ans:- In JSP the errorpage attribute of the page is used as a directive to have uncaught run – time exceptions and which is automatically forwarded to an page which processes the error. If an uncaught exception is encountered while processing the request, then the browser redirects to the JSP error page.

> 
#9. State the difference between the expression and scriptlet?
Ans:-  JSP, Expressions is used to display the values of variable or to return the values by invoking the getter methods. However, JSP expressions begins with <> and does not have semicolon at the end of the expression. Scriptlet can contain variable, method or expressions that are valid within the page scripting language. Within the scripting tags and page scripting language any valid operations can be performed.

> 
#10. Outline the difference between Java server page forward and servlet forward method?
The only minor difference between both the methods is that Java Server page forward method can’t forward to another JSP page in another web application or container whereas servlet forward method can do so.

> 
#11. What are custom tags and why it is needed? 
JSP tags are extended by creating a custom set of tags which is called as tag library (taglib). The page which uses custom tags declares taglib and uniquely names, defines and associates a tag prefix to differentiate the usage of those tags.

> 
#12. How cookies is deleted in JSP?
There are two ways by which the cookies can be deleted in JSP. Firstly, by setting the setMaxAge() of the cookie class to zero. And secondly by setting a timer in the header file that is response. setHeader(expires {Mention the time} attribute), which will delete the cookies after that prescribed time.

> 
#13. Is it possible by a JSP page to process HTML form data?
Yes it is possible by simply obtaining the data from the FORM input via the request implicit object which lies with a scriptlet or expression but it doesn't require to implement any HTTP – Protocol methods like goGet() or doPost() within the JSP page.

>
#14. How method is declared within JSP page?
Methods can be declared for use within JSP page as declaration and this method can be invoked within any other method which is declared or within JSP scriptlets or expressions. Direct access to the JSP implicit objects like request, response, session etc is forbidden within JSP methods but implicit Java server page variable is allowed to pass as parameters to the method which is declared.

> 
#15. Outline the major difference between the session and cookie?
Sessions are always stored in the server side whereas cookies are always stored in the client side.