ognl

What's the purpose of storing objects directly to the ValueStack/ActionContext?

╄→гoц情女王★ 提交于 2019-12-12 06:04:40
问题 Based from what I've researched, I've seen that tags such as <s:set> , <s:push> or by creating an <s:bean> are able to insert references directly to the ActionContext or ValueStack . This confuses me a lot because why can't you just have one dedicated place to store everything? Probably just put everything in the ActionContext since it's basically acts as a ServletContext . To make it even more confusing, if you wanted to access values in the ValueStack , you'll have to use Struts tags such

Is the ValueStack life cycle across the application in struts2?

元气小坏坏 提交于 2019-12-12 04:12:55
问题 I can set a property on ValueStack in several ways. ValueStack stack = ActionContext.getContext().getValueStack(); stack.getContext().put("resultDTO",resultDTO); //1. creates a different branch //parallel to root stack.set("resultDTO", resultDTO); //2. pushes on root as a Map? stack.push(resultDTO); //3. pushes on root myActionClass.setProperty(); //4. normal action accessor I need to be able to get all these values back in JSP, freemarker and java like stack.findValue() or stack.findString()

java.lang.NoClassDefFoundError: ognl/PropertyAccessor

百般思念 提交于 2019-12-12 03:16:41
问题 I just tried to compile a simple hello java program on eclipse ide. An here is the stack trace. I added all the required libraries for struts 2. java.lang.NoClassDefFoundError: ognl/PropertyAccessor at com.opensymphony.xwork2.config.impl.DefaultConfiguration.createBootstrapContainer(DefaultConfiguration.java:342) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:235) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration

Is there a way to bind OGNL with Struts2 UI tags

强颜欢笑 提交于 2019-12-12 02:44:50
问题 I'm developing a webapp using Struts2. I used to work with Struts1 is there a way to reference a session object directly to the JSP so that if I change the value in the formular, the value in the referenced session object will also be updated. <s:textfield name="%{#session.order.amount}"/> for e.g. I have a session object order which has attribute amount with getter and setter. it seems like, after I put some values into the textfield and then submit the page, the value in the session didn't

Sending data to another JSP file from action class

Deadly 提交于 2019-12-12 02:05:53
问题 The main page has link to create new record and one to show all the existing records. On the create_new_record page I am writing all the data to a file in an action class method called saveRecords and populating a List<Records> in retriveRecords methods. My action class code: public class MyRecordes{ List<RecoredInfo> recoreds= new ArrayList<RecoredInfo>(); } I have getters and setters for the same records in my action class(I am using Struts 2), but on the main page when I click to show all

How does Struts create an action bean?

北城余情 提交于 2019-12-11 20:58:00
问题 I use Struts2.x and I know that Struts creates the declared bean objects in the action based on the request so that it is available to the action. I have been researching to understand which interceptors/classes does Struts use internally to create the bean object. I am trying to understand the logic that is used internally for creation of the bean objects. Does it use PropertyUtils to populate properties for the beans or some other way? Any suggestion or pointers for reading will be helpful.

Access Struts 2 action class properties directly

烂漫一生 提交于 2019-12-11 16:45:00
问题 I want to know if we populates action class properties, can we access them directly in the result JSP with out assign them to a form in the action class? 回答1: I think you need to have the bean getter method defined properly . Say , if a property is named id and you have a method called getId() in your action. Then it can be accessed directly in the JSP as : OGNL expression: <s:property value="id"/> OR JSTL expression: <c:out value="${action.id}"/> 回答2: one thing u can do is that initialize

Struts2 action class when loading page

依然范特西╮ 提交于 2019-12-11 13:16:01
问题 I must be missing something that I hope someone can set me straight. The webapp I inherited uses struts2 and JSP pages, and I want to organize it using this layout manager ( http://igniteui.com/layout-manager/border-layout-markup ). There will be a menu on the left which has links that will load content into the center, while the 'main' page (header, footer, left menu) stays put which I believe fits the SPA principles. The 'content' in the middle will be JSP pages that have forms with input

JSON object parsing using OGNL in struts 2

*爱你&永不变心* 提交于 2019-12-11 12:16:02
问题 I have an action class like public class DataProcessor extends ActionSupport{ private JSONObject object; public JSONObject getObject() { return object; } public void setObject(JSONObject object) { this.object = object; } @Override public String execute() throws Exception { ....... return SUCCESS; } } My XML mapping is like <package name="default" extends="struts-default" namespace="/"> <action name="process" class="com.demo.DataProcessor"> <result type="success">home.jsp</result> </action> <

struts 2 : Capturing modifications to a guava table (TreeBasedTable) in action

十年热恋 提交于 2019-12-11 09:00:27
问题 There is an object (ObjectA) which has another object inside (ObjectB). There is a Guava TreeBasedTable inside the Object B. This Table has a string as row-key,column-key and another object "ObjectC" as value. This table has been displayed on the jsp using the <s:iterator/> and <s:textfield/> tags and it is being displayed correctly (the "values" inside the <s:textfield/> are correct but the "names" are not). Now, the problem arises when the <s:textfield/> is modified. How do we capture the