nsp-struts1-taglib
TypeScript icon, indicating that this package has built-in type declarations

0.2.10 • Public • Published

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

Tag Class Status Note
<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 👍 OK implement nsp.hook("bean:resource", (name) => string) hook
<bean:size> SizeTag 👍 OK
<bean:struts> StrutsTag 🚫 N/A not implemented by design
<bean:write> WriteTag 👍 OK format="" not supported yet

Struts HTML Tags

Tag Class Status Note
<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 👍 OK some features not supported yet
<html:frame> FrameTag 👍 OK
<html:hidden> HiddenTag 👍 OK
<html:html> HtmlTag 👍 OK Locale not supported yet
<html:image> ImageTag 👍 OK message resources not supported yet
<html:img> ImgTag 🕑 Not Yet
<html:javascript> JavascriptValidatorTag 🕑 Not Yet
<html:label> LabelTag 🕑 Not Yet
<html:link> LinkTag 👍 OK some features not supported yet
<html:messages> MessagesTag 🕑 Not Yet
<html:multibox> MultiboxTag 👍 OK
<html:optionsCollection> OptionsCollectionTag 🕑 Not Yet
<html:options> OptionsTag 👍 OK some features not supported yet
<html:option> OptionTag 👍 OK message 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 👍 OK some 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

Tag Class Status Note
<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 Yet message resources not supported yet
<logic:messagesPresent> MessagesPresentTag 🕑 Not Yet message 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/A not 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
}

LICENSE

// SPDX-License-Identifier: Apache-2.0

Readme

Keywords

Package Sidebar

Install

npm i nsp-struts1-taglib

Weekly Downloads

65

Version

0.2.10

License

Apache-2.0

Unpacked Size

570 kB

Total Files

270

Last publish

Collaborators

  • kawanet