Search Results

Search found 18244 results on 730 pages for 'controller action'.

Page 10/730 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • ASP.NET MVC DropDownList SelectedValue works on Edit action, but not Create action

    - by davekaro
    I have the following code in my controller (for Edit and Create): model.Templates = new SelectList(PageManagementService.PageTemplateFetchList(), "PageId", "Title", 213); the "213" is an Id for one of the pages - just using it for testing. And this is in my view (for Edit and Create): <%= this.Html.DropDownListFor(model => model.Page.TemplateId, this.Model.Templates)%> <%= this.Model.Templates.SelectedValue %> When I go to the Create form, I see the dropdown list, but the tag with value="213" is not selected. I even output the SelectedValue to make sure it's 213 - and I see 213. When I go to the Edit form, I see the dropdown list, and the tag with value="213" is selected. On the Create form, none of the tags have a "selected" attribute. On the Edit form, the tag with value="213" has the "selected" attribute. Am I missing something? What could be causing this? Anyone see this behavior before?

    Read the article

  • How do i refactor this code by using Action<t> or Func<t> delegates

    - by user330612
    I have a sample program, which needs to execute 3 methods in a particular order. And after executing each method, should do error handling. Now i did this in a normal fashion, w/o using delegates like this. class Program { public static void Main() { MyTest(); } private static bool MyTest() { bool result = true; int m = 2; int temp = 0; try { temp = Function1(m); } catch (Exception e) { Console.WriteLine("Caught exception for function1" + e.Message); result = false; } try { Function2(temp); } catch (Exception e) { Console.WriteLine("Caught exception for function2" + e.Message); result = false; } try { Function3(temp); } catch (Exception e) { Console.WriteLine("Caught exception for function3" + e.Message); result = false; } return result; } public static int Function1(int x) { Console.WriteLine("Sum is calculated"); return x + x; } public static int Function2(int x) { Console.WriteLine("Difference is calculated "); return (x - x); } public static int Function3(int x) { return x * x; } } As you can see, this code looks ugly w/ so many try catch loops, which are all doing the same thing...so i decided that i can use delegates to refactor this code so that Try Catch can be all shoved into one method so that it looks neat. I was looking at some examples online and couldnt figure our if i shud use Action or Func delegates for this. Both look similar but im unable to get a clear idea how to implement this. Any help is gr8ly appreciated. I'm using .NET 4.0, so im allowed to use anonymous methods n lambda expressions also for this Thanks

    Read the article

  • How to add View Controller with Tab Bar interfaced View Controller

    - by TechFusion
    I have created Window based Tab Bar controller app, One Tab Bar of viewController has been interfaced with WebVIew ..I am looking to create another view once touch event happened in that WebView.. //TabBarViewController.m - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { TabMainView *mainView = [[TabMainView alloc] init]; mainView.hidesBottomBarWhenPushed = YES; [self.navigationController pushViewController: mainView animated:YES]; [mainView release]; } I have created MainView, which is UIViewController Subclass. //TabMainView.m - (void)loadView { CGRect frame = CGRectMake(0.0, 0.0, 480, 320); WebView = [[[UIWebView alloc] initWithFrame:frame] autorelease]; WebView.backgroundColor = [UIColor whiteColor]; WebView.scalesPageToFit = YES; WebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin); WebView.autoresizesSubviews = YES; WebView.exclusiveTouch = YES; //self.WebView.UserInteractionEnabled = NO; WebView.clearsContextBeforeDrawing = YES; self.view = WebView; [WebView release]; } - (void)viewWillAppear:(BOOL)animated { [self.WebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.apple.com"]]]; } Here when touch event happened then it is not passing control to TabMainView.m 's Viewload function although I am pushing it's view? TabBarView is also UIViewController subclass not a UINavigationController.

    Read the article

  • Codeigniter Controller function in a view [closed]

    - by Y2ok
    I'm using CodeIgniter and I have two controllers: Index controller that loads the website view Personal panel controller that will do all login, registration and personal panel functions. (Functions are loaded from models.) The problem is that I don't have any clue how to insert that controller in a view file or in the other controller file so that it would load when I press submit button for a form or if the session's loggedin is with value true.

    Read the article

  • Testing a scoped find in a Rails controller with RSpec

    - by Joseph DelCioppio
    I've got a controller called SolutionsController whose index action is different depending on the value of params[:user_id]. If its nil, then it simply displays all of the solutions on my site, but if its not nil, then it displays all of the solutions for the given user id. Here it is: def index if(params[:user_id]) @solutions = @user.solutions.find(:all) else @solutions = Solution.find(:all) end end and @user is determined like this: private def load_user if(params[:user_id ]) @user = User.find(params[:user_id]) end end I've got an Rspec test to test the index action if the user is nil: describe "GET index" do context "when user_id is nil" do it "should find all of the solutions" do Solution.should_receive(:find).with(:all).and_return(@solutions) get :index end end end however, can someone tell me how I write a similar test for the other half of my controller, when the user id isn't nil? Something like: describe "GET index" do context "when user_id isn't nil" do before(:each) do @user = Factory.create(:user) @solutions = 7.times{Factory.build(:solution, :user => @user)} @user.stub!(:solutions).and_return(@solutions) end it "should find all of the solutions owned by a user" do @user.should_receive(:solutions).and_return(@solutions) get :index, :user_id => @user.id end end end But that doesn't work. Can someone help me out? Joe

    Read the article

  • Testing a scoped find in a Rails controller with RSpec

    - by Joseph DelCioppio
    I've got a controller called SolutionsController whose index action is different depending on the value of params[:user_id]. If its nil, then it simply displays all of the solutions on my site, but if its not nil, then it displays all of the solutions for the given user id. Here it is: def index if(params[:user_id]) @solutions = @user.solutions.find(:all) else @solutions = Solution.find(:all) end end and @user is determined like this: private def load_user if(params[:user_id ]) @user = User.find(params[:user_id]) end end I've got an Rspec test to test the index action if the user is nil: describe "GET index" do context "when user_id is nil" do it "should find all of the solutions" do Solution.should_receive(:find).with(:all).and_return(@solutions) get :index end end end however, can someone tell me how I write a similar test for the other half of my controller, when the user id isn't nil? Something like: describe "GET index" do context "when user_id isn't nil" do before(:each) do @user = Factory.create(:user) @solutions = 7.times{Factory.build(:solution, :user => @user)} @user.stub!(:solutions).and_return(@solutions) end it "should find all of the solutions owned by a user" do @user.should_receive(:solutions).and_return(@solutions) get :index, :user_id => @user.id end end end But that doesn't work. Can someone help me out? Joe

    Read the article

  • Navigation Controller Views in Landscape

    - by Mahadevan S
    Hi, I have set up a navigation controller ( navController ) in Portrait mode to which I push all the viewcontrollers I have. Now when a user switches to Landscape mode, I need to display all the views as a coverflow. For this I use [navController viewControllers] to get all the view controllers in the stack. In the Landscape view controller NSArray * arr = [navController viewControllers]; self.view = [arr objectAtIndex:0]; [arr objectAtIndex:0]; returns the correct view ( the bottombost viewcontroller's view in the nav stack ). My problem is these views never get displayed ie the views extracted from the navController never gets displayed. If i try to create a new view and insert all the subviews of a view, it gets displayed. eg : UIView * newView = [[UIView alloc] init]; for (UIView *subView in [arr objectAtIndex:0]) [newView addSubView:subView]; self.view = newView; The above piece of code works. But simply adding the view doesnt seem to work.. Can anyone explain the solution? Many thanks

    Read the article

  • Creating foreach loops using Code Igniter controller and view

    - by Tim
    Hello, This is a situation I have found myself in a few times and I just want clear it up once and for all. Best just to show you what I need to do in some example code. My Controller function my_controller() { $id = $this->uri->segment(3); $this->db->from('cue_sheets'); $this->db->where('id', $id); $data['get_cue_sheets'] = $this->db->get(); $this->db->from('clips'); $this->db->where('sheet_id', ' CUE SHEET ID GOES IN HERE ??? '); $data['get_clips'] = $this->db->get(); $this->load->view('show_sheets_and_clips', $data); } My View <?php if($get_cue_sheets->result_array()) { ?> <?php foreach($get_cue_sheets->result_array() as $sheetRow): ?> <h1><?php echo $sheetRow['sheet_name']; ?></h1> <br/> <?php if($get_clips->result_array()) { ?> <ul> <?php foreach($get_clips->result_array() as $clipRow): ?> <li><?php echo $clipRow['clip_name']; ?></li> <?php endforeach; ?> </ul> <?php } else { echo 'No Clips Found'; } ?> <?php endforeach; ?> <?php } ?> The problem I am having is the concept of passing data back to the controller from the view as I am sending the Database Queries off to the view as an array, when I really need to get some more information as to which sheet ID I am looking for to show the relevant clips. I hope this makes sense to someone out there. Thanks, Tim

    Read the article

  • Getting values from the html to the controller

    - by tina
    Hi, I'm trying to access the values a user introduces in a table from my controller. This table is NOT part of the model, and the view source code is something like: <table id="tableSeriales" summary="Seriales" class="servicesT" cellspacing="0" style="width: 100%"> <tr> <td class="servHd">Seriales</td> </tr> <tr id="t0"> <td class="servBodL"> <input id="0" type="text" value="1234" onkeypress = "return handleKeyPress(event, this.id);"/> <input id="1" type="text" value="578" onkeypress = "return handleKeyPress(event, this.id);"/> . . . </td> </tr> </table> How can I get those values (1234, 578) from the controller? Receiving a formcollection doesn't work since it does not get the table... Thank you.

    Read the article

  • grails question (sample 1 of Grails To Action book) problem with Controller and Service

    - by fegloff
    Hi, I'm doing Grails To Action sample for chapter one. Every was just fine until I started to work with Services. When I run the app I have the following error: groovy.lang.MissingPropertyException: No such property: quoteService for class: qotd.QuoteController at qotd.QuoteController$_closure3.doCall(QuoteController.groovy:14) at qotd.QuoteController$_closure3.doCall(QuoteController.groovy) at java.lang.Thread.run(Thread.java:619) Here is my groovie QuoteService class, which has an error within the definition of GetStaticQuote (ERROR: Groovy:unable to resolve class Quote) package qotd class QuoteService { boolean transactional = false def getRandomQuote() { def allQuotes = Quote.list() def randomQuote = null if (allQuotes.size() > 0) { def randomIdx = new Random().nextInt(allQuotes.size()) randomQuote = allQuotes[randomIdx] } else { randomQuote = getStaticQuote() } return randomQuote } def getStaticQuote() { return new Quote(author: "Anonymous",content: "Real Programmers Don't eat quiche") } } Controller groovie class package qotd class QuoteController { def index = { redirect(action: random) } def home = { render "<h1>Real Programmers do not each quiche!</h1>" } def random = { def randomQuote = quoteService.getRandomQuote() [ quote : randomQuote ] } def ajaxRandom = { def randomQuote = quoteService.getRandomQuote() render "<q>${randomQuote.content}</q>" + "<p>${randomQuote.author}</p>" } } Quote Class: package qotd class Quote { String content String author Date created = new Date() static constraints = { author(blank:false) content(maxSize:1000, blank:false) } } I'm doing the samples using Eclipse with grails addin. Any advice? Regards, Francisco

    Read the article

  • Spring Controller redirect to another page

    - by user1386375
    Hey I got the following problem. This is the content of the jspx file: function postSMTH() { $.ajax({ type: "POST", url: document.getElementById("urltxt").value, data: parameters, }); } <input type="hidden" value="${pageContext.request.contextPath}/foo/foo2/foodat" name="urltxt" id="urltxt"/> <div class="foodat"><a href="javascript:postSMTH();"><spring:message code="foo_foo2_foodat_text" text="FOODAT"/></a></div> So if I push the submit button, the postSMTH function is called and the ajax object is paste to the Controller which look like this: @Controller @RequestMapping(value="/foo") public class FooController { .............. @RequestMapping(value="/foo2", method=RequestMethod.POST) public String homePOST(HttpServletRequest request) { ........ } @RequestMapping(value="/foo2", method=RequestMethod.GET) public String homeGET(HttpServletRequest request) { ........ } @RequestMapping(value="/foo2/foodat", method=RequestMethod.POST) public String doTHAT(HttpServletRequest request) { // check authorization Map fooMap = request.getParameterMap(); // do something in the Database, depending on the paramMap return "redirect:/foo/foo1"; } } Everything is working fine regarding the Database, but the Problem is, that the redirect at the end DOESN'T work. It just stays at the page foo2. I'm new to Spring, maybe its a little mistake somewhere. I just cant make it out by myself. Would be nice if someone would have some hint. Thanks

    Read the article

  • Pass List of models to controller ASP.NET MVC 5

    - by user3697231
    I have a view where user can enter some data. But problem is this: Let's say you have 3 text box on view. Every time user can fill multiple times this 3 text boxes. To clarify, let's say user fills this 3 text boxes and press button which adds on form again these 3 text boxes. Now when user clicks submit this form is sent to controller, but how do I sent List of models as parameter. My architecture for this problem is something like this: MyModel public int ID { get;set; } public string Something { get; set; } /*This three textboxes can user set multiple times*/ /*Perhaps i Can create new model with these properties and then /*put List of that model as property here, but how to fill that list inside view ??*/ public string TextBoxOneValue { get; set; } public string TextBoxTwoValue { get; set; } public string TextBoxThreeValue { get; set; } Now, i was thinking that i Create PartialView with this 3 text boxes, and then when user clicks button on view another PartialView is loaded. And now, let's say I have Two partial views loaded, and user clicks submit, how that I pass list with values of these 3 text boxes to controller ??

    Read the article

  • Computer won't reboot without waiting for a while

    - by Benjamin
    I've got an unusual problem with my computer. When ever I reboot my computer it won't boot, I get a few beeps from the BIOS and nothing else, however if I wait for a few minuets the computer will boot perfectly. I tried to count the beeps and I get around 7-9 of them; the first two are noticeably closer together than the rest. [Edit: I'm now reasonably confident it's 1 long followed by 8 short beeps. That would be a display related issue: http://www.bioscentral.com/beepcodes/amibeep.htm] My BIOS is American Megatrends Inc and version P1.80, the Motherboard is an ASRock X58 Extreme (both according to dmidecode) Here's an output from LSPCI, I'm not sure what else might be useful but I can provide whatever's asked. 00:00.0 Host bridge: Intel Corporation 5520/5500/X58 I/O Hub to ESI Port (rev 13) 00:01.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 1 (rev 13) 00:03.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 3 (rev 13) 00:07.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 7 (rev 13) 00:14.0 PIC: Intel Corporation 5520/5500/X58 I/O Hub System Management Registers (rev 13) 00:14.1 PIC: Intel Corporation 5520/5500/X58 I/O Hub GPIO and Scratch Pad Registers (rev 13) 00:14.2 PIC: Intel Corporation 5520/5500/X58 I/O Hub Control Status and RAS Registers (rev 13) 00:14.3 PIC: Intel Corporation 5520/5500/X58 I/O Hub Throttle Registers (rev 13) 00:1a.0 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #4 00:1a.1 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #5 00:1a.2 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #6 00:1a.7 USB controller: Intel Corporation 82801JI (ICH10 Family) USB2 EHCI Controller #2 00:1b.0 Audio device: Intel Corporation 82801JI (ICH10 Family) HD Audio Controller 00:1c.0 PCI bridge: Intel Corporation 82801JI (ICH10 Family) PCI Express Root Port 1 00:1c.1 PCI bridge: Intel Corporation 82801JI (ICH10 Family) PCI Express Port 2 00:1c.5 PCI bridge: Intel Corporation 82801JI (ICH10 Family) PCI Express Root Port 6 00:1d.0 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #1 00:1d.1 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #2 00:1d.2 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #3 00:1d.7 USB controller: Intel Corporation 82801JI (ICH10 Family) USB2 EHCI Controller #1 00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 90) 00:1f.0 ISA bridge: Intel Corporation 82801JIR (ICH10R) LPC Interface Controller 00:1f.2 SATA controller: Intel Corporation 82801JI (ICH10 Family) SATA AHCI Controller 00:1f.3 SMBus: Intel Corporation 82801JI (ICH10 Family) SMBus Controller 01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 03) 02:00.0 FireWire (IEEE 1394): VIA Technologies, Inc. VT6315 Series Firewire Controller 02:00.1 IDE interface: VIA Technologies, Inc. VT6415 PATA IDE Host Controller (rev a0) 03:00.0 SATA controller: JMicron Technology Corp. JMB360 AHCI Controller (rev 02) 05:00.0 VGA compatible controller: nVidia Corporation GT200b [GeForce GTX 285] (rev a1) ff:00.0 Host bridge: Intel Corporation Xeon 5500/Core i7 QuickPath Architecture Generic Non-Core Registers (rev 05) ff:00.1 Host bridge: Intel Corporation Xeon 5500/Core i7 QuickPath Architecture System Address Decoder (rev 05) ff:02.0 Host bridge: Intel Corporation Xeon 5500/Core i7 QPI Link 0 (rev 05) ff:02.1 Host bridge: Intel Corporation Xeon 5500/Core i7 QPI Physical 0 (rev 05) ff:03.0 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller (rev 05) ff:03.1 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Target Address Decoder (rev 05) ff:03.4 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Test Registers (rev 05) ff:04.0 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 0 Control Registers (rev 05) ff:04.1 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 0 Address Registers (rev 05) ff:04.2 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 0 Rank Registers (rev 05) ff:04.3 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 0 Thermal Control Registers (rev 05) ff:05.0 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 1 Control Registers (rev 05) ff:05.1 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 1 Address Registers (rev 05) ff:05.2 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 1 Rank Registers (rev 05) ff:05.3 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 1 Thermal Control Registers (rev 05) ff:06.0 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 2 Control Registers (rev 05) ff:06.1 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 2 Address Registers (rev 05) ff:06.2 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 2 Rank Registers (rev 05) ff:06.3 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 2 Thermal Control Registers (rev 05) Update: ok I installed lm-sensors and here's the output. coretemp-isa-0000 Adapter: ISA adapter Core 0: +58.0°C (high = +80.0°C, crit = +100.0°C) Core 1: +59.0°C (high = +80.0°C, crit = +100.0°C) Core 2: +58.0°C (high = +80.0°C, crit = +100.0°C) Core 3: +57.0°C (high = +80.0°C, crit = +100.0°C) it8720-isa-0a10 Adapter: ISA adapter in0: +0.93 V (min = +0.00 V, max = +4.08 V) in1: +0.06 V (min = +0.00 V, max = +4.08 V) in2: +3.25 V (min = +0.00 V, max = +4.08 V) +5V: +2.91 V (min = +0.00 V, max = +4.08 V) in4: +3.04 V (min = +0.00 V, max = +4.08 V) in5: +2.94 V (min = +0.00 V, max = +4.08 V) in6: +2.14 V (min = +0.00 V, max = +4.08 V) 5VSB: +2.96 V (min = +0.00 V, max = +4.08 V) Vbat: +3.28 V fan1: 1869 RPM (min = 0 RPM) fan2: 0 RPM (min = 0 RPM) fan3: 0 RPM (min = 0 RPM) fan4: 1106 RPM (min = -1 RPM) fan5: 225000 RPM (min = -1 RPM) temp1: +39.0°C (low = +0.0°C, high = +127.0°C) sensor = thermistor temp2: +56.0°C (low = +0.0°C, high = +127.0°C) sensor = thermistor temp3: +127.0°C (low = +0.0°C, high = +127.0°C) sensor = thermistor cpu0_vid: +1.650 V intrusion0: ALARM If it helps here's the summery from sensors-detect Driver `it87': * ISA bus, address 0xa10 Chip `ITE IT8720F Super IO Sensors' (confidence: 9) Driver `adt7475': * Bus `NVIDIA i2c adapter 3 at 5:00.0' Busdriver `nvidia', I2C address 0x2e Chip `Analog Devices ADT7473' (confidence: 5) Driver `coretemp': * Chip `Intel digital thermal sensor' (confidence: 9)

    Read the article

  • JPedal Action for Converting PDF to JavaFX

    - by Geertjan
    The question of the day comes from Mark Stephens, from JPedal (JPedal is the leading 100% Java PDF library, providing a Java PDF viewer, PDF to image conversion, PDF printing or adding PDF search and PDF extraction features), in the form of a screenshot: The question is clear. By looking at the annotations above, you can see that Mark has an ActionListener that has been bound to the right-click popup menu on PDF files. Now he needs to get hold of the file to which the Action has been bound. How, oh  how, can one get hold of that file? Well, it's simple. Leave everything you see above exactly as it is but change the Java code section to this: public final class PDF2JavaFXContext implements ActionListener {     private final DataObject context;     public PDF2JavaFXContext(DataObject context) {         this.context = context;     }     public void actionPerformed(ActionEvent ev) {         FileObject fo = context.getPrimaryFile();         File theFile = FileUtil.toFile(fo);         //do something with your file...     } } The point is that the annotations at the top of the class bind the Action to either Actions.alwaysEnabled, which is a factory method for creating always-enabled Actions, or Actions.context, which is a factory method for creating context-sensitive Actions. How does the Action get bound to the factory method? The annotations are converted, when the module is compiled, into XML registration entries in the "generated-layer.xml", which you can find in your "build" folder, in the Files window, after building the module. In Mark's case, since the Action should be context-sensitive to PDF files, he needs to bind his PDF2JavaFXContext ActionListener (which should probably be named "PDF2JavaFXActionListener", since the class is an ActionListener) to Actions.context. All he needs to do that is pass in the object he wants to work with into the constructor of the ActionListener. Now, when the module is built, the annotation processor is going to take the annotations and convert them to XML registration entries, but the constructor will also be checked to see whether it is empty or not. In this case, the constructor isn't empty, hence the Action should be context-sensitive and so the ActionListener is bound to Actions.context. The Actions.context will do all the enablement work for Mark, so that he will not need to provide any code for enabling/disabling the Action. The Action will be enabled whenever a DataObject is selected. Since his Action is bound to Nodes in the Projects window that represent PDF files, the Action will always be enabled whenever Mark right-clicks on a PDF Node, since the Node exposes its own DataObject. Once Mark has access to the DataObject, he can get the underlying FileObject via getPrimaryFile and he can then convert the FileObject to a java.io.File via FileUtil.getConfigFile. Once he's got the java.io.File, he can do with it whatever he needs. Further reading: http://bits.netbeans.org/dev/javadoc/

    Read the article

  • return a js file from asp.net mvc controller

    - by Erwin
    Hi all fellow programmer I'd like to have a separate js file for each MVC set I have in my application /Controllers/ -TestController.cs /Models/ /Views/ /Test/ -Index.aspx -script.js And I'd like to include the js in the Index.aspx by <script type="text/javascript" src="<%=UriHelper.GetBaseUrl()%>/Test/Js"></script> Or to put it easier, when I call http://localhost/Test/Js in the browser, it will show me the script.js file How to write the Action in the Controller? I know that this must be done with return File method, but I haven't successfully create the method :(

    Read the article

  • WEBrick::HTTPStatus::LengthRequired error when accessing create method in controller

    - by Chris Bisignani
    I have a very simple controller set up: class LibrariesController < ApplicationController ... def create @user.libraries << Library.new(params) @user.save render :json => "success!" end ... end Basically, whenever I try to access the create method of LibrariesController using HTTParty.post I get a WEBrick::HTTPStatus::LengthRequired error on the server. The method is not even being accessed! Here is the stack trace (this is the full output server side - notice that the controller isn't even being accessed): [2010-04-16 00:35:39] ERROR WEBrick::HTTPStatus::LengthRequired [2010-04-16 00:35:39] ERROR HTTPRequest#fixup: WEBrick::HTTPStatus::LengthRequired occured. [2010-04-16 00:35:39] ERROR NoMethodError: private method `gsub!' called for #<Class:0x2362160> /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/htmlutils.rb:17:in `escape' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/httpresponse.rb:232:in `set_error' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/httpserver.rb:70:in `run' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:162:in `start' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:95:in `start' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:92:in `each' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:92:in `start' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:23:in `start' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:82:in `start' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/webrick.rb:14:in `run' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:111 /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' script/server:3 I'm running rails 2.3.5 and ruby 1.8.7. Any help would be greatly appreciated. Let me know if you need more details.

    Read the article

  • Unit testing a controller method?

    - by Stefan Kendall
    I have a controller method like such: def search = { def query = params.query ... render results as JSON } How do I unit test this? Specifically, how do I call search to set params.query, and how do I test the results of the method render? Is there a way to mock the render method, perhaps?

    Read the article

  • Redirecting to another controller in Rails

    - by Vitaly
    Hi, I'm trying to redirect from one controller to another in Rails and I am getting this error: undefined method `call' for nil:NilClass The code is pretty simple (in def create method): @blog_post_comment = BlogPostComment.new(params[:blog_post_comment]) respond_to do |format| if @blog_post_comment.save flash[:notice] = 'Comment was successfully created.' redirect_to(@blog_post_comment.blog_post) else render :action => "new" end end Save goes ok, the value gets into the database. How can I work around the redirect fail?

    Read the article

  • Passing direct parameters to a Controller#method when testing via RSpec

    - by gmile
    Normally to pass parameters via in RSpec we do: params[:my_key] = my_value get :my_method Where my_method deals with what it received from params. But in my controller I have a method, which takes args directly i.e.: def my_method(*args) ... end How do I call the method with those args from within the test? I've tried get :my_method(args) but Ruby interpreter complains about syntax error.

    Read the article

  • Status messages on the Spring MVC-based site (annotation controller)

    - by linpulee
    What is the best way to organize status messages on the Spring MVC-based site? I mean messages which, for example, returns when user has sent What is the best way to organize status messages ("Your data has been successfully saved/added/deleted") on the Spring MVC-based site using annotation controller? So, the issue is in the way of sending the message from POST-method in contoller.

    Read the article

  • asp.net mvc changing one menu based on which controller is selected from another menu

    - by jj
    Hi, I am envisioning a site layout like this- top navigation menu linking to maybe 4 or 5 indexes of different controllers. each of these sections will be working with different model objects. Left navigation menu is specific to a controller. so, for each of the top menu buttons (corresponding to different controllers) I would like the left navigation menu to offer options only specific to the currently used controler. What's the best way to go about setting this up? Thanks!!

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >