Hi all,
I create a Controller bean to map a dedicated URI.
My web.xml file :
<!-- Spring MVC Servlet (that will route HTTP requests to BlazeDS) -->
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>cont...
Hi, i've got this code
Model
public class PdfPage
{
public IEnumerable<PdfPhoto> Photos { get; set; }
}
public class PdfPhoto
{
public string path { get; set; }
}
View
<ul>
<li>
<%= Html.Hidden("ListPages[0].Photos[0].path", "/public/pdfMaker/4_e.jpg")%>
<%= Html.Hidden("ListPages[0].Photos[1].path", "/public/pdfMaker...
I have a basic Rails form like so:
<%= form_for @person do |f| %>
<%= f.label :first_name %>:
<%= f.text_field :first_name %><br />
<%= f.label :last_name %>:
<%= f.text_field :last_name %><br />
<%= f.submit %>
<% end %>
How could I optionally send the form information to another an entirely different controll...
I'm new to programming, iphone application programming in specific. After reading a bunch about MVC I decided to give it a try in a small application. As to my understanding, MVC works like this:
Model: data, manipulating data, retrieving data.
ViewController: formats data from the model (NSDate to specific style), etc.
View: the actu...
Hi,
I'm running some old (but valid, i'm told) tests on a legacy application, and notice that many of them arent working. The error message usually is 'No method signature for some dymamic method'
After using mockDomain I managed to solve that problem.
However, I can't figure out how to test controllers that create objects inside.
Fo...
Trying to use __construct inside a controller to assign some variable but it keeps throwing errors. Hoping that someone can lead me in the right direction.
class Controller_Mobile extends Controller {
public function __construct()
{
parent::__construct();
$iphoneDetect = strpos($_SERVER['HTTP_USER_AGENT']...
tags_controller.rb:
def index
@title = "tags"
@posts = Post.tag_counts.collect do |tag|
Post.tagged_with(tag).first(:order => "updated_at DESC")
end
@posts.uniq!
end
tags/index.html.rb:
<%= render 'latest' %>
_latest.html.erb:
<%- for post in @posts -%>
<%- post.tags.each do |t| -%>
<%= link_to t.name, tag_path(t...
Hey guys,
I have this private session in one of my controllers that checks if a user is logged in:
function _is_logged_in() {
$user = $this->session->userdata('user_data');
if (!isset($user)) { return false; } else { return true; }
}
Problem is that I have more than one Controller. How can I use this function in those other...
I'd like to list all current sessions in an Admin Controller in grails. What's the easiest way to get a reference to e.g. a Collection of sessions from the controller?
...
I'm using pylons, and my action of controller is:
class UserController(BaseController):
def create(self):
name = request.POST['name']
email = request.POST['email']
password = request.POST['password']
...
But I found in turbogears, I can do like this:
class UserController:
de...
I just had a quick question as I'm still learning grails. I have a controller class that just reads a text file and loads a list with information. I'm wanting to populate one of my domains through this list. Am I able to do it like this?
For instance, I have a bookController, the controller does something like
//psuedocode
import book...
Guys,
I've got a controller called "ResourcesController", but its really managing the CRUD for two different models.
I don't actually have a model called Resource, so the controller is balking that it can't find it.
Is there a way I can inform the controller which model I'll be working with so it doesn't freak out?
The error that is ...
Hi php guru :)
I'm newbie and learning Yii framework where Im designing first small application and got stuck on this position where I need your attention as your guys are guru.
I have a 'City name' list on main layout in header section where a user select a 'City' then I would like to pass that City_id to 'PostController' and search f...
I have a stripped down shopping cart application, currently with one model "cart", the cart id is stored in a session.
the cart controller has this method so we always have a cart
def initialize_cart
if session[:cart_id]
@cart = Cart.find(session[:cart_id])
else
@cart = Cart.create
session[:cart_id] = @cart....
I want to log the controller and action when a request comes, so I write a __before__ in the base controller:
class BaseController:
__before__(self):
controller = get_controller(request)
action = get_action(request)
logger.log('%s - %s'%(controller, action))
But I don't know how to get the controlle...
The DefaultControllerFactory contains three different methods:
GetControllerInstance
CreateController
GetControllerType
When is each method executed in the request lifetime? I've seen custom controller factories where one of these methods is overridden and implemented but I can't seem to find details on the execution path of each one...
My controller is shared by links from a search result page that needs a layout, and from the profile page itself that does not need a layout. What I would like to accomplish is a single controller method show that is both capable of drawing the partial by AJAX from the profile page, and draw the partial and layout from the search results...
I'm just starting to sketch up the base of a web-based system, and I would like the admin to have the possibility to limit access either by Controller or by Model. My problem is, I can't decide which one (or both?) of them I should go with. Any ideas? Pros/Cons?
First I was leaning towards doing it in the Controllers, seeing as they "co...
I have a ControllerBase class in an ASP.NET MVC Application. The other controllers inherit from ControllerBase.
I want to access HttpContext.User.Identity.Name, but HttpContext is null. What's the matter?
public ControllerBase()
{
var dataManager=new DataManager();
if (HttpContext.User.Identity.IsAuthent...
Coming from rails 2, most of my controllers would have these lines:
verify :method => :post, :only => :create, :render => {:text => '405 HTTP POST required', :status => 405}, :add_headers => {'Allow' => 'POST'}
verify :method => :put, :only => :update, :render => {:text => '405 HTTP PUT required', :status => 405}, :add_headers => {'Allo...