requestcontext

RequestContext won't work

早过忘川 提交于 2019-12-10 11:54:25
问题 I am having trouble to update the view from the bean in the back using PrimeFaces's RequestContext . In the example below I have a button and 2 panels. When pressing the button, I want to update one panel, but not the other one. It does not work though and I can't find the error! requestContext.update("panela"); is fired, but doesn't do its job! Help greatly appreciated! The XHTML file: <!DOCTYPE html> <html xmlns="http://www.w3c.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:p=

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

浪子不回头ぞ 提交于 2019-12-05 06:21:41
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? Solution found! --------------------------------------------------------------------- I did some research and found the answer to this question. And the solution was to use some JSON library (right now I am using GSON) to convert Java

How do I Access the RequestContext Outside the Controller?

旧街凉风 提交于 2019-12-04 15:53:22
问题 Background I am trying to move business logic out from the controllers into their own services. Controller public class AccountController : Controller { private readonly IAccountService _accountService; public AccountController(IAccountService accountService) { _accountService = accountService; } .... } I'm using Unity to inject dependencies. I'd like to use the Url.GenerateUrl() helper method within the implementation of IAccountService but Url is a property against the controller. I looked

How do I Access the RequestContext Outside the Controller?

空扰寡人 提交于 2019-12-03 10:52:49
Background I am trying to move business logic out from the controllers into their own services. Controller public class AccountController : Controller { private readonly IAccountService _accountService; public AccountController(IAccountService accountService) { _accountService = accountService; } .... } I'm using Unity to inject dependencies. I'd like to use the Url.GenerateUrl() helper method within the implementation of IAccountService but Url is a property against the controller. I looked at the MVC source to see how this is done but it requires me to access the RequestContext from outside

Clarify how GWT RequestFactory and RequestContext work

戏子无情 提交于 2019-12-03 03:23:20
问题 I am trying to implement RequestFactory and the Editor framework into my app. I'm finding even after researching the forum, the Google Developer forum, and others that there is something fundamental that I don't understand about using RequestContext with RequestFactory. Here is my scenario: I have a simple Entity that has three fields, id, version, description called CmsObjectType. I have a corresponding EntityProxy and an CmsObjectTypeServiceDAO with my CRUD operations. I have also

Clarify how GWT RequestFactory and RequestContext work

二次信任 提交于 2019-12-02 16:53:37
I am trying to implement RequestFactory and the Editor framework into my app. I'm finding even after researching the forum, the Google Developer forum, and others that there is something fundamental that I don't understand about using RequestContext with RequestFactory. Here is my scenario: I have a simple Entity that has three fields, id, version, description called CmsObjectType. I have a corresponding EntityProxy and an CmsObjectTypeServiceDAO with my CRUD operations. I have also implemented ServiceLocator and ObjectLocator classes. This code all compiles and runs. I have also created a

How to access RequestContext in class-based generic views?

元气小坏坏 提交于 2019-11-30 22:02:35
问题 I have this path in my urls.py: archive_index_dict = { 'queryset': News.objects.filter(show=True), 'date_field': 'date', 'template_object_name': 'object_list', } ... url(r'^$', 'django.views.generic.date_based.archive_index', archive_index_dict, name='news_archive_index' ), Now I want to detect in template if a page is current (this is for menu styling). Neither {{ request.path }} nor {{ request.get_full_path }} work in template. What should I use instead? SOLUTION To get request available in

Why on earth do I have to pass RequestContext in all of my responses?

拥有回忆 提交于 2019-11-29 01:13:45
问题 I want to highlight the current page in the navigation menu. Obviously I need to give the menu links a class like 'active' when you are on their page. This is a classic problem and I've seen many solutions proposed. My problem is I hate all of them and consider none of them to be very DRY. For example: @register.simple_tag def active(request, pattern): import re if re.search(pattern, request.path): return 'active' return '' ---- {% load tags %} <div id="navigation"> <a class="{% active

CSRF verification failed. Request aborted

核能气质少年 提交于 2019-11-27 08:42:33
I try to build a very simple website where one can add data into sqlite3 database. I have a POST form with two text input. index.html: {% if top_list %} <ul> <b><pre>Name Total steps</pre></b> {% for t in top_list %} <pre>{{t.name}} {{t.total_steps}}</pre> {% endfor %} </ul> {% else %} <p>No data available.</p> {% endif %} <br> <form action="/steps_count/" method="post"> {% csrf_token %} Name: <input type="text" name="Name" /><br /> Steps: <input type="text" name="Steps" /><br /> <input type="submit" value="Add" /> </form> forms.py: from django import forms from steps_count.models import Top

CSRF verification failed. Request aborted

狂风中的少年 提交于 2019-11-26 14:16:00
问题 I try to build a very simple website where one can add data into sqlite3 database. I have a POST form with two text input. index.html: {% if top_list %} <ul> <b><pre>Name Total steps</pre></b> {% for t in top_list %} <pre>{{t.name}} {{t.total_steps}}</pre> {% endfor %} </ul> {% else %} <p>No data available.</p> {% endif %} <br> <form action="/steps_count/" method="post"> {% csrf_token %} Name: <input type="text" name="Name" /><br /> Steps: <input type="text" name="Steps" /><br /> <input type=