Subj : Re: Using Rhino from JSP or like JSP To : McKinley, Richard From : Igor Bukanov Date : Fri Aug 13 2004 10:00 pm McKinley, Richard wrote: > Igor Bukanov wrote: > >>> If I can create something nice would you want a JSP taglib for Rhino >>> submitted? >> >> >> >> YES! >> >> Regards, Igor > > > I am designing the JSP taglib tag names and their required attributes. > The tags will be 'script', 'expression' (with the aliases of 'express' > for those who think in verb sense and 'ex' because it should be short) > and 'write' with a short alias of 'out'. 'script' will be for > multi-line body evaluation and 'expression' for a single expression. > > The url for the taglib will look like this: > <%@ taglib uri="http://javascript.mozilla.org/tools/taglib" > prefix="rhino"%> > > As you can see the user is in control of what prefix they choose. So > they can think of Rhino in whatever sense they choose. 'prefix' could > be set to "javascript", "JScript", "js", "e4x" or anything else. That > way the vocabulary can fit their personal terminology. > > An example: > > > var userName = request.getParameter("user-name"); > > > >

I see your name is userName!

> if(userName != "Bob") { >

Say "Hi" to Bob if you see him.

> } else { >

Bob, it is nice to see you again.

> } > > Any questions or suggestions are welcome. What do you think of > individual tags for 'if', 'do-while', 'while', 'for-in', 'continue', > 'break', 'with', 'switch', 'throw' and 'try'? IMO it is better not to do that since E4X would allow to write the above as: var userName = request.getParameter("user-name"); OUT(

I see your name is {userName}!

) if(userName != "Bob") { OUT(

Say "Hi" to Bob if you see him.

) } else { OUT(

Bob, it is nice to see you again.

) }
where OUT does proper job of appending string to response. Regards, Igor .