| Author |
A few clarifications needed please...
|
Manjunath Subramanian
Ranch Hand
Joined: Jul 18, 2001
Posts: 236
|
|
1) Where,how and why do we use <jsp:id> 2) How do we give JSP file names in <jsp-file> in DD.It should start with a '/' i think..I am not clear as to how to do this. 3) Things about <jsp:expressions> tag where, what ever is there in between the starting(<%) and closing (%> tags should be able to get converted into String. What kind of situations will cause this to fail?I know symbols,comments and spaces which are not quoted will fail..But any object or primitive put inside the tag will not fail.. Some light on this please. Thanks a ton in advance, Manjunath (Will come with more questions soon..Reading the JSP specs has dulled my memory )
|
 |
Manjunath Subramanian
Ranch Hand
Joined: Jul 18, 2001
Posts: 236
|
|
Nobody wants' to help???
|
 |
james edwin
Ranch Hand
Joined: Nov 22, 2001
Posts: 393
|
|
hi, Answers r as follows:- >1) Where,how and why do we use <jsp:id> Like this " <jsp:useBean id="someObj" scope="page" class="com.abc.SomeClassName" />" To create the instance of the the bean.In this we r not creating object by using new operator of java.when JSP engine see JSP id ,it will create instance for us depending on the scope. >2) How do we give JSP file names in <jsp-file> in DD.It should start with a '/' i think..I am not clear as to how to do this. These r used in DD ,i don't remeber exactly but it's related to some redirection in servlets..to tell servlet that there r jsp file.but never used. >3)3) Things about <jsp:expressions> tag where, what ever is there in between the starting(<%) and closing (%> tags should be able to get converted into String. What kind of situations will cause this to fail?I know symbols,comments and spaces which are not quoted will fail..But any object or primitive put inside the tag will not fail.. didn't get this what do u want to ask in this clearly.pls exaplin more. Thanks
|
Regards,
James
|
 |
Manjunath Subramanian
Ranch Hand
Joined: Jul 18, 2001
Posts: 236
|
|
Thanks for the reply James..I appreciate that.. Quote from page 94 in JSP Specs "A JSP container may, optionally, support a jsp:id attribute. This attribute can only be present in the XML view of a JSP page and can be used to improve the qual-ity of translation time error messages. It is optional, and a conforming JSP container may choose not to support it." The id attribute with <jsp:useBean> may be one example.But i would like an explanation on what is quoted above.I believe that jsp:id attribute can also be used with other actions.If this is true how do we use it..That's what is my doubt. 2.How to give jsp-file names in DD 3.What i was actually asking was .. <%= xxx %>.What would be the value of xxx if the code has to fail,other than comments,spaces.What kind of xxx cannot be converted to a String? Thanks once again, Manjunath [ February 07, 2002: Message edited by: Manjunath Subramanian ]
|
 |
james edwin
Ranch Hand
Joined: Nov 22, 2001
Posts: 393
|
|
hi, regarding 01 Question I think JSP id is used in some using with XML never used. 2) dtd ....used in redirecting..right now not able to recall. 3) expression Quote from the JSP syntax card is "Description An expression element contains a scripting language expression that is evaluated, converted to a String, and inserted into the response where the expression appears in the JSP page. Because the value of an expression is converted to a String, you can use an expression within a line of text, whether or not it is tagged with HTML, in a JSP page. The expression element can contain any expression that is a valid page scripting language. When the Java programming language is the scripting language you do not use a semicolon to end the expression. However, the same expression within a scriptlet requires the semicolon" UNQUOTE Expression will fail,if u have not declared objects and try to use or print that pbject in expression,it will fail.like normal java code.
|
 |
Naveen Gabrani
Greenhorn
Joined: Jul 12, 2000
Posts: 25
|
|
In response to point 2 - jsp-file may be used instead of servlet-class within the servlet attribute. for example - <web-app> ... <servlet> <servlet-name>abc</servlet-name> <jsp-file>name of jsp file</jsp-file> </servlet> ... </web-app>
|
 |
