Giter VIP home page Giter VIP logo

struts2-bootstrap's Introduction

Struts2 Bootstrap Plugin

Maven Central

A Plugin for simple Bootstrap CSS Framework integration into Struts2.

[News and Developer Blog] (https://www.jgeppert.com)

[Sample TODO app based on Bootstrap, jQuery and jQuery Mobile] (https://github.com/jogep/struts2-todo-examples/)

Installation

Manual

Copy the struts2-bootstrap-plugin.jar into your WEB-INF/lib path.

Maven

<dependencies>
    ...
    <dependency>
        <groupId>com.jgeppert.struts2.bootstrap</groupId>
        <artifactId>struts2-bootstrap-plugin</artifactId>
        <version>5.0.2</version>
    </dependency>
    ...
</dependencies>

Using SNAPSHOT builds

To access SNAPSHOT builds, you need to declare the snapshot repository lookup in your pom.xml:

...
<repositories>
    ...
    <repository>
        <id>sonatype.oss.snapshots</id>
        <name>Sonatype OSS Snapshot Repository</name>
        <url>http://oss.sonatype.org/content/repositories/snapshots</url>
        <releases>false</releases>
        <snapshots>true</snapshots>
    </repository>
</repositories>
...

Usage

Prepare your JSP

Include the Taglib and use the HeadTag to load necessary resources.

<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sb" uri="/struts-bootstrap-tags" %>
<!DOCTYPE html>
<html lang="en">
<head>
    ...

    <sb:head/>
</head>
<body>
...
</body>
</html>

Use the Bootstrap Form Theme

            <s:actionerror theme="bootstrap"/>
            <s:actionmessage theme="bootstrap"/>
            <s:fielderror theme="bootstrap"/>


            <s:form action="index" enctype="multipart/form-data" theme="bootstrap" cssClass="form-horizontal"
                    label="A sample horizontal Form">
                <s:textfield
                        label="Name"
                        name="name"
                        tooltip="Enter your Name here"/>

                <s:textfield
                        label="Textfield with Error"
                        name="error"/>

                <s:textarea
                        tooltip="Enter your Biography"
                        label="Biography"
                        name="bio"
                        cols="20"
                        rows="3"/>

                <s:select
                        tooltip="Choose Your Favourite Color"
                        label="Favorite Color"
                        list="{'Red', 'Blue', 'Green'}"
                        name="favouriteColor"
                        emptyOption="true"
                        headerKey="None"
                        headerValue="None"/>

                <s:checkboxlist
                        tooltip="Choose your Friends"
                        label="Friends"
                        list="{'Wes', 'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}"
                        name="friends"/>

                <s:checkboxlist
                        tooltip="Checkboxes with inline position"
                        labelPosition="left"
                        label="Friends Inline"
                        list="{'Wes', 'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}"
                        name="friendsInline"/>

                <s:radio
                        tooltip="Choose your Best Friend"
                        label="Best Friend"
                        list="{'Wes', 'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}"
                        name="bestFriend"
                        cssErrorClass="foo"/>

                <s:radio
                        tooltip="Radio Buttons with inline position"
                        label="Best Friend Inline"
                        labelPosition="left"
                        list="{'Wes', 'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}"
                        name="bestFriend"
                        cssErrorClass="foo"/>

                <s:checkbox
                        tooltip="Confirmed that your are Over 18"
                        label="Age 18+"
                        name="legalAge"/>

                <s:doubleselect
                        tooltip="Choose Your State"
                        label="State"
                        name="region" list="{'North', 'South'}"
                        value="'South'"
                        doubleValue="'Florida'"
                        doubleList="top == 'North' ? {'Oregon', 'Washington'} : {'Texas', 'Florida'}"
                        doubleName="state"
                        headerKey="-1"
                        headerValue="---------- Please Select ----------"
                        emptyOption="true"/>

                <s:file
                        tooltip="Upload Your Picture"
                        label="Picture"
                        name="picture"/>

                <s:optiontransferselect
                        tooltip="Select Your Favourite Cartoon Characters"
                        label="Favourite Cartoons Characters"
                        name="leftSideCartoonCharacters"
                        leftTitle="Left Title"
                        rightTitle="Right Title"
                        list="{'Popeye', 'He-Man', 'Spiderman'}"
                        multiple="true"
                        headerKey="headerKey"
                        headerValue="--- Please Select ---"
                        emptyOption="true"
                        doubleList="{'Superman', 'Mickey Mouse', 'Donald Duck'}"
                        doubleName="rightSideCartoonCharacters"
                        doubleHeaderKey="doubleHeaderKey"
                        doubleHeaderValue="--- Please Select ---"
                        doubleEmptyOption="true"
                        doubleMultiple="true"/>

                <s:textarea
                        label="Your Thougths"
                        name="thoughts"
                        tooltip="Enter your thoughts here"/>

                <s:submit cssClass="btn"/>
            </s:form>

struts2-bootstrap's People

Contributors

actions-user avatar dependabot[bot] avatar flofourcade avatar github-actions[bot] avatar gregh3269 avatar jogep avatar lukaszlenart avatar max-trappist avatar perfnorm avatar peutch avatar prabhu-mannu avatar renovate[bot] avatar sdutry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

struts2-bootstrap's Issues

Struts 6.0.0 support

I upgraded my app to Struts 6.0.0 and running it lead to:

05:25:17.235 [https-openssl-apr-443-exec-5] ERROR freemarker.runtime - Error executing FreeMarker template
freemarker.core._MiscTemplateException: Template inclusion failed (for parameter value "/template/~~~bootstrap/controlheader-core.ftl"):
Syntax error in template "template/~~~bootstrap/controlheader-core.ftl" in line 51, column 44:
Using ?html (legacy escaping) is not allowed when auto-escaping is on with a markup output format (HTML), to avoid double-escaping mistakes.

----
FTL stack trace ("~" means nesting-related):
        - Failed at: #include "/${parameters.templateDir}/...  [in template "template/~~~bootstrap/controlheader.ftl" at line 21, column 1]
        - Reached through: #include "/${parameters.templateDir}/...  [in template "template/bootstrap/text.ftl" at line 21, column 1]
----
        at freemarker.core.Include.accept(Include.java:164)
        at freemarker.core.Environment.visit(Environment.java:347)
        at freemarker.core.Environment.visit(Environment.java:353)
        at freemarker.core.Environment.include(Environment.java:2955)
        at freemarker.core.Include.accept(Include.java:171)
        at freemarker.core.Environment.visit(Environment.java:347)
        at freemarker.core.Environment.visit(Environment.java:353)
        ...

I guess the issue is with Tag escape behaviour.

Struts2 XML validation with bootstrap theme

The form in jsp page is showing error but form submitted with null values.
I use struts 2 xml validation with bootstrap 3 theme.
Issue cannot be fixed please anyone can support me to completed my application.thanks in advance

runtime error while using key="clone" for instance in <s:select key="clone" ... />

Hi,

The same JSP is working fine when using the simple or the xhtml theme for such a tag.
But moving to the bootstrap theme, I am facing the following error stack:

nov. 15, 2022 3:46:15 PM freemarker.log._JULLoggerFactory$JULLogger error
GRAVE: Error executing FreeMarker template
FreeMarker template error:
Getting the number of items or listing the items is not supported on this method+sequence (wrapper: f.e.b.SimpleMethodModel) value, because this value wraps the following Java method, not a real listable value: public java.lang.Object java.util.HashMap.clone()

----
Tip: Maybe you should to call this method first and then do something with its return value.
----
Tip: obj.someMethod(i) and obj.someMethod[i] does the same for this method, hence it's a "+sequence".
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #list fieldErrors[parameters.name] as...  [in template "template/~~~bootstrap/controlfooter.ftl" at line 24, column 5]
	- Reached through: #include "/${parameters.templateDir}/...  [in template "template/bootstrap/select.ftl" at line 23, column 1]
----

Java stack trace (for programmers):
----
freemarker.core._TemplateModelException: [... Exception message was already printed; see it above ...]
	at freemarker.ext.beans.SimpleMethodModel.size(SimpleMethodModel.java:95)
	at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:312)
	at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271)
	at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:244)
	at freemarker.core.Environment.visitIteratorBlock(Environment.java:657)
	at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:108)
	at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94)
	at freemarker.core.Environment.visit(Environment.java:347)
	at freemarker.core.Environment.visit(Environment.java:353)
	at freemarker.core.Environment.visit(Environment.java:353)
	at freemarker.core.Environment.include(Environment.java:2955)
	at freemarker.core.Include.accept(Include.java:171)
	at freemarker.core.Environment.visit(Environment.java:347)
	at freemarker.core.Environment.visit(Environment.java:353)
	at freemarker.core.Environment.process(Environment.java:326)
	at freemarker.template.Template.process(Template.java:383)
	at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:154)
	at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:588)
	at org.apache.struts2.components.UIBean.end(UIBean.java:547)
	at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:40)
	at org.apache.jsp.query_jsp._jspx_meth_s_005fselect_005f15(query_jsp.java:1367)
	at org.apache.jsp.query_jsp._jspx_meth_s_005fform_005f0(query_jsp.java:391)
	at org.apache.jsp.query_jsp._jspService(query_jsp.java:242)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:327)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:711)
	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:578)
	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:517)
	at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:994)
	at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:485)
	at org.apache.tiles.request.jsp.JspRequest.doInclude(JspRequest.java:123)
	at org.apache.tiles.request.AbstractViewRequest.dispatch(AbstractViewRequest.java:47)
	at org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
	at org.apache.tiles.request.render.ChainedDelegateRenderer.render(ChainedDelegateRenderer.java:68)
	at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
	at org.apache.tiles.TilesContainerWrapper.render(TilesContainerWrapper.java:108)
	at org.apache.tiles.template.InsertAttributeModel.renderAttribute(InsertAttributeModel.java:188)
	at org.apache.tiles.template.InsertAttributeModel.execute(InsertAttributeModel.java:132)
	at org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:299)
	at org.apache.jsp.layout_jsp._jspx_meth_tiles_005finsertAttribute_005f4(layout_jsp.java:543)
	at org.apache.jsp.layout_jsp._jspService(layout_jsp.java:223)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:327)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:711)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:385)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:313)
	at org.apache.tiles.request.servlet.ServletRequest.forward(ServletRequest.java:265)
	at org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:228)
	at org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57)
	at org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
	at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
	at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397)
	at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238)
	at org.apache.tiles.TilesContainerWrapper.render(TilesContainerWrapper.java:103)
	at org.apache.tiles.impl.mgmt.CachingTilesContainer.render(CachingTilesContainer.java:126)
	at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:158)
	at org.apache.struts2.result.StrutsResultSupport.execute(StrutsResultSupport.java:206)
	at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:366)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:283)
	at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:179)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
	at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:49)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at org.apache.struts2.interceptor.FetchMetadataInterceptor.intercept(FetchMetadataInterceptor.java:82)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at org.apache.struts2.interceptor.CoopInterceptor.intercept(CoopInterceptor.java:61)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at org.apache.struts2.interceptor.CoepInterceptor.intercept(CoepInterceptor.java:59)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.doIntercept(ConversionErrorInterceptor.java:143)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:152)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:152)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:202)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:67)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(DateTextFieldInterceptor.java:133)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:89)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:242)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:101)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:142)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:161)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:175)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at org.apache.struts2.interceptor.csp.CspInterceptor.intercept(CspInterceptor.java:55)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at org.apache.struts2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:140)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:209)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:229)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:196)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:255)
	at org.apache.struts2.factory.StrutsActionProxy.execute(StrutsActionProxy.java:48)
	at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:630)
	at org.apache.struts2.dispatcher.ExecuteOperations.executeAction(ExecuteOperations.java:79)
	at org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:140)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.base/java.lang.Thread.run(Thread.java:829)

Is there a way to protect this '"clone" value for the key attribute from being at some point in the process a call to the clone() method.

Thanks,
Patrice

struts2-bootstrap-plugin 2.0.4 => missing utils.js

Great plugin!!!

I was trying to use <s:optiontransferselect /> tag and kept getting javascript error.
ERROR: StrutsUtils is not defined.

I can see the utils.js in struts2-core.2.3.24.1.jar under org.apache.struts2.static package.

I tried adding every struts.property concerning static content, trying all combinations with no success. (And yes, I did restart glassfish server)

I am using glassfish 4.0. That might be the issue. Still working on what I am doing wrong or if
it is struts-core or struts-bootstrap that needs a fix.

*** WORKAROUND => add this to your head section.

<script type="text/javascript" src="${pageContext.request.contextPath}/struts/utils.js"></script>

        
            commons-validator
            commons-validator
            1.4.1
        
        
            org.apache.commons
            commons-lang3
            3.0
            
        
            javax
            javaee-web-api
            7.0
            provided
                
        
            org.apache.struts
            struts2-core
            2.3.24.1
        
        
            log4j
            log4j
            1.2.17
        
        
            com.google.code.gson
            gson
            2.3.1
        
        
            mysql
            mysql-connector-java
            5.1.36
        
        
            org.apache.struts
            struts2-json-plugin
            2.3.24.1
        
        
            javax.mail
            mail
            1.4
        
        
            com.jgeppert.struts2.bootstrap
            struts2-bootstrap-plugin
            2.0.4
        
     



# struts.properties
# https://struts.apache.org/docs/strutsproperties.html

# http://stackoverflow.com/questions/19068102/how-to-have-urls-without-a-suffix-e-g-action-in-struts-2
# Do NOT change from ,  to blank!!!  Either comment it out or use ,
struts.action.extension=,

# Set to true for developers and false for production.
struts.devMode=true

# max filesize in upload.
struts.multipart.saveDir=/tmp
struts.multipart.maxSize=10000000

# configure the XSLTResult class to use CSS stylesheet caching.
# Set to true for developers and false for production.
struts.xslt.nocache=true

# when set to true, resource bundles will be reloaded on _every_ request.
# this is good during development, but should never be used in production.
# Set to true for developers and false for production.
struts.i18n.reload=true

# You will need this if you are going to do restful stuff like  /ns1/Resource/edit/5
# where Resource is the controller and edit is the action separated by a slash.  (also th 5 separated by slash)
struts.enable.SlashesInActionNames=true

# If you are using bootstrap plugin, then set this to bootstrap; otherwise, set to simple
struts.ui.theme=bootstrap

### Configuration reloading
### This will cause the configuration to reload struts.xml when it is changed
struts.configuration.xml.reload=true

### used to build URLs, such as the UrlTag
struts.url.http.port = 80
struts.url.https.port = 443
### possible values are: none, get or all
struts.url.includeParams = none

### Whether to allow static method access in OGNL expressions or not
struts.ognl.allowStaticMethodAccess=true

### Used by FilterDispatcher
### If true then Struts serves static content from inside its jar.
### If false then the static content must be available at /struts
struts.serve.static=true

### Used by FilterDispatcher
### This is good for development where one wants changes to the static content be
### fetch on each request.
### NOTE: This will only have effect if struts.serve.static=true
### If true -> Struts will write out header for static contents such that they will
###             be cached by web browsers (using Date, Cache-Content, Pragma, Expires)
###             headers).
### If false -> Struts will write out header for static contents such that they are
###            NOT to be cached by web browser (using Cache-Content, Pragma, Expires
###            headers)
struts.serve.static.browserCache=false

form-close.ftl should only include tooltop js if needed

Surround with parameters.hasTooltip check. (Can make the default true if need to support a version of struts2 that doesn't have hasTooltip defined yet)

<#if (parameters.hasTooltip)!false>
<script type="text/javascript">
    if (typeof jQuery != 'undefined') {
        if (typeof jQuery.fn.tooltip == 'function') {
            jQuery('i.s2b_tooltip').tooltip();
        }
    }
</script>
</#if>

Fixes maven dependencies

It seems unneeded dependencies are resolved by maven :

  • jars from struts 1 (struts-core, taglib)
  • velocity is optional but velocity-tools have a transitive dependency on it

It seems that removing velocity-tools let the plugin compile and fixes this issue.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

Branch release/5.0.x
github-actions
.github/workflows/maven.yml
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/cache v4.0.2
  • actions/setup-java v4
.github/workflows/release.yml
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/cache v4.0.2
  • actions/setup-java v4
maven
pom.xml
  • org.apache.maven.plugins:maven-clean-plugin 3.4.0
  • org.apache.maven.plugins:maven-deploy-plugin 3.1.2
  • org.apache.maven.plugins:maven-install-plugin 3.1.2
  • org.apache.maven.plugins:maven-jar-plugin 3.4.2
  • org.apache.maven.plugins:maven-resources-plugin 3.3.1
  • org.apache.maven.plugins:maven-compiler-plugin 3.13.0
  • org.apache.maven.plugins:maven-site-plugin 3.12.1
  • org.apache.maven.plugins:maven-project-info-reports-plugin 3.6.2
  • org.apache.maven.plugins:maven-javadoc-plugin 3.8.0
  • org.apache.maven.plugins:maven-source-plugin 3.3.1
  • org.apache.maven.plugins:maven-surefire-plugin 3.3.1
  • org.apache.maven.plugins:maven-war-plugin 3.4.0
  • org.apache.maven.plugins:maven-release-plugin 3.1.1
  • org.apache.maven.plugins:maven-gpg-plugin 3.2.4
  • org.apache.logging.log4j:log4j-api 2.23.1
  • org.apache.struts:struts2-core 6.4.0
  • javax.servlet:jsp-api 2.0
  • javax.servlet.jsp:jsp-api 2.2
  • org.apache.maven.plugins:maven-compiler-plugin 3.13.0
  • org.apache.struts:struts2-velocity-plugin 6.4.0
  • org.apache.struts:struts2-convention-plugin 6.4.0
  • org.apache.struts:struts2-json-plugin 6.4.0
  • org.apache.logging.log4j:log4j-core 2.23.1
struts2-bootstrap-plugin/pom.xml
  • org.apache.struts:struts-annotations 1.0.8
struts2-bootstrap-showcase/pom.xml
  • org.eclipse.jetty:jetty-maven-plugin 9.4.55.v20240627
  • com.jgeppert.struts2.jquery:struts2-jquery-plugin 5.0.4
  • com.jgeppert.struts2.jquery:struts2-jquery-grid-plugin 5.0.4
Branch release/4.0.x
github-actions
.github/workflows/maven.yml
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/cache v4.0.2
  • actions/setup-java v4
.github/workflows/release.yml
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/cache v4.0.2
  • actions/setup-java v4
maven
pom.xml
  • org.apache.maven.plugins:maven-clean-plugin 3.4.0
  • org.apache.maven.plugins:maven-deploy-plugin 3.1.2
  • org.apache.maven.plugins:maven-install-plugin 3.1.2
  • org.apache.maven.plugins:maven-jar-plugin 3.4.2
  • org.apache.maven.plugins:maven-resources-plugin 3.3.1
  • org.apache.maven.plugins:maven-compiler-plugin 3.13.0
  • org.apache.maven.plugins:maven-site-plugin 3.12.1
  • org.apache.maven.plugins:maven-project-info-reports-plugin 3.6.2
  • org.apache.maven.plugins:maven-javadoc-plugin 3.8.0
  • org.apache.maven.plugins:maven-source-plugin 3.3.1
  • org.apache.maven.plugins:maven-surefire-plugin 3.3.1
  • org.apache.maven.plugins:maven-war-plugin 3.4.0
  • org.apache.maven.plugins:maven-release-plugin 3.1.1
  • org.apache.maven.plugins:maven-gpg-plugin 3.2.4
  • org.apache.logging.log4j:log4j-api 2.23.1
  • org.apache.struts:struts2-core 6.4.0
  • javax.servlet:jsp-api 2.0
  • javax.servlet.jsp:jsp-api 2.2
  • org.apache.maven.plugins:maven-compiler-plugin 3.13.0
  • org.apache.struts:struts2-velocity-plugin 6.4.0
  • org.apache.struts:struts2-convention-plugin 6.4.0
  • org.apache.struts:struts2-json-plugin 6.4.0
  • org.apache.logging.log4j:log4j-core 2.23.1
struts2-bootstrap-plugin/pom.xml
  • org.apache.struts:struts-annotations 1.0.8
struts2-bootstrap-showcase/pom.xml
  • org.eclipse.jetty:jetty-maven-plugin 9.4.55.v20240627
  • com.jgeppert.struts2.jquery:struts2-jquery-plugin 5.0.4

  • Check this box to trigger a request for Renovate to run again on this repository

set new development version (2.5.2-SNAPSHOT) for struts2-bootstrap

Update the version number in the pom.xml files to use the SNAPSHOT version of the upcoming release.

@jogep
Can you do this please.
I don't know if you prefer this to be done in the master branch (the conventional way), or if you prefer making a new branch for the upcoming release and set it as the default branch (the way you work for struts2-jquery ).

Why is the log4j dependency included by default when using the library?

I see that the logging library log4j is included by default when using the struts2-bootstrap library.

When making an application we generaly tend to choose our own logging implementation, using the SLF4J-bridges to send all logging over the chosen logging implementation.

This means that we currently have to exclude the log4j dependency when using this library.
(It still works when we don't, it just complains when starting the application)

I noticed that the project won't compile when the log4j dependency isn't present. I would like to understand why that is (seeing as there are no class files actualy using any logging).

Would it be possible to make this dependency optional?

Support to version 5.0

Some resource are amazing in bootstrap 5, for example, floating labels.
Maybe you can upgrade this project for floating label adding custom attr or custom class in input tag ... or update form theme

update showcase application to bootstrap 4

issue to list all things that need to be fixed in the showcase application due to bootstrap 4 migration

  • update navbar html
  • make navbar toggle work
  • update submenu on the left
  • remove margin from messages (actionerror, actionmessage and fielderror)
  • Form horizontal looks same like vertical
  • The buttons for the struts2 components input transfer are not shown anymore
  • make tooltips work again

relates to

OGNL in inputAppend tag parameter not being evaluated after upgrade from Struts 2.5.22 to 2.5.26

Using Struts Bootstrap plugin 2.5.2 and the following code worked with Struts 2.5.22 but does not when upgraded to Struts 2.5.26

<s:iterator value="vendFuelConsumpList" var="vf" status="ostat">

<s:iterator value="#vf.consumptionList" var="c" status="istat">

<s:textfield theme="bootstrap" inputAppend="%{#vf.units}" value="%{#c.fuelConsumed}" name="vendFuelConsumpList[%{#ostat.index}].consumptionList[%{#istat.index}].fuelConsumed" onchange="this.value = formatNumber(this.value);" validNumber="true" minVal="0" maxVal="9999.9" maxDecimal="1" />

</s:iterator>

</s:iterator>

With Struts 2.5.22, an input text box followed by the value of vf.units. With Struts 2.5.26, an input text box followed by the characters %{#vf.units} is rendered.

Allow thème override

Could you please replace
<#include "/${parameters.templateDir}/bootstrap/xxx" />
By
<#include "/${parameters.templateDir}/${parameters.name}/xxx" />
To allow thème override?

Error message position

Is it possible to define position of error message? ie. not only below a control, but on right in the same line.

File Control Invalid Class

The is receiving the class "form-control" which is causing the height of the file button to extend outside of the border wrapping around it. This issue can be seen happening in the showcase as well. The file input example on the Bootstrap docs does not show this class being assigned. I have dug through the template and see that it is including from the Struts simple theme. I have not been able to figure out how in the world it is getting in there other than class is getting pushed into common-attributes or dynamic-attributes somewhere in the bootstrap template???

Here is a CSS workaround that we are currently using to fix the problem:

input[type='file'].form-control  {
    height: auto;
}

Upgrade to Bootstrap 4.0

A new version of Bootstrap is almost here, for now a beta version of Bootstrap 4.0 is available but I think this is a good point to start.

How can I help whit this?

fix dependency convergence

Clearly manage the dependency versions.
( checked with mvn site )

struts2-bootstrap-plugin

  • commons-io
  • log4j-api
  • struts2-core

struts2-bootstrap-showcase

  • commons-io
  • log4j-api
  • struts2-core

Issues prepending fields with special characters.

I'm trying to prepend a text field with a pound sign £ but when the page is loaded the field is prepended with a � icon here is the code I am using:

<s:textfield key="advance" maxlength="14" requiredLabel="true" inputPrepend="£" />

I have tried various ways of escaping the character such as &#163; or &pound; but this prints the characters literally, I also tried or &amp;#163; on the off change there was some strange java escaping going on but that yielded the literally characters as well. Based on the examples in the bootstrap showcase I would think that just typing £ would work so I'm a little stumped as to what is not working.

Thanks

(edit - changed my escape sequences to code blocks so they don't escape!)

-I have since realised that there is a glyphicon which fills my use case but I still think this is a bug of some description.

Radio button field error generates double span with the same message

Hi,
I have a jsp with a form with theme set to bootstrap.
In the form I have an <s:radio > tag that maps to a property in a struts action whose setter method is annotated with the @RequiredFieldValidator annotation.
When I submit the form not having selected one of the radio buttons I obtain the required validation error but the tag generates two <span> tags one above the radio field and the other below.
The first span is defined as follow:

<span class="errorMessage">Specificare un ente</span>

as defined in template radiomap.ftl:

<#assign hasFieldErrors = fieldErrors?? && fieldErrors[parameters.name]??/>
<#if hasFieldErrors>
    <#list fieldErrors[parameters.name] as error>
    <span class="errorMessage">${error?html}</span><#t/>
    </#list>
</#if>

The second one is defined as follow:

<span class="glyphicon glyphicon-remove form-control-feedback"></span>
<span class="help-block alert-danger">Specificare un ente</span>

as defined in template controlfooter.ftl:

<#assign hasFieldErrors = parameters.name?? && fieldErrors?? && fieldErrors[parameters.name]??/>
<#if hasFieldErrors>
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
    <#list fieldErrors[parameters.name] as error>
    <span class="help-block alert-danger">${error?html}</span><#t/>
    </#list>
</#if>

The problem is we have two equal messages one above and the other below.
I noticed the problem exists only for the tags: <s:radio>, <s:checkbox> and <s:checkboxlist> since they don't include the controlheader.ftl template. There's no similar problem for the <s:select>, <s:text> or <s:textarea> tags.

I tried commenting out the first <span> tag generation from the radiomap.ftl and the result was as expected.
There's a reason I'm missing for this behaviour ?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.