• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Few Doubts in HFSJ book

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am planning to take the exam on the 13 th of March. I have a few doubts.Could u please get them clarified ?

1) Its mentioned in HFSJ that EL handles null values gracefully and doesnt print null if a null value is passed.
But on pg :509

<mytags:simple>
message is ${message}
</mytags:simple>
its said that if${message occurs out of the scope of the tag null will be printed .
Isnt it supposed to not print anything rather than null


2) while we are implementing the tag handler class are we supposed to write a no arg constructor in the tag handler in case we have a constructor which takes in one argument
for ex :
class Test extends SimpleTag Support
{
Test(int a)
{ }
// attribute setters and getters defined here

}
Now will the above code compile if i dont write a no arg constructor ?


3) response.encodeRedirectURL()does redirecting to a URL inaddition to encoding the url . Am i right here ? But in the mock exam there is a qn which asks which of the following methods can redirect to a different URL (one option given is response.encoderedirectURL) but response.encodeRedirectURl is not given as a correct option there.Could u please clarify on this issue as wel

Thanking u in advance,
Georgy
 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

1) Pl. specify the full description about this. The message is attribute or variable.



2) while we are implementing the tag handler class are we supposed to write a no arg constructor in the tag handler in case we have a constructor which takes in one argument
for ex :
class Test extends SimpleTag Support
{
Test(int a)
{ }
// attribute setters and getters defined here

}
Now will the above code compile if i dont write a no arg constructor ?



I think there is no compilation error the file will compile successfully. The compile-time error occurs when you use the Tag in the JSP file. Because at the time of compilation of JSP file the container validate all the tag libraries. The containe will not find the default construcutor for the tag handler and give compile time error.

Thanks




3) response.encodeRedirectURL()does redirecting to a URL inaddition to encoding the url . Am i right here ? But in the mock exam there is a qn which asks which of the following methods can redirect to a different URL (one option given is response.encoderedirectURL) but response.encodeRedirectURl is not given as a correct option there.Could u please clarify on this issue as wel



The response.encodeRedirectURL does not do the redirecting job. It only encode the URL. You still require to use the sendRedirect.
 
georgy jacob
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you so much Narendra . My doubt has been cleared

For the first querry message is an attribute which is set in the tag handler
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Assuming that the "message" attribute is placed in page scope, this attribute is visible onlt in the tag. that in <prefix.tag> .... </prefix.tag> including body.

Thanks
 
It runs on an internal combustion engine. This ad does not:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic