I have a list that is accessible to all user of my application.I am currently adding it to session of a particular user.But i want it to be in application scope rather than session scope.Please help also provide reference/link to any example
In action you can use :
ServletActionContext.getContext().getApplication().put("myVar", myObj);
In order to set in a JSP, you can use the <s:set> tag as :
<s:set name="myVar" scope="application" value="myObj"/>
I am not sure how you want to use the list: you want to display that list to the screen or you just need it as configuration. To display it you could:
create your list statically in your Action, then display it in the JSP
you could take the list dynamically from a database, then display it in the JSP
To use it as configuration: some data can be made available at application level at initialization, but those are configuration params. More info here:
where to put configuration parameters
Using the ServletContext is the only way you can set parameters dynamically to the servlet from your code: servletContext.setAttribute(). More info here:
why use servlet context
Related
I'm using vue.js 2.3 and element-ui.
I'd like to use the upload-file component to send files to my server.
In the doc we can find the action "https://jsonplaceholder.typicode.com/posts/"
Question
I would like to know how can I add a parameter to the action?
Situation
I currently receive an array file with the data of my file but I would like to be able to pass other parameters
If you look at the list of attributes on the documentation page you linked to, there is a data attribute that lets you specify an object as "addition[al] options of [the] request".
I am creating apps using Podio PHP library and want to specify always hidden setting. I have tried it a lot but I did not find any option in the library so can someone please help me to point out how I can specify this setting.
After investigation, I am able to figure it out like how to pass the always hidden. When we are creating an app with fields then for each field we need to provide config array so in this config array we need to pass new property "hidden_create_view_edit" with true and it will create app field with always hidden setting.
Sample config array:
"config"=>array(
"required"=>false,
"label"=>"Name",
"delta"=>1,
"hidden_create_view_edit"=>true
)
i am a newbie in Alfresco. I have created custom datalist models, context model and also configured the share config xml file and everything is working well. How ever the datalist is not showing when i log in alfresco. What should i do then.
You should be able to create one of your custom datalists on the page :
http://"myhostandport"/share/page/site/"mysite"/data-lists
Does it show up there?
If not:
-Did you declare your datalist content model as a bean with parent="dictionaryModelBootstrap"?
-Does your content model type extend dl:dataListItem
-You can find all the datalists of your type with this kind of query: #dl\:dataListItemType:'myprefix\:mydatalisttype'
I'm trying to limit the session access to a Struts application so the users will only be able to use 1 tab at the time. To do this, I have to create an ID everytime a new page is loaded and assign that ID to the user's session. By doing so, if the user uses a page with a different ID than the one registered in his session, the action will be rejected.
How can I do a listener on every page load? Which interface should I use?
Or do you have any other idea of how I could manage multiple tabs?
I'm Using Struts 1 and Java 4.
You could use Spring MVC Interceptors and override the preHandle method.
Returning false inside should cancel your request for not allowed additional tabs.
You can use an interceptor to do this. You will need to define it on your interceptor stack in your struts.xml and code the interceptor to check the JEE role information provided by your web application server. The interceptor can be coded to give a redirect result on the other tab if there was recently an action called however you will probably need to coordinate it via JS generated ids and AJAX.
https://struts.apache.org/docs/interceptors.html
I am creating a dnn module. The content depends on the param in the url.
I want to be able to edit this content in the 'edit content' mode. However when i go to edit content the param in the url is no longer accessible because it is the parent document. How do i go about passing this value from the view.ascx to the edit.ascx?
Try storing the param in cookies or localstorage. Then you should be able to access it. Of course the user will be able to modify it but you can do a check that the user has not modified it by storing a server side encryption or somthing like that.
A workaround is to have a field where the user enters this parameter. But i know this isn't a very good solution. I am guessing that you will have to override the dotnetnuke core to do this (yes i know it sucks).
I hope I am understanding the question properly.
To pass parameters from your View to Edit controls, you should first make sure they are registered properly in the module definition. You default View should have an empty controlkey and your Edit should be registered with a control key, for example "addedit".
When creating a link between your view control and edit control, use the EditUrl() method of PortalModuleBase. When passing a parameter, for example an id of the item you want to load into your edit control, you can pass them as arguments in the EditUr method.
Example (in my view.ascx.cs):
lnkEdit.NavigateUrl = EditUrl("id", "16", "addedit");
This will assign a module view link to the edit.ascx (assuming the controlkey in the definition is addedit) passing in a url parameter "id" with value 16.
See my DNN Module Views tutorial for a complete lesson on how to do DNN module views and navigation.
http://www.dnnhero.com/Premium/Tutorial/tabid/259/ArticleID/204/Introduction-and-Module-Definition-basics-in-DNN-Part-1-6.aspx