0.2.10 • Published 7 months ago

nsp-struts1-taglib v0.2.10

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
7 months ago

nsp-struts1-taglib

Node.js CI npm version

NSP taglib for Apache Struts1 Tag Library

SYNOPSIS

import {createNSP} from "nsp-server-pages";
import {beanTags, htmlTags, logicTags} from "nsp-struts1-taglib";

const nsp = createNSP();

nsp.addTagLib({ns: "bean", tag: beanTags});
nsp.addTagLib({ns: "html", tag: htmlTags});
nsp.addTagLib({ns: "logic", tag: logicTags});

const render = await nsp.loadJSP("path/to/template.jsp");

const context = {};

const html = await render(context);

console.log(html);

COMMONJS

  • Both ES Modules and CommonJS supported.
const {createNSP} = require("nsp-server-pages");
const {beanTags, htmlTags, logicTags} = require("nsp-struts1-taglib");

COMPATIBILITY

35 / 58 tags implemented. Contributions for missing tags are welcome here!

Struts Bean Tags

TagClassStatusNote
<bean:cookie>CookieTag👍 OK
<bean:define>DefineTag👍 OK
<bean:header>HeaderTag👍 OK
<bean:include>IncludeTag🕑 Not Yet
<bean:message>MessageTag🕑 Not Yet
<bean:page>PageTag🕑 Not Yet
<bean:parameter>ParameterTag👍 OK
<bean:resource>ResourceTag👍 OKimplement nsp.hook("bean:resource", (name) => string) hook
<bean:size>SizeTag👍 OK
<bean:struts>StrutsTag🚫 N/Anot implemented by design
<bean:write>WriteTag👍 OKformat="" not supported yet

Struts HTML Tags

TagClassStatusNote
<html:base>BaseTag🕑 Not Yet
<html:button>ButtonTag🕑 Not Yet
<html:cancel>CancelTag🕑 Not Yet
<html:checkbox>CheckboxTag🕑 Not Yet
<html:errors>ErrorsTag🕑 Not Yet
<html:file>FileTag🕑 Not Yet
<html:form>FormTag👍 OKsome features not supported yet
<html:frame>FrameTag👍 OK
<html:hidden>HiddenTag👍 OK
<html:html>HtmlTag👍 OKLocale not supported yet
<html:image>ImageTag👍 OKmessage resources not supported yet
<html:img>ImgTag🕑 Not Yet
<html:javascript>JavascriptValidatorTag🕑 Not Yet
<html:label>LabelTag🕑 Not Yet
<html:link>LinkTag👍 OKsome features not supported yet
<html:messages>MessagesTag🕑 Not Yet
<html:multibox>MultiboxTag👍 OK
<html:optionsCollection>OptionsCollectionTag🕑 Not Yet
<html:options>OptionsTag👍 OKsome features not supported yet
<html:option>OptionTag👍 OKmessage resources not supported yet
<html:param>ParamTag🕑 Not Yet
<html:password>PasswordTag🕑 Not Yet
<html:radio>RadioTag👍 OK
<html:reset>ResetTag🕑 Not Yet
<html:rewrite>RewriteTag👍 OKsome features not supported yet
<html:select>SelectTag👍 OK
<html:submit>SubmitTag👍 OK
<html:textarea>TextareaTag👍 OK
<html:text>TextTag👍 OK
<html:xhtml>XhtmlTag🕑 Not Yet

Struts Logic Taglib

TagClassStatusNote
<logic:empty>EmptyTag👍 OK
<logic:equal>EqualTag👍 OK
<logic:forward>ForwardTag👍 OK
<logic:greaterEqual>GreaterEqualTag👍 OK
<logic:greaterThan>GreaterThanTag👍 OK
<logic:iterate>IterateTag👍 OK
<logic:lessEqual>LessEqualTag👍 OK
<logic:lessThan>LessThanTag👍 OK
<logic:match>MatchTag👍 OK
<logic:messagesNotPresent>MessagesNotPresentTag🕑 Not Yetmessage resources not supported yet
<logic:messagesPresent>MessagesPresentTag🕑 Not Yetmessage resources not supported yet
<logic:notEmpty>NotEmptyTag👍 OK
<logic:notEqual>NotEqualTag👍 OK
<logic:notMatch>NotMatchTag👍 OK
<logic:notPresent>NotPresentTag👍 OK
<logic:present>PresentTag👍 OK
<logic:redirect>RedirectTag🚫 N/Anot implemented by design

Struts Nested Taglib

Not supported yet.

INHERITANCE

Import struts1Impl to inherit a class from the taglib.

import {Struts1Html} from "nsp-struts1-taglib";
import {struts1Impl} from "nsp-struts1-taglib/impl";

export class MyTextareaTag extends struts1Impl.html.TextareaTag {
    protected attr: MyTextareaTagAttr;

    render() {
        const {some} = this.attr;
        if (some) {
            // do something
        } else {
            // do something else
        }
        return super.render();
    }
}

interface MyTextareaTagAttr extends Struts1Html.TextareaTagAttr {
    some?: string; // add your custom attributes here
}

LINKS

LICENSE

// SPDX-License-Identifier: Apache-2.0
0.2.10

7 months ago

0.2.9

8 months ago

0.2.8

8 months ago

0.2.7

8 months ago

0.2.6

8 months ago

0.2.5

8 months ago

0.2.4

8 months ago

0.2.3

8 months ago