• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MoreServlets and Java Server Pages - question

 
Sita Kotamraju
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Chapter 3, RepeatExample.jsp,
<%@ taglib uri="msajsp-taglib.tld" prefix="msajsp" %>
<OL>
<!-- Repeats N times. A null reps value means repeat once. -->
<msajsp:repeat reps='<%= request.getParameter("repeats") %>'>
<LI><msajsp rime length="40" />
</msajsp:repeat>
where is the "repeats" coming from??? Did I overlook something here?
 
ersin eser
Ranch Hand
Posts: 1072
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Itshould in the msajsp-taglib.tld file under
<taglib>
<tag>
<name>repeats</name>
</tag>
</taglib>
 
Sita Kotamraju
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thats right, but where is the "Value" of repeats being set? in the .tld the attribute "repeats" is declared, in the tag handler, there is a setter method what I don't understand is, where the repeats is being set?
I dont see the setReps being called anywhere in anyway?
[ January 26, 2002: Message edited by: Sita Kotamraju ]
 
Ram Dhan Yadav K
Ranch Hand
Posts: 321
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
request.getParameter("repeats")
indicates that, the repeats is passed as a request parameter i.e from a submitted.
Now if the reps attribtue is set automatically in the tag library during the invocation of the tag. But if no "repeats" is passed through the request, then the tag library will be called one and hence it will be one repetition for null value of "repeats".
I guess, i am sounding correct. Well correct me if i am wrong.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ram Dhan is correct. The vaue of repeats comes from the request parameter repeats.
Sita, if you have observed the URL in figure 3-26 of this chapter it is like this:
http://localhost/jsp-intro/RepeatExample.jsp?repeats=10
You see the value of repeats in the URL above.
IMPORTANT NOTE:
Chapter 3 covers Custom Tags for JSP 1.1 not 1.2.
You need to read Chapter 11 for the JSP 1.2 version. You should observe that there are some very important difference between these two. Esp. the element names. I was so abt this. This is the only rant I have re this book so far.
regds.
- satya
 
Ram Dhan Yadav K
Ranch Hand
Posts: 321
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Atleast one question i anwsered correctly, time to chill out!
 
Sita Kotamraju
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ram and Madhav.
Madhav, I overlooked the repeats in the url when I posted this message and then I realized that later.
You are right about the book. Also, I don't understand why the code examples show the older version methods/constants and then the latest version code in comments, when the book is for 1.2/2.3
Ram, which book(s) did you use scwcd for preparation? In a few weeks I will ask you the same question for the architects exam also Good luck with your exam on 31st.
Thanks Again,
Sita
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You are right about the book. Also, I don't understand why the code examples show the older version methods/constants and then the latest version code in comments, when the book is for 1.2/2.3

Well, one way to look at it is that the author uses 1.1 version in Chapter 3 which is an Introduction to JSP and then moves on to the 1.2 version in the rest of the book.
While this maybe a good approach, since I am preparing for SCWCD which uses 1.2, it just rubbed me on the wrong side...
- satya
 
Ram Dhan Yadav K
Ranch Hand
Posts: 321
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well first let me pass the exam, then i will tell what all i read! You are most welcome sita for any sort of guidance from me. Anyway, thanks for the wishes!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic