Tag: struts2

Struts 2 标记中的格式编号

我想格式化Struts 2中标记显示的数字。有一个double值。 我怎样才能做到这一点? 我应该使用OGNL吗? 或者也许我必须使用标签并在资源文件中定义我的格式?

OSGi – 这项技术有多成熟?

我有一个要求,我需要在不同的基于Spring的Struts 2应用程序之间共享一些Web资源( jsp , html , js , images , css等)。 并且似乎OSGi可以用来实现这一目标吗? 有人可以给出一些关于如何用OSGi实现这一目标的指示吗? 其次我想知道OSGi足够成熟,可以用于生产应用程序? 提前致谢! 编辑:我经历了这篇文章,似乎人们可以跨Web应用程序共享一个Web包。 唯一的区别是他们用Spring MVC做到了。 我想知道这是否可以通过Struts2应用程序实现? 编辑2:我基本上不清楚以下内容: ‘shareable-bundle’(包含要共享的Web资源)是否为.war打包。 如果是,那么将从哪里形成最终的Web上下文,因为该捆绑包将再次与主“web”应用程序共享? 我期待最终的Web上下文是由’shareable-bundle’和’main’Web应用程序的合并而形成的。 它会自动发生吗? 有任何想法吗?

识别多文件上载中的每个字段

当尝试使用ArrayList使用Struts2上传多个文件时,如何识别每个字段? 例如,如果我有两个文件字段, File1和File2 ,在客户端,我选择只上传File2 ,Struts 2只在列表中创建一个元素,我无法正确地将File1映射为空,而File2与上传的文件。 我可以在这里使用任何标识符吗?

Struts2 jQuery插件 – 提交按钮

我有Struts2 jQuery插件提交按钮,当点击按钮时它没有触发动作类作为struts提交按钮。 单击按钮后我需要保持相同的页面。请查看以下代码差异。 Struts提交按钮 – 工作正常 将struts提交转换为struts-jquery提交提交按钮 – 不能正常工作 如果仅使用表单操作 ,则页面刷新并作为Struts标记工作,但不应该如此。

在jsp中找不到“/ struts2-jquery-tags”的标记库描述符

我在struts 2中使用struts2-jquery-plugin-3.5.1-sources.jar我将jar文件放在lib目录中,我也将它添加到了buildpath中。 我在jsp中创建了一个条目 但它显示错误Can not find the tag library descriptor for “/struts2-jquery-tags” 当我运行它显示的应用程序时 SEVERE: Exception starting filter struts2 Unable to load bean: type:org.apache.struts2.views.TagLibrary class:com.jgeppert.struts2.jquery.views.JqueryTagLibrary – bean – jar:file:/D:/eclipse-indigo/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/Fundation/WEB-INF/lib/struts2-jquery-plugin-3.5.1-sources.jar!/struts-plugin.xml:27:125 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:208) at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:131) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452) at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:205) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422) at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4071) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4725) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at […]

没有为名为’success’的’dynamic-jasper’类型定义结果类型

我正在尝试使用带有Struts 2.3.4的DynamicJasper 5.0.0。 我使用以下代码以PDF格式显示数据 在动作课上 try { FastReportBuilder drb = new FastReportBuilder(); DynamicReport dr = drb.addColumn(“Size”, “size”, String.class.getName(), 30).setTitle(“Size List Report”).setSubtitle(“This report was generateed at” + new Date()).setUseFullPageWidth(true) //make colums to fill the page width .setPrintBackgroundOnOddRows(true).build(); JRDataSource ds = new JRBeanCollectionDataSource(getSizeList()); JasperPrint jp = DynamicJasperHelper.generateJasperPrint(dr, new ClassicLayoutManager(), ds); JasperViewer.viewReport(jp); //finally display the report report [/CODE] […]

使用Struts上传图像

我刚刚开始练习struts,所以我对这个框架有点新意。 所以,我要做的是使用这个JSP文件上传一个图像: Upload User Image Struts2 File Upload & Save Example Image : 动作类如下: public class InsertImageBean extends ActionSupport{ private static final long serialVersionUID = 1L; private File Image; private String myFileContentType; private String myFileFileName; public String execute() { /* Copy file to a safe location */ InsertImage.save(this); return SUCCESS; } public File getMyFile() { […]

Struts 2validationxml中的特定操作

我想仅在动作类中validation特定方法。 行动方法是这样的。 public String add() throws Exception { // aflag = true; org.setAoName(aoName); orgBo.addOrg(org); orglist = orgBo.searchOrg(organisationSearch); setAoName(“”); setAflag(“viewaddorgs”); return “add”; } 问题是目前我在动作类中有很多动作方法。 当我调用这些方法时,它会validation此方法。 请帮我用xmlvalidation这个方法。 这是我的OraganisationAction-validation.xml : The name is required! The name is required! 这是我的jsp: struts xml : secondTemplate orgTemplate orgAddTemplate orgAddTemplate orgAddTemplate orgAddTemplate orgTemplate orgTemplate orgEditTemplate orgEditTemplate orgEditTemplate orgTemplate orgViewTemplate 它适用于注释,但xml尚未成功。

如何在Struts 2中正确validation字段

我想知道我在这里做错了什么: Required field (*) 8 8 ID must has 8 characters 因为,实际上我收到了这个错误: 错误com.opensymphony.xwork2.validator.AnnotationActionValidatorManager加载文件时捕获exception… / action / ServiceAction-findPets-validation.xml无效的validation类型:requiredString – field-validator 另外,我想知道如果进行ajax调用(并发送JSON数据)我可以validation这些数据的存在吗? 我的意思是通过.xmlvalidation器。 此外,如果我实现Validateable接口,每次请求到达此操作时,此方法将被触发? 有没有办法指定哪种动作方法呢?

Struts2没有针对命名空间映射的Action和与上下文路径关联的操作名称

我是Struts2的初学者,我知道这个问题已经在这里问了很多次,但我试着解决它并在这里阅读了很multithreading,花了6个小时仍然无法让它工作。 真的需要更多的建议…… 这是我的包裹 Struts2Test +Struts2Test/src +tw.com.rrstudio.java.test -TestAction.java +Struts2Test/build +Struts2Test/WebContent +Struts2Test/WebContent/META-INF +Struts2Test/WebContent/WEB-INF/classes +Struts2Test/WebContent/WEB-INF/lib -Struts2Test/WebContent/WEB-INF/spring-context.xml -Struts2Test/WebContent/WEB-INF/spring-mvc.xml -Struts2Test/WebContent/WEB-INF/struts.xml -Struts2Test/WebContent/WEB-INF/struts2-action.xml -Struts2Test/WebContent/WEB-INF/web.xml -Struts2Test/WebContent/error.jsp -Struts2Test/WebContent/index.jsp -Struts2Test/WebContent/TestAction.jsp 我的web.xml Struts2Test index.jsp contextConfigLocation /WEB-INF/spring-context.xml /WEB-INF/spring-mvc.xml org.springframework.web.context.ContextLoaderListener struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter actionPackages tw.com.rrstudio.java.test HTTP://java.sun.com/jsp/jstl/core /WEB-INF/lib/tld/c.tld *.jsp UTF-8 struts2 /* springmvc org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring-mvc.xml 1 springmvc /* 10 还有,struts.xml /WebContent/error.jsp /WebContent/index.jsp /WebContent/TestAction.jsp 的index.jsp Index of Struts2Test Index of […]