Guy Allard
Ranch Hand
Joined: Nov 24, 2000
Posts: 776
|
|
1) <jsp:id> is new in the final specs, I have not absorbed it yet. I doubt it is mentioned on the test. 2) <jsp-name> - use a / at the start, relative to the application context. Full file name, e.g. /somedir/Afile.jsp 3) Any valid expression in the scripting language (i.e. Java) which can be a string. The generated code is: out.print( .... expression ....); HTH, Guy
|
 |
Madhav Lakkapragada
Ranch Hand
Joined: Jun 03, 2000
Posts: 5040
|
|
<jsp:id> I have been struggling to put forward an example of using this but haven't had any success so far. Its mentioned as an attribute with a type String, in the DTD. But attribute to what - every element I guess? So if its an attribute to every element, how do I give it a value <jsp:id>SomeValue</jsp:id> - Tomcat doesn't like this definition. Then I tried <jsp:id=SomeValue/> Nope. Then I tried with a custom tag <test:innerTag jsp:id="InnerTagError" /> This also failed because my tag doesn't have this attribute defined in the TLD. Not sure what else to do.......... - satya
|
Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
|
 |
ersin eser
Ranch Hand
Joined: Feb 22, 2001
Posts: 1072
|
|
When jsp gets translated xml view of the document is built and container will know that a tag came from this # row this and that # column by assigning each element in to xml tree with an unique id, JSP spec indicates that these id s can be put into xml document that being created by using jsp:id ! so container's support will enable you to use jsp:id info during validation But validation done thru XML logic so you retrieve jsp:id as follows [ February 08, 2002: Message edited by: ersin eser ]
|
 |
Madhav Lakkapragada
Ranch Hand
Joined: Jun 03, 2000
Posts: 5040
|
|
But validation done thru XML logic so you retrieve jsp:id as follows I follow the API for getId(...) in the ValidationMessage class. BUT, where and how do I specify the String value for this attribute. I am trying to specify it in my XML-style JSP. Tha other fact that is frustrating is that it is the container that supports....DUH!!! So should I specify it in the web.xml ? I tried a search in the JSP forum, no luck. More Servlets Index no luck. www.jguru.com - no luck (well millions of hits but some match jsp and some match id words, nothing jsp:id, ofcourse you know I din't check each page). forums.java.sun.com JSP forum, no luck..... - satya
|
 |
Madhav Lakkapragada
Ranch Hand
Joined: Jun 03, 2000
Posts: 5040
|
|
and BTW, the reason I am working so hard is to prove that it is different from the id attribute that you specify in the useBean tag. I hate to make a plain stmt like that and so wanted to say it with an example. I have the validate() code and the ValidationMessage obj everything correctly setup, but jsp:id is what is bugging me........ well, my homework for the weekend. hmmmm....last weekend it was the Path. - satya
|
 |
Axel Janssen
Ranch Hand
Joined: Jan 08, 2001
Posts: 2164
|
|
Hi, will probably check this more thoroughly later. I am very sure that it is indeed diferent from the id attribute that you specify in the useBean tag. Why not have attributes with the same name in two different xml-tags? Think that Ersins and Guys posts go in the right direction. Perhabs maybe just for "better tool support"? For IDEs to create xml-jsps? just_speculating_friday_Axel
|
 |
Madhav Lakkapragada
Ranch Hand
Joined: Jun 03, 2000
Posts: 5040
|
|
Think that Ersins and Guys posts go in the right direction. Perhabs maybe just for "better tool support"? For IDEs to create xml-jsps? Actually, I know exactly why they are used.....reading the Spec and agree with what ersin and Guy explained. I am however, struggling with to implement it as a demo before disgesting the fact. - satya
|
 |
 |
|
|
subject: A few clarifications needed please...
|
|
|