Somesh Rathi

Ranch Hand
+ Follow
since Apr 27, 2006
Somesh likes ...
Hibernate Eclipse IDE Oracle
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Somesh Rathi

I'm looking here for SWT approach (to display menu programmatically) , and not the AWT. Thanks for your attention.
Need urgent help.. Thanks
11 years ago
Thanks a lot Vishal for nice explainantion!

Regards,
Somesh
What will happen if no value of auth-constraint is specified ?
i.e. <auth-constraint/>

Regards,
Somesh
Hi ,
So What is final conclusion considering the SCWCD exam ? Is WEB-INF Directory mandatory or not ?
Thanks everyone for your responses , particularly Christophe & Bert for paying attention to this particular thread. When posting the question, I didn't imagine that it would be such a big topic of Discussion.

Regards,
Somesh
Hi,
If no method is specified , default implementation of service() will internally call the doGet() method. Hence B is correct.
Thanks a lot everyone!
I got it . Class loading means JVM will allocate some memory for the class. It will happen only once. Where instantiating will happen everytime object of that clas is created.

Thanks for your response !

Regards,
Somesh
Hi Ranchers,
As I understand, JSP pages can execute without WEB-INF directory. Hence is it mandatory for WEb application to have WEB-INF directory ?

Thanks
Regards,
Somesh
Hi Ranchers,
I have some silly but significant doubt related to Servlet Life cycle

What is the difference between Loading the servlet & instantiating the servlet ?
Heartly Congratulations , varun
15 years ago
THanks Ankit & Ulf for the reply. I'll try to find out details & will get back to you for more clarification
Thanks ,
Somesh
Hi Bennet,
I got it. Thanks for clarification. PageContext.getOut() will return the current JspWriter stream being for response. In doStartTag(), we are sending some part of response & in doAfterBody() , we are sending the remaining response.
Many thanks for your kind attention.
Regards,
Somesh
Hi Bennet,
Thats correct ! Your code seems to be much simpler. Thanks a lot for sharing !
I just have one doubt . We are setting the font color in doStartTag() using the JSPWriter out object. As I understand we are using the same instance of JSPWriter object ( through which we have set the font ) in doAfterBody(). Please let me know whether my understanding is correct !

Regards,
Somesh
Hi,
For displaying the body content in RED ,
  • Define the attribute for the tag lets say color
  • Define the tag with Body & attribute in TLD file
  • Extend your tagHandler class from BodyTagSupport Class,

  • write the corresponding getter method for that attribute
  • Return the EVAL_BODY_BUFFERED constant from doStartTag()

  • Overrride the setBodyContent() & doInitBody() methods, that will be called after the doStartTag()
  • Give the implementation of doAfterBody() as follows

  • Get the JSPWriter object using bodyContent.getEnclosingWriter()
    Get the body string using bodyContetn.getString();
    Get the value of color attribute using the getter();
    Format the body using the color value
    Send the formatted content to the JSPWriter using the out.print()

    Hope this helps.. Please let me know if there is some diferent appraoch.

    REgards,
    Somesh
    Hi Ranchers,
    I know that Head method works exactly like the get method but it only returns the HTTP header information without any body.
    However I have never seen any example till now in which doHead() is overrriden.
    Hence Could you please let me know
    1) How to print the HTTP Header information using doHead() i.e.what whould be defintion of overriden doHead() ?
    2) How to make a HEAD request from the browser ?

    Many thanks is advance !
    Regards,
    Somesh
    I have read in Hanwant Deshmukh SCWCD book that " a SimpleTag's body must not contain scripts - no declarations, expressions, or scriplets. Hence for SimpleTAgs's body , you cant set the <body-content> as JSP ..

    My question why is this restriction in SimpleTag while we can use the same in custom Tag ?

    Many Thanks in advance !
    Regards,
    Somesh