aspose file tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes MoreServlets and Java Server Pages - question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "MoreServlets and Java Server Pages - question" Watch "MoreServlets and Java Server Pages - question" New topic
Author

MoreServlets and Java Server Pages - question

Sita Kotamraju
Ranch Hand

Joined: Nov 30, 2001
Posts: 60
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

Joined: Feb 22, 2001
Posts: 1072
Itshould in the msajsp-taglib.tld file under
<taglib>
<tag>
<name>repeats</name>
</tag>
</taglib>
Sita Kotamraju
Ranch Hand

Joined: Nov 30, 2001
Posts: 60
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

Joined: Aug 13, 2001
Posts: 321
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.


Ram Dhan Yadav (SCJP, SCWCD, SCJA-I, IBM EC(483))
"We are what we repeatedly do. Excellence, then, is not an act, but a habit."
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
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


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Ram Dhan Yadav K
Ranch Hand

Joined: Aug 13, 2001
Posts: 321
Atleast one question i anwsered correctly, time to chill out!
Sita Kotamraju
Ranch Hand

Joined: Nov 30, 2001
Posts: 60
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

Joined: Jun 03, 2000
Posts: 5040

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

Joined: Aug 13, 2001
Posts: 321
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!
 
 
subject: MoreServlets and Java Server Pages - question
 
Threads others viewed
Another one
jsp tag...
Taglib uri..problem..(need help)
Problem in reading Servlet's Init parameters!
Transforming web.xml
MyEclipse, The Clear Choice