requestcontext

pass multiple objects to RequestContext in django

不问归期 提交于 2020-06-25 21:34:55
问题 I need to pass a dict and an object to a template. So, I do this rc = RequestContext(request, {'prob':prob}, {'result':result}) return render_to_response('subject/question.html', context_instance=rc) But I get a error. Traceback: File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response 111. response = callback(request, *callback_args, **callback_kwargs) File "E:\django-sample\proschools\..\proschools\subject\views.py" in eval_c 72. rc = RequestContext(request, {'prob'

Spring mvc request scope context across threads

北战南征 提交于 2019-12-25 09:12:01
问题 In a spring MVC web application, I wanna store user information at the request scope, in the filer or interceptor I will build the user information and store it and use it later within this request.I know in spring I can create request scope spring beans , but these beans can only be accessed within the request thread(maybe the child thread).However I will access the user information in the thread pool.So the build in request scope spring bean may not suitable for me. Any tip for store

Synchronous dialog invocation from managed bean

佐手、 提交于 2019-12-25 05:31:54
问题 Is there a way to use PrimeFaces RequestContext to call a dialog defined in the JSF from a managed bean, which has a form, but synchronously, meaning that the managed bean wait its thread execution until the user submits the form? Currently, I am successfully invoking a dialog from my managed bean but the call is asynchronous, meaning the dialog is popped open but the managed bean thread continues on without waiting for the user to supply the needed additional data via the dialog. So, in my

How to send a POJO as a callback param using PrimeFaces' RequestContext?

核能气质少年 提交于 2019-12-22 05:27:18
问题 I can send callback param(s) and it works perfectly as long as I am only sending some primitive types like String. But the same thing does not work for even the simplest POJO. PrimeFaces guide says that the RequestContext.addCallbackParam() method can handle POJOs and it coverts them into JSON. I don't know why it's not working in my case. Has anybody done that? 回答1: Solution found! --------------------------------------------------------------------- I did some research and found the answer

Primefaces JSF null returned from RequestContext.getCurrentInstance()

烈酒焚心 提交于 2019-12-13 12:32:40
问题 I'm developing an app using Primefaces tag library. So far I've copied some examples from their official website and all seems to work except for anything that uses the RequestContext.getCurrentInstance() method. It either returns null every time, causing Tomcat to throw a NullPointer exception or hangs forever, never returning anything. Here's my code (the case where it hangs): GlobalCounterBean.java package org.primefaces.examples.view; import java.io.Serializable; import org.primefaces

django-postman discards RequestContext

对着背影说爱祢 提交于 2019-12-12 03:08:18
问题 I installed django-postman to my project. Afterwards, I saw that when I login, it logs in to the user home but then whenever I click on a link, session goes out. It wants me to re-login. I'm using context_instance=RequestContext(request) at each view. So what could be the problem? This happened when I inserted the following: TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.static', 'django.core.context_processors.request', ) Without static one, it event doesnt recognize STATIC

didn't return an HttpResponse object

▼魔方 西西 提交于 2019-12-11 19:15:39
问题 I don't know why this is not working, please help views.py def addaNonProfit(request): """we need NonProfits.""" if request.method == 'POST': form = NonProfitForm(request.POST) if form.is_valid(): new_nonProfit = form.save(request.user) return HttpResponseRedirect(reverse(new_nonProfit, args=(new_nonProfit.slug,))) else: form = NonProfitForm() return render_to_response('addaNonProfit.html',{'form': form},context_instance=RequestContext(request)) def nonProfit(request,slug): """ we need a page

Primefaces RequestContext scrollTo does not work

℡╲_俬逩灬. 提交于 2019-12-10 20:36:34
问题 Primefaces v3.5 Trying to use RequestContext.getContext().scrollTo("") to scroll to my form programmatically at the end of an ajax request. XHTML snippets: <h:form id="genericMessagesForm"> <p:messages id="genericMessages" /> </h:form> <p:commandButton id="testButton" value="Test" process="#{cc.attrs.itemName}Final, @this" actionListener="#{myBean.methodCalledByAjax()}" /> Bean: public void methodCalledByAjax() { List<String> updateTargets = new ArrayList<String>(); updateTargets.add(