struts-tags

How to achieve correct values for attribute `name` when I use <nested:iteration> inside <nested:iteration> in the Struts?

为君一笑 提交于 2020-04-23 10:10:11
问题 To render Map<String, List<MyObject>> I have a jsp like this: .... <nested:iterate property="MyMap" id="entry"> <bean:write name="entry" property="key"/> <nested:iterate name="entry" property="value" indexId="count" id="myBean"> <div class=""> <nested:define name="myBean" id="myBeanName" property="name"/> <nested:hidden property="description"></nested:hidden> <nested:hidden name="myBean" property="name"/> <nested:checkbox styleId='<%="enabled-"+myBeanName%>' property="enabled"/> <label for=

How to iterate over Map<String, List<MyObject>> in the jsp using struts tag library?

狂风中的少年 提交于 2020-04-05 06:28:43
问题 On Backend side I have a Map: SortedMap<String, List<MyObject>> myMap = new TreeMap<>() MyObject has private String name field with pulic getter and setter On jsp I have: <nested:iterate property="myMap" id="map"> <bean:write name="map" property="key"/> <nested:iterate property="listElement" id="value"> <bean:write name="value" property="name"/> </nested:iterate> </nested:iterate> But I see error: Caused by: javax.servlet.jsp.JspException: No getter method for property: "otherBean.MyMap(API)

Editing ArrayList of objects with struts 2 form tag

99封情书 提交于 2020-01-27 03:09:46
问题 I have 2 classes - Student and Course . Both have all getters and setters defined on the attributes inside them. Using these two classes I am trying to build a web application with general functions like editing and adding students in different jsp pages. I student could have enrolled in multiple courses and marks for each course of each student should be editable inside the app. Now i have a studentMarks.jsp which loads the data from an action class - StudentAction public class StudentAction

Struts 2 s:select with values from resource bundle

丶灬走出姿态 提交于 2020-01-02 03:26:29
问题 We are using the s:select to show a list of string from resource bundle. In the Action: //bank codes will be something [12,13,14] List<String> bankCodesList; //with setter and getter String selectedBankCode; In the message resources each bank will have a name: bank.code.12= ALFM Bank bank.code.13= RIHN Bank .... In the JSP: <s:select name = "selectedBankCode" list = "bankCodesList" listKey = "toString()" listValue = "%{getText('bank.code.' + toString())}" /> As the bank list is List<String>

What is the differnece between Struts2 and Struts2 jQuery tags?

余生长醉 提交于 2019-12-30 11:02:49
问题 I am new to Struts2. I wanted to know the difference between Struts2 and Struts2 jQuery tags? 回答1: The first one is used for Struts2 core tag library, The framework provides a tag library decoupled from the view technology. In this section, we describe each tag in general terms, such as the attributes it supports, what the behaviors are, and so forth. Most tags are supported in all template languages (see JSP Tags, Velocity Tags, and FreeMarker Tags), but some are currently only specific to

How to fetch object properties from selected object in Struts 2

百般思念 提交于 2019-12-30 10:37:29
问题 I have a list of City objects with name and id fields. I use Struts2 and I a have jsp page with a select tag. <s:select label="Source city" list="cities" name="source"/> Here is Action class public class CalculationAction extends ActionSupport { private List<City> cities; private DataAccessPerformer dao = new DataAccessPerformer(); private String source; private int sourceId; public CalculationAction() { cities = new ArrayList<City>(); // getting cities from database setCities(dao

Current URL /web/guest/HTML generates exception: null in Liferay 6.0.6

落花浮王杯 提交于 2019-12-22 00:26:09
问题 I develop an example of Struts2 with Jasper Reports and every thing work fine. In my index.jsp I have index.jsp : <body> <a href="HTML.action" target="_blank" >click to generate pdf report</a> </body> struts.xml : <struts> <package name="default" extends="struts-default,jasperreports-default"> <action name="HTML" class="com.tutorialspoint.DataBeanList" method="exporte"> <result name="success">/index.jsp</result> </action> </package> </struts> but when I want to do that with Liferay 6.0.6 I

Jquery Error - While calling struts action

微笑、不失礼 提交于 2019-12-10 12:03:09
问题 I'm calling struts action from jquery like below code. jQuery( "#dialog-form" ).dialog({ autoOpen: false, height: 300, width: 350, modal: true, buttons : { "Search" : function() { jQuery.ajax({ type : 'POST', url : ' <s:submit action="part" method="find" /> ' }) } } }); Is there any way to call struts action from jquery ? 回答1: Use jQuery("#dialog-form").dialog({ autoOpen: false, height: 300, width: 350, modal: true, buttons : { "Search" : function() { jQuery.ajax({type : 'POST', url : '<s:url

Struts 2 s:select with values from resource bundle

无人久伴 提交于 2019-12-05 07:00:13
We are using the s:select to show a list of string from resource bundle. In the Action: //bank codes will be something [12,13,14] List<String> bankCodesList; //with setter and getter String selectedBankCode; In the message resources each bank will have a name: bank.code.12= ALFM Bank bank.code.13= RIHN Bank .... In the JSP: <s:select name = "selectedBankCode" list = "bankCodesList" listKey = "toString()" listValue = "%{getText('bank.code.' + toString())}" /> As the bank list is List<String> we used toString() to get the key and used toString() to get value from resource bundle. I excepted to

How to compare two strings using Struts2 tags and OGNL?

感情迁移 提交于 2019-12-04 22:28:26
问题 I am trying to compare two values : one from session and anther from iterator <s:iterator value="themes" status="currentRecord"> <s:if test="%{usertheme}) == %{themeName}"> <td align="center" bgcolor="red"> </s:if> <s:else> <td align="center" bgcolor="green"> </s:else> </s:iterator> But I am unable to compare my values, please can you tell me where I am doing mistakes ? 回答1: %{} should be put (if necessary) around all the statement, not in the middle. For Strings you should use .equals ,