Search Results

Search found 22 results on 1 pages for 'webproject'.

Page 1/1 | 1 

  • technology for new webproject?

    - by elCapitano
    Hi there, i am planing to set up a new webproject which has to use a database and a model which can be presented in a browser. I looked at a lot of technologies (JSF, PHP, ..) but i could not find a free and easy framework/technology for me (in the end i prefered asp.net, but this is not free). What can you recommend me for a new webproject from scratch?

    Read the article

  • Visual Studio 2008 adding incorrect working folders to TFS Workspace

    - by Bryan Rowe
    I am using Visual Studio 2008 with TFS. I have one workspace set up with one working folder. I map the root source control folder $/ to C:\TFS and get all code. When working on any project under the root, Visual Studio will randomly add incorrectly mapped working folders to my workspace. For example, it might map $/WebProject/ to C:\TFS\WebProject\DataAccess -- where the real files exist at C:\TFS\WebProject. Once it incorrectly adds these working folders, I can no longer open the solution. I am forced to remove the working folders that Visual Studio added and get latest from TFS. Has anyone experienced this? Is there something I can do to avoid running into this?

    Read the article

  • What is the efficient way to make a permission system?

    - by WEBProject
    Currently im just using something like: in the DB Table: access: home,register,login and then in each page: if(!Functions::has_rights('content')) { Functions::noAccess(); } is there more efficient way to do it, php & MySQL? i may want to gain access even to several parts a page, for example: user can read a page, but doesnt comment to it, and I dont want to build a separate system to each module. Thanks in advanced, Tal.

    Read the article

  • JQuery - Find the first identical class after a specific class.

    - by WEBProject
    Hi guys, lets say I have this divs: <div class="item current"><strong>Example 1</strong></div> <div class="item"><strong>Example 2</strong></div> Im have this code: var News = { init : function(){ $('#news-content') .find('.item:first-child') .addClass('current') .show('slide',{direction:"up"},500); $('#news-content') .find('.item:first-child') .addClass('current') .delay(1000) .hide('slide',{direction:"down"},500); this.show() }, show : function() { // ... } } $(document).ready(News.init) After the init - I want to catch the next "item" after "current" class and make the same operation as "init" on it. how can I do it with jquery?

    Read the article

  • .net Class "is not a member of" Class .. even though it is?

    - by Matt Thrower
    Hi, Looking over some older code, I've run into a strange namespace error. Let's say I have two projects, HelperProject and WebProject. The full namespace of each - as given in application properties - is myEmployer.HelperProject and myEmployer.Web.WebProject. The pages in the web project are full of statements that use classes from the helper project. There are no imports/using statements but there is a reference to the helper project added in the bin. A few example lines might be: myEmployer.HelperProject.StringHelper.GetFixedLengthText(Text, "", Me.Width, 11) myEmploter.HelperProject.Utils.StringHelper.EstimatePixelLength(Text, 11) However every line that is written in this manner is throwing the error 'HelperProject' is not a member of 'myEmployer'. If you declare the statements like this: HelperProject.StringHelper.GetFixedLengthText(Text, "", Me.Width, 11) HelperProject.Utils.StringHelper.EstimatePixelLength(Text, 11) Everything seems fine. In the solution object browser and the bin folder, HelperProject appears with its full namespace, myEmployer.HelperProject. I don't want to have to change all the statements, and besides I suspect this is masking a more fundamental problem here. But I have no idea what's going on. Can anyone offer any pointers please? Cheers, Matt

    Read the article

  • Deploying Asp.net MVC web application [migrated]

    - by Pankaj Upadhyay
    I have been trying to find a neat tutorial, guide or step by step instructions for deploying an Asp.net MVC3 webapp but have found nothing so far. Everyone talks about his version of the stroy and different type of MVC versions. Right now, I have build a simple Asp.net MVC web application which i need to deploy on my shared hosting account. In a very simple manner, I need to know which files should i copy. Do i upload everything in my webproject directory to the server including the controller directory, views, models, content and bin directory ?. What about the Global.asax, web.config, packages.config, myapp.publish.xml. In short, I have no idea which files should be uploaded and which should be not. I am sure of one thing that i need few(MVC and Razor dlls) following dlls in bin directory. Just treat me as someone who has never deployed any website NOTE:- I don't have VS SP1 installed and it doesn't install either. Basically i need a manual procedure.

    Read the article

  • Dynamic Data with Subsonic 3

    - by Ezequiel Bertti
    i want to make a webproject with Subsonic and Dynamic Data... But when i go register the ContextData a don't have it in subsonic with LINQ... in Global.asax.cs a have to do something like this model.RegisterContext(SubSonicRepo, new ContextConfiguration() { ScaffoldAllTables = true }); how can i make it work? have some way to make it work? using entities or LINQ everything work... but using Subsonic with linq it not work...

    Read the article

  • Class files are not added in war file.

    - by Lakshman
    When i export WebProject (Struts Portlet) as war from RAD 7.5 it creates war, but that war file does not have my Class files. ie. Action Classes, Actionforms, validations, etc. none of the .java files class added in war. what is the issue. urgent

    Read the article

  • how do i consume net.tcp binding within web project?

    - by user1871124
    I'm working on a web application using mvc, we have already a service that does http binding, the client wants tcp binding for certain actions (not really sure why) but it's their requirement so i'm attempting to set up net.tcp binding, all references i am seeing to doing this involve a windows application and not a web application. I guess my question has 2 parts, first can you run httpbinding and net.tcp binding at the same time through the same service/project. secondly how would I consume the service through a webproject?

    Read the article

  • Run unit tests in Jenkins / Hudson in automated fashion from dev to build server

    - by Kevin Donde
    We are currently running a Jenkins (Hudson) CI server to build and package our .net web projects and database projects. Everything is working great but I want to start writing unit tests and then only passing the build if the unit tests pass. We are using the built in msbuild task to build the web project. With the following arguments ... MsBuild Version .NET 4.0 MsBuild Build File ./WebProjectFolder/WebProject.csproj Command Line Arguments ./target:Rebuild /p:Configuration=Release;DeployOnBuild=True;PackageLocation=".\obj\Release\WebProject.zip";PackageAsSingleFile=True We need to run automated tests over our code that run automatically when we build on our machines (post build event possibly) but also run when Jenkins does a build for that project. If you run it like this it doesn't build the unit tests project because the web project doesn't reference the test project. The test project would reference the web project but I'm pretty sure that would be butchering our automated builds as they exist primarily to build and package our deployments. Running these tests should be a step in that automated build and package process. Options ... Create two Jenkins jobs. one to run the tests ... if the tests pass another build is triggered which builds and packages the web project. Put the post build event on the test project. Build the solution instead of the project (make sure the solution contains the required tests) and put post build events on any test projects that would run the nunit console to run the tests. Then use the command line to copy all the required files from each of the bin and content directories into a package. Just build the test project in jenkins instead of the web project in jenkins. The test project would reference the web project (depending on what you're testing) and build it. Problems ... There's two jobs and not one. Two things to debug not one. One to see if the tests passed and one to build and compile the web project. The tests could pass but the build could fail if its something that isn't used by what you're testing ... This requires us to know exactly what goes into the build. Right now msbuild does it all for us. If you have multiple teams working on a project everytime an extra folder is created you have to worry about the possibly brittle command line statements. This seems like a corruption of our main purpose here. The tests should be a step in this process not the overriding most important thing in this process. I'm also not 100% sure that a triggered build is the same as a normal build does it do all the same things as a normal build. Move all the correct files in the same way move them all into the same directories etc. Initial problem. We want to run our tests whenever our main project is built. But adding a post build event to the web project that runs against the test project doesn't work because the web project doesn't reference the test project and won't trigger a build of this project. I could go on ... but that's enough ... We've spent about a week trying to make this work nicely but haven't succeeded. Feel free to edit this if you feel you can get a better response ...

    Read the article

  • portlet-mvc 3.0 + maven for websphere portlet: examples?

    - by Mike
    I'm trying to develop a websphere portal portlet using java, maven and spring-portlet-mvc 3.0.2.RELEASE but so far I'm not having a lot of luck. The problem that I'm having is that a lot of the tutorials are either outdated, incorrect, contradict eachother or a combination of all the above. Also I have to use RAD but the tutorials also contradict eachother, logically I'd think you'd choose new portlet project, but http://www.ibm.com/developerworks/websphere/library/techarticles/0802_patil-pt1/0802_patil-pt1.html says to use a dynamic webproject. So I was wondering if anyone had a nice example/good tutorial.

    Read the article

  • FxCop CA2000 Warning in UserControls

    - by esjr
    Running FxCop on a WebProject that contains a UserControl will result in a CA2000 Warning (Call System.IDisposable.Dispose on object) for every ServerControl (Label, TextBox,...) in that UserControl. I understand why this would happen. Replacing the 'offending' ServerControls with a PlaceHolder and then adding the Controls in code (Using...End Using) might be a way around that, but it is not always an option.But, if they are not 'kosher' why have ServerControls you can drop in your ascx/aspx in the first place ?Am I missing something ? If, like in my case, you inherit a sizeable collection of fairly complex UserControls, do I now add every 'offending' Control to the GlobalSupperssions file (that's a lot of mind numbing right-clicking) ?I do not want to suppress all CA2000 warnings since it makes perfect sense to fix them, but not in the case of ServerControls in UserControls.

    Read the article

  • The system cannot find the file specified.

    - by Sathish
    Till yesterday my webservice was running fine in my local system today when i run the Webservcie or any webproject from VS2005 i get the below error Server Error in '/MyWebService' Application. The system cannot find the file specified. (Exception from HRESULT: 0x80070002) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002) Please help me

    Read the article

  • Problem with compiler in Web.Config for generating xml doc

    - by asksuperuser
    I have several problems when putting code below in Web.Config to be able to generate xml doc with website (not webproject): <compiler language="c#;cs;csharp" extension=".cs" warningLevel="0" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" compilerOptions="/doc:c:\doc\WebDocs.xml"> How do I put a directory with spaces instead of /doc:c:\doc\WebDocs.xml? How do I put a directory that is a subdirectory of current project? Why my xml file output is nearly empty? Is it because some properties, methods, ... have no xml comment?

    Read the article

  • Java EE Module Dependencies in web project?

    - by Sled
    Hey guys, I have this webprojec to which I have to add a jar from another EJB project. Normally I'd right-click the webproject and go to properties - Java EE Module Dependencies. I don't know if it is because I upgraded eclipse, or i'm doing something wrong, but I just can't find the "Java EE Module Dependencies" in the properties window. Both projects are linked with the same EAR so the EJB jar file shuld be there! Any ideas what I'm doing wrong or some other way I could attach the EJB's JAR file? I'm only allowed to work with eclipse, so netbeans is not an option. Thanks! EDIT: basically, this is what I want to do, but that specific panel won't show up...

    Read the article

  • Using Ghostscript in a Webapplication (PDF Thumbnails)

    - by cpt.oneeye
    Hello, i am using the ghostscriptsharp wrapper for c# and ghostscript. I want to generate thumbnails out of pdf-files. Further Information on the sample-code are given here. There are different Methods imported form the ghostscript-c-dll "gsdll32.dll". [DllImport("gsdll32.dll", EntryPoint = "gsapi_new_instance")] private static extern int CreateAPIInstance(out IntPtr pinstance, IntPtr caller_handle); [DllImport("gsdll32.dll", EntryPoint = "gsapi_init_with_args")] private static extern int InitAPI(IntPtr instance, int argc, IntPtr argv); //...and so on I am using the GhostscriptWrapper for generating the thumbnails in a webapplication (.net 2.0). This class uses the methods imported above. protected void Page_Load(object sender, EventArgs e){ GhostscriptWrapper.GeneratePageThumb("c:\\sample.pdf", "c:\\sample.jpg", 1, 100, 100); } When i debug the Web-Application in Visual Studio 2008 by hitting key "F5" it works fine (a new instance of webserver is generated). When i create a WindowsForm Application it works too. The thumbnails get generated. When i access the application with the webbrowser directly (http://localhoast/mywebappliation/..) it doesn't work. No thumbnails are generated. But there is also no exception thrown. I placed the gsdll32.dll in the system32-folder of windows xp. The Ghostscript Runtime is installed too. I have given full access in the IIS-Webproject (.Net 2.0). Does anybody know why i can't access Ghostscript from my webapplication? Are there any security-issues for accessing dll-files on the IIS-Server? Greetings Klaus

    Read the article

  • can i use javabeans with hibernate ?

    - by Dilllllo
    Hello i'm using a plugin of hibernate2 in my webproject with jsp ,in my project i have a register page. Can i use javabeans to send information from a html <form> using hibernate class's ? with out hibernate i creat class with get and set like that package com.java2s; public class Lang { private String choix; private String comm; public String getChoix() { return choix; } public void setChoix(String choix) { this.choix = choix; //System.out.println(choix); } public String getComm() { return comm; } public void setComm(String comm) { this.comm = comm; // System.out.println(comm); } } but i know that hibernate generate a get and set class ! and recive it with that : <jsp:useBean id='user' class='com.java2s.Lang' type='com.java2s.Lang' scope='session' /> <jsp:setProperty name='user' property='*'/> any idea how to do that ?

    Read the article

  • Recommendations, Asp.Net ObjectDataSource bind result of webservice call

    - by DerDres
    I need recommendations on how to solve / structure a solution to the following problem. In an asp.net web application i'll have to visualise results returned from a web service call. Im planning to use a repeater server control and bind this with an objectdatasource. The service returns a result of the form: public class SearchResult : IExtensibleDataObject { [DataMember] public Guid SearchId { get; set; } [DataMember] public DateTime Timestamp { get; set; } [DataMember] public int Offset { get; set; } [DataMember] public int TotalResults { get; set; } [DataMember] public IList<ResultDocumentData> Documents { get; set; } It is the collection of Documents that I need to visualise with a repeater which will be associated with an ObjectDataSource. The datasource should work on the type ResultDocumentData; the collection property in the class SearchResult. I think I need to wrap the call to the webservice in a dataaccess layer class, that will have a getDocuments method returning an IList, that the ObjectDataSource can use as its SelectMethod. I think I could make this work, but I would like to know how to do it in an elegant way. Can you give me general recommendations and/or recommendations for the following: WebProject Folderstructure + naming Naming conventions for the name of the service wrapper class Creating the service reference

    Read the article

  • What is better: Developing a Web project in MVC or N -Tier Architecture?

    - by Starx
    I have asked a similar question before and got an convincing answer as well? http://stackoverflow.com/questions/2843311/what-is-difference-of-developing-a-website-in-mvc-and-3-tier-or-n-tier-architectu Due to the conclusion of this question I started developing projects in N-tier Architecture. Just about an hour ago, I asked another question, about what is the best design pattern to create interface? There the most voted answer is suggesting me to use MVC architecture. http://stackoverflow.com/questions/2930300/what-is-the-best-desing-pattern-to-design-the-interface-of-an-webpage Now I am confused, First post suggested me that both are similar, just a difference that in N-tier, the tier are physically and logically separated and one layer has access to the one above and below it but not all the layers. I think ASP.net used 3 Tier architecture while developing applications or Web applications. Where as frameworks like Zend, Symphony they use MVC. I just want to stick to a pattern that is best suitable for WebProject Development? May be this is a very silly confusion? But if someone could clear this confusion, that would be very greatful?

    Read the article

  • Accessing my own datalayer using RIA & Silverlight

    - by Norsten
    Is it possible for me to connect to my own data provide via WCF RIA services? I've created a small datalayer that connnects to DynamicAX datasource. I would like to use Silverlight 4 & RIA service to access that datalayer. At it's most basic -I've done the following... 1) I've added an empty domainclass to the webproject and in that class I created a simple method to return a string... [EnableClientAccess()] public class ProjectService : DomainService { public string TestViaRIA() { return "Hello!"; } } 2) I then added reference to the web project in my silvelight class and created a bit of code to try and invoke the method... using ProjectApp.Web; namespace ProjectApp.Views { public partial class ProjectControl : UserControl { public ProjectControl() { InitializeComponent(); ProjectContext ctx = new ProjectContext(); var x = ctx.TestViaRIA(); testTextBox.Text = x.ToString(); } } } the returned value is "{System.ServiceModel.DomainServices.Client.InvokeOperation}". I'm obviously doing something wrong here and I would appreciate some guidance on how I can achive this. Thanks in advance

    Read the article

  • Passing parameters between Silverlight and ASP.NET – Part 1

    - by mohanbrij
    While working with Silverlight applications, we may face some scenarios where we may need to embed Silverlight as a component, like for e.g in Sharepoint Webpars or simple we can have the same with ASP.NET. The biggest challenge comes when we have to pass the parameters from ASP.NET to Silverlight components or back from Silverlight to ASP.NET. We have lots of ways we can do this, like using InitParams, QueryStrings, using HTML objects in Silverlight, etc. All these different techniques have some advantages or disadvantages or limitations. Lets see one by one why we should choose one and what are the ways to achieve the same. 1. InitParams: Lets start with InitParams, Start your Visual Studio 2010 IDE, and Create a Silverlight Application, give any name. Now go to the ASP.NET WebProject which is used to Host the Silverlight XAP component. You will find lots of different tags are used by Silverlight object as <params> tags. To use InitParams, Silverlight provides us with a tag called InitParams which we can use to pass parameters to Silverlight object from ASP.NET. 1: <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%"> 2: <param name="source" value="ClientBin/SilverlightApp.xap"/> 3: <param name="onError" value="onSilverlightError" /> 4: <param name="background" value="white" /> 5: <param name="minRuntimeVersion" value="4.0.50826.0" /> 6: <param name="initparams" id="initParams" runat="server" value=""/> 7: <param name="autoUpgrade" value="true" /> 8: <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none"> 9: <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/> 10: </a> 11: </object> Here in the code above I have included a initParam as a param tag (line 6), now in the page load I will add a line 1: initParams.Attributes.Add("value", "key1=Brij, key2=Mohan"); This basically add a value parameter inside the initParam. So thats all we need in our ASP.NET side, now coming to the Silverlight Code open the code behind of App.xaml and add the following lines of code. 1: private string firstKey, secondKey; 2: private void Application_Startup(object sender, StartupEventArgs e) 3: { 4: if (e.InitParams.ContainsKey("key1")) 5: this.firstKey = e.InitParams["key1"]; 6: if (e.InitParams.ContainsKey("key2")) 7: this.secondKey = e.InitParams["key2"]; 8: this.RootVisual = new MainPage(firstKey, secondKey); 9: } This code fetch the init params and pass it to our MainPage.xaml constructor, in the MainPage.xaml we can use these variables according to our requirement, here in this example I am simply displaying the variables in a Message Box. 1: public MainPage(string param1, string param2) 2: { 3: InitializeComponent(); 4: MessageBox.Show("Welcome, " + param1 + " " + param2); 5: } This will give you a sample output as Limitations: Depending on the browsers you have some limitation on the overall string length of the parameters you can pass. To get more details on this limitation, you can refer to this link :http://www.boutell.com/newfaq/misc/urllength.html 2. QueryStrings To show this example I am taking the scenario where we have a default.aspx page and we are going to the SIlverlightTestPage.aspx, and we have to work with the parameters which was passed by default.aspx in the SilverlightTestPage.aspx Silverlight Component. So first I will add a new page in my application which contains a button with ID =btnNext, and on click of the button I will redirect my page to my SilverlightTestAppPage.aspx with the required query strings. Code of Default.aspx 1: protected void btnNext_Click(object sender, EventArgs e) 2: { 3: Response.Redirect("~/SilverlightAppTestPage.aspx?FName=Brij" + "&LName=Mohan"); 4: } Code of MainPage.xaml.cs 1: public partial class MainPage : UserControl 2: { 3: public MainPage() 4: { 5: InitializeComponent(); 6: this.Loaded += new RoutedEventHandler(MainPage_Loaded); 7: } 8: 9: void MainPage_Loaded(object sender, RoutedEventArgs e) 10: { 11: IDictionary<string, string> qString = HtmlPage.Document.QueryString; 12: string firstName = string.Empty; 13: string lastName = string.Empty; 14: foreach (KeyValuePair<string, string> keyValuePair in qString) 15: { 16: string key = keyValuePair.Key; 17: string value = keyValuePair.Value; 18: if (key == "FName") 19: firstName = value; 20: else if (key == "LName") 21: lastName = value; 22: } 23: MessageBox.Show("Welcome, " + firstName + " " + lastName); 24: } 25: } Set the Startup page as Default.aspx, now run the application. This will give you the following output: Since here also you are using the Query Strings to pass your parameters, so you are depending on the browser capabilities of the length of the query strings it can pass. Here also you can refer the limitation which I have mentioned in my previous example for the length of parameters you can use.   3. Using HtmlPage.Document Silverlight to ASP.NET <—> ASP.NET to Silverlight: To show this I setup a sample Silverlight Application with Buttons Get Data and Set Data with the Data Text Box. In ASP.NET page I kep a TextBox to Show how the values passed to and From Silverlight to ASP.NET reflects back. My page with Silverlight control looks like this. When I Say Get Data it pulls the data from ASP.NET to Silverlight Control Text Box, and When I say Set data it basically Set the Value from Silverlight Control TextBox to ASP.NET TextBox. Now let see the code how it is doing. This is my ASP.NET Source Code. Here I have just created a TextBox named : txtData 1: <body> 2: <form id="form1" runat="server" style="height:100%"> 3: <div id="silverlightControlHost"> 4: ASP.NET TextBox: <input type="text" runat="server" id="txtData" value="Some Data" /> 5: <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%"> 6: <param name="source" value="ClientBin/SilverlightApplication1.xap"/> 7: <param name="onError" value="onSilverlightError" /> 8: <param name="background" value="white" /> 9: <param name="minRuntimeVersion" value="4.0.50826.0" /> 10: <param name="autoUpgrade" value="true" /> 11: <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none"> 12: <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/> 13: </a> 14: </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe> 15: </div> 16: </form> 17: </body> My actual logic for getting and setting the data lies in my Silverlight Control, this is my XAML code with TextBox and Buttons. 1: <Grid x:Name="LayoutRoot" Background="White" Height="100" Width="450" VerticalAlignment="Top"> 2: <Grid.ColumnDefinitions> 3: <ColumnDefinition Width="110" /> 4: <ColumnDefinition Width="110" /> 5: <ColumnDefinition Width="110" /> 6: <ColumnDefinition Width="110" /> 7: </Grid.ColumnDefinitions> 8: <TextBlock Text="Silverlight Text Box: " Grid.Column="0" VerticalAlignment="Center"></TextBlock> 9: <TextBox x:Name="DataText" Width="100" Grid.Column="1" Height="20"></TextBox> 10: <Button x:Name="GetData" Width="100" Click="GetData_Click" Grid.Column="2" Height="30" Content="Get Data"></Button> 11: <Button x:Name="SetData" Width="100" Click="SetData_Click" Grid.Column="3" Height="30" Content="Set Data"></Button> 12: </Grid> Now we have to write few lines of Button Events for Get Data and Set Data which basically make use of Windows.System.Browser namespace. 1: private void GetData_Click(object sender, RoutedEventArgs e) 2: { 3: DataText.Text = HtmlPage.Document.GetElementById("txtData").GetProperty("value").ToString(); 4: } 5:  6: private void SetData_Click(object sender, RoutedEventArgs e) 7: { 8: HtmlPage.Document.GetElementById("txtData").SetProperty("value", DataText.Text); 9: } That’s it so when we run this application my Form will look like this. 4. Using Object Serialization. This is a useful when we want to pass Objects of Data from our ASP.NET application to Silverlight Controls and back. This technique basically uses the above technique I mentioned in Pint 3 above. Since this itself is a length topic so details of this I am going to cover in Part 2 of this Post with Sample Code Example very soon.

    Read the article

  • Problems using Hibernate and Spring in web application

    - by user628480
    Hi.I'm having NullPointerException trying to getCurrentSession() java.lang.NullPointerException servlets.ControlServlet.doPost(ControlServlet.java:46) javax.servlet.http.HttpServlet.service(HttpServlet.java:709) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) I use Tomcat 5.5 index.jsp page: <%@ page language="java" contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title></title> </head> <body> <%@ page import="java.util.List" %> <%@ page import="data.Singer" %> <jsp:useBean id="singer" class="data.Singer" scope="session"/> <jsp:setProperty name="singer" property="*" /> <form action="ControlServlet" method="POST"> <form method=“POST”> Name:<br /> <input type=“text” name="name" /><br /> Type:<br /> <input type=“text” name="type" /><br /> <input type="submit" name="Add song" value="Add song"> <input type="submit" name="save" value="Save" /><br><br> <input type ="submit" name="values" value="Get values" > </form> </body> </html> web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>webproject</display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/beans.xml, /WEB-INF/conf.xml, /WEB-INF/singers.hbm.xml, /WEB-INF/songs.hbm.xml, /WEB-INF/singerbeans.xml, /WEB-INF/songbeans.xml</param-value> </context-param> <servlet> <servlet-name>context</servlet-name> <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>test</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>test</servlet-name> <url-pattern>*.*</url-pattern> </servlet-mapping> <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/beans.xml, /WEB-INF/conf.xml, /WEB-INF/singers.hbm.xml, /WEB-INF/songs.hbm.xml, /WEB-INF/singerbeans.xml, /WEB-INF/songbeans.xml</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>2</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>2</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <servlet> <description> </description> <display-name>ControlServlet</display-name> <servlet-name>ControlServlet</servlet-name> <servlet-class>servlets.ControlServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>ControlServlet</servlet-name> <url-pattern>/ControlServlet</url-pattern> </servlet-mapping> </web-app> ControlServlet.java public class ControlServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Autowired private SingerDao singerdao; public SingerDao getSingerDao() { return singerdao; } public void setSingerDao(SingerDao singerdao) { this.singerdao = singerdao; } public ControlServlet() { super(); // TODO Auto-generated constructor stub } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (request.getParameter("values") != null) { response.getWriter().println(singerdao.getDBValues()); } } } and SingerDao.java public class SingerDao implements SingerDaoInterface { @Autowired private SessionFactory sessionFactory; public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } public List getDBValues() { Session session = getCurrentSession(); List<Singer> singers = session.createCriteria(Singer.class).list(); return singers; } private org.hibernate.classic.Session getCurrentSession() { return sessionFactory.getCurrentSession(); } public void updateSinger(Singer singer) { Session session = getCurrentSession(); session.update(singer); } public Singer getSinger(int id) { Singer singer = null; Session session = getCurrentSession(); singer = (Singer) session.load(Singer.class, id); return singer; } public void deleteSinger(Singer singer) { Session session = getCurrentSession(); session.delete(singer); } public void insertRow(Singer singer) { Session session = getCurrentSession(); session.save(singer); } } In simple Java Project it works fine.I think sessionFactory doesn't autowires,but why? Thanks all.

    Read the article

1