• 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

doubts in servlets concepts

 
Ranch Hand
Posts: 56
Python Windows Vista Flex
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi to all professionals who are helping me to learning lot in this forum,i need to know about servlet context interface and servlet config interface, i know the definition but i want to know how it works or used on servlet practically
 
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
A forum is not a suitable substitute for a tutorial or the documentation. Have you read the javadoc entries for those classes? If so, what specific question do you have regarding them?
 
Ranch Hand
Posts: 63
Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ServletContext is whole application based(common for all servlets inside an application), any attribute you want to be available on application level we set it into servletcontext.Although servletconfig is individual to one servlet.Take an example :

App1->four servlets

ServletContext-1
ServletConfig -4

ServletConfig contains individual servlet name ,their parameters declared inside <init-param> of web.xml.For more check ServletContext,ServletConfig
 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Niraj Jha wrote:ServletContext is whole application based(common for all servlets inside an application), any attribute you want to be available on application level we set it into servletcontext.Although servletconfig is individual to one servlet.Take an example :

App1->four servlets

ServletContext-1
ServletConfig -4

ServletConfig contains individual servlet name ,their parameters declared inside <init-param> of web.xml.For more check ServletContext,ServletConfig


actually i know the definition of both interfaces servlet context-we can acess data from its environment,it is common to all servletes,we can share information through servlet context,even we can use this in request dispatcher
servlet config-to pass initilization information from deployment descriptor to servlet via init() method'
i need practically with example how it works or useful in servlets
 
sekhar kiran
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:A forum is not a suitable substitute for a tutorial or the documentation. Have you read the javadoc entries for those classes? If so, what specific question do you have regarding them?


i know its forum for discussion about to related topics,i know concepts but i have regarding queries based on the concepts which i tried to clarify my doubts and develop in code
 
Niraj Jha
Ranch Hand
Posts: 63
Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you know everything then what is your doubt?
 
Bear Bibeault
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

sekhar kiran wrote:

Bear Bibeault wrote:A forum is not a suitable substitute for a tutorial or the documentation. Have you read the javadoc entries for those classes? If so, what specific question do you have regarding them?


i know its forum for discussion about to related topics,i know concepts but i have regarding queries based on the concepts which i tried to clarify my doubts and develop in code


Again, what specific questions do you have? Just saying "I want to know about it" is not enough to give an answer to.
 
sekhar kiran
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Niraj Jha wrote:If you know everything then what is your doubt?


i mean how we can use in servelt both interface?what kind of situation, iam expecting if you provide any simple example it will be a very useful then i will catch you
 
sekhar kiran
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
any one can post any examples
 
Ranch Hand
Posts: 90
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, as Bear Bibeault said your topic is generic and you must post a more specific question, but I give you a generic answer and example, The ServletConfig is a interface that have methods to get information releted only to the servlet, as its name, and init parameters. The ServletContext is a more generic interface is as an ApplicationContext, it's generic for the whole application, with this interface you can get the global init parameters set an get attributes that are visible for the all application, and more. I give you an example.


I hope this help you
Kind regards
Cesar
 
Bear Bibeault
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

Cesar Loachamin wrote:Hi, as Bear Bibeault said your topic is generic and you must post a more specific question


I was not directing that to you. I want to know what specific questions the OP has. As I've said, just asking a vague question about a subject is better answered by a tutorial than a forum post.
 
sekhar kiran
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Cesar Loachamin wrote:Hi, as Bear Bibeault said your topic is generic and you must post a more specific question, but I give you a generic answer and example, The ServletConfig is a interface that have methods to get information releted only to the servlet, as its name, and init parameters. The ServletContext is a more generic interface is as an ApplicationContext, it's generic for the whole application, with this interface you can get the global init parameters set an get attributes that are visible for the all application, and more. I give you an example.


I hope this help you
Kind regards
Cesar


hi thanks for reply,actually your giving logic ,but iam looking for practically i mean if we use servlet config what is useful and how it collects param name and values,if i execute the program i will got the logic,what have to provide in web.xml and how to use servlet cofig,if i exceute it iwill understand
 
sekhar kiran
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is servlet and jsp is interface or class?how do you check api like in core java javap java.util.ArrayList
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See http://docs.oracle.com/javaee/6/api/. If you look through the methods in javax.servlet.ServletConfig and javax.servlet.ServletContext it should become clear why they're useful (just ask yourself: if method X wasn't there, how would I accomplish what it does?).

I agree with Bear that working through a Servlet/JSP introduction or tutorial would probably serve you better at this point; you seem to have fundamental questions about these topics than can't be explained in a forum discussion like this.
 
sekhar kiran
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:See http://docs.oracle.com/javaee/6/api/. If you look through the methods in javax.servlet.ServletConfig and javax.servlet.ServletContext it should become clear why they're useful (just ask yourself: if method X wasn't there, how would I accomplish what it does?).

I agree with Bear that working through a Servlet/JSP introduction or tutorial would probably serve you better at this point; you seem to have fundamental questions about these topics than can't be explained in a forum discussion like this.


now i understand about servlet config and sevlet context, how to see java api like if we type in command javap java.lang.String means it shows full details like the way for jsp and servlets
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sekhar kiran wrote: how to see java api like if we type in command javap java.lang.String means it shows full details like the way for jsp and servlets


Add the JEE Javadoc to the IDE you are using.
 
sekhar kiran
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Amit Ghorpade wrote:

sekhar kiran wrote: how to see java api like if we type in command javap java.lang.String means it shows full details like the way for jsp and servlets


Add the JEE Javadoc to the IDE you are using.


i cant understand what are you trying to say, is it possible to check java api in command like core java
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use javap on any class at all, if that's what you're asking. Just specify your classpath to include the class you wanted to disassemble. I'm not sure why you would want to do that, but then again perhaps that wasn't what you were asking. To tell the truth I couldn't really tell what your question was.
 
sekhar kiran
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:You can use javap on any class at all, if that's what you're asking. Just specify your classpath to include the class you wanted to disassemble. I'm not sure why you would want to do that, but then again perhaps that wasn't what you were asking. To tell the truth I couldn't really tell what your question was.


yeah , here my doubt is how to see in servlet and jsp ,is they are all interface,iam trying this in command like javap javax.servlet.ServletConfig or javap javax.servlet.HttpServlet it shows error ERROR:Could not find javax.http.ServletConfig
 
Amit Ghorpade
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sekhar kiran wrote:it shows error ERROR:Could not find javax.http.ServletConfig


That is because the class was not found in the classpath.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems kind of pointless to spend time trying to run javap on those interfaces when the API documentation gives you the same information as javap and a lot more.
 
sekhar kiran
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:It seems kind of pointless to spend time trying to run javap on those interfaces when the API documentation gives you the same information as javap and a lot more.

i think your mentioning link which provided in previous post,i just want to know is it possible to see javaapi in command like what we seen in core java(example string,stringbuilder,collections)
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That has already been answered with "yes", and it has been pointed out to you why it doesn't work the way you are doing it. Please take the time to read and understand what the people who are trying to help you are writing.
 
sekhar kiran
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Amit Ghorpade wrote:

sekhar kiran wrote:it shows error ERROR:Could not find javax.http.ServletConfig


That is because the class was not found in the classpath.


ok so what is the correct command to get it
 
sekhar kiran
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:That has already been answered with "yes", and it has been pointed out to you why it doesn't work the way you are doing it. Please take the time to read and understand what the people who are trying to help you are writing.


so whats the correct command to see the details
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's a link to the javap documentation: http://docs.oracle.com/javase/6/docs/technotes/tools/windows/javap.html
 
Amit Ghorpade
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sekhar kiran wrote:so whats the correct command to see the details


javap
 
Too many men are afraid of being fools - Henry Ford. Foolish tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic