Yu Chen wrote:
> Hello,
>
> I am new to Woodstock. When reading the Woodstock Ajax architecture
> and example docs, on the Component Usage section, I just can't figure
> out the fundamental differences between the JSP tag/server-side and
> client-side renderings. From what I read, quoted,
>
> /"Using the //JSP tag, all the //in-line JavaScript necessary to
> generate a //Dojo widget is automatically output in the rendered HTML
> page."/
>
>
> Does it mean using the JSP tag, in-line javascript similar to the
> following will be created,
>
> |dojo.require('webui.suntheme.widget.*');
> webui.suntheme.widget.common.createWidget({
> "level": 2,
> "errorStyleClass": "ConErrLblTxt_sun4",
> "templatePath": "/||<appname>||/theme/com/sun/webui/jsf/<theme>/templates/label.html",
> "_widgetType": "webui.suntheme:label",
> "value": "Ex: 4111 1111 1111 1111",
> "required": false,
> "valid": true,
> ...
> |
Yes, the JSP tag is used to output some initial JavaScript and component
properties. (Ultimately, the JSP tag is invoking a JSF renderer which
outputs this string, so you can create components dynamically via Java
code as well.) This JavaScript instantiates a Dojo based widget, which
will be rendered client-side.
> Then it says,
>
> /"A Dojo Widget/ can also be represented by the following JavaScript "
> (actually the Javascript is just like the above!). "This JavaScript
> makes the Woodstock component available to web app developers who
> cannot, or do not want to, use the JSP and/or JSF frameworks."
>
>
All this means is that you can instantiate a widget using your own
JavaScript. Technically, if you provide the required properties, you
don't need to bother with a JSP tag or the JSF framework. Although, this
is a little easier said than done.
> But, my confusion is that it seems to me both generate the same
> in-line Javascript, the creates the Dojo widget/component
> representation on the client-side, right??
Whether you use the JSP tag or create a component via Java, only the JSF
renderer generates the JavaScript and component properties used to
instantiate the Dojo based widget. That is, unless you produce the
JavaScript yourself.
Dan