How does the init() method in servlets have access to the servletContext . in its signature i can only see public void init(ServletConfig config) and init () . then how does it access servlet context .
Why we need to use ServletContext attribute when we already have ServletContext parameters.Whats the difference between ServletContext Attributes and ServletContext parameters.
i am newbie to servlet and m working on a project like online shopping. I have list of data items in my database and i am able to fetch and display the data from database but i want to know that how can i store these data items in ServletContext so that i can use use it frequently in other pages.
I have a requirement where a form is present with first name, last name, file upload etc. File upload is done through ajax call and then the form is submitted to a servlet. I want to know whether the file has been uploaded or not in the servlet which is called after i click on the form submit button. So is there any way i can read the response of the ajax call in the servlet ?
We generally use [URL] ..... for running web applications.
What I want is to access my web app using something like this: [URL] ....
How to achieve this? Actually what i want to ask is that how URL like WWW.example.com is mapped to web applications? Assuming that i am using tomcat server.
I wish you could share some methods for securing access to webpages of websites you had had a hand on? I know of:
- asking for user credentials from an entry page and processing them inside a javabean to confirm they are equal to those kept in the system before granting further access. - masking servlets paths in web.xml - hiding client scripts in libraries that are kept on server
I am making an application in which I have to make the model (the services) available to the entire application so that all beans can access it and call its methods during the life of the application.
I am using the following technologies: view: JSF 2.x beans: Spring 4.x beans
The design problem I am having is the following:I came up with the idea of registering the model services as ServletContext attributes using my ServletContextListener, effectively making the services available to the entire application:
//imports public class MyContextListener implements ServletContextListener { //model services private UserService userService; private RepairService repairService; public void initCafe() { userService.removeAllUsers(); repairService.removeAllRepairs();
[code]....
Shouldn't I just use @Autowired userService and @Autowired repairservice everywhere I want to use these services application-wide?Or is this a problem because beans have a default scope of Request? I am confused.
Can I access the session object even session has been expired? I need to check whether session is expired or not for each request.The session invalidation is set null the session object. What I concluded, session time out I can access session object but session invalidation I can not access session object. How can I find the session time out by using session object?
I am deploy my project in a machine and access it through VPN. In one page i am sending parameters array through hidden input field. When i access it in process page through request.getParameterValues it return null values, you can see it in attachment.This page work fine without VPN.
How to access session from different context? I have created a session in one jsp, in one context and trying to access it from different context. But, I was unable to access the same. How to achieve it?
I'm using MS Access database. What I want to do, is to get all names of my tables in database.My SQL query :
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
is it correct? I found it in one example and didn't change anything.
I could of course execute this and check, but the problem is, that it returns ResultSet(I'm using Java), and I do not know how to manipulate this object in this situation.Cause usually ResultSet contains columns and rows, I think now I should get only bunch of String values.
I am trying to make a program where a ball moves up continuously when you press space, then begins to move down when you reach a certain point. My method for this is to have a timer, and have a method that does this: When you press space, add 10 y coords every second (using a timer), and if you reach 470 y, then begin to drop 10 y coords. I made a method to hold the keylistener, and am running that method inside the actionPerformed method which is within another class. However, since it is a method, I cannot add my keylistener to my frame in the main method.
main error line 9 Java Code: import javax.swing.*; public class Main {
I am trying to prepare for the next installment Java course. I found a syllabus online from last year. All I'm trying to say is that I am not in this course but will be shortly. I tried the first project but I am having subclass issues. I want to access the getStock method in the Executive subclass from the client. I keep getting a cannot find symbol: method getStock from class Employee. I don't know why won't access Executive.
Main:
import java.util.*; public class EmployeeClient extends Employee { public static void main(String[] args) { Scanner input = new Scanner(System.in); //variables String name = " "; int totalSalary = 0; int stock = 0;
I will like to add to the questions about constructors and its this. I have a class A with a constructor, i have a class B which initialize the constructor. also i have a class C which needs a variable in class A but doesn't need to initialize the constructor of A. the question how do i access the variable of class A without initializing the constructor.
Does a variable have public access modifier? if we can use it within the class and outside of the class then can i access a public variable as follows??
class mo { void display() { public int a=9; System.out.println(a); } public static void main(String[] args) { mo m=new mo(); m.display(); } }
ERROR: It shows 6 errors :-O. Error 1. illegal start of the expression 2. class,interface, or enum expected
I have designed a code that is aimed at simulating a banking environment using access database. However, there are errors and i am not able to create a new account.
import java.awt.*; import java.awt.event.*; import java.awt.FlowLayout; import java.sql.*; import javax.swing.*; public class Bank extends JFrame implements ActionListener
I want to make a database and use it in my java program. I am thinking of using MS Access database, although I m not very sure, sine I will have to use this data later in the SQL database as part of C# program.
How to start to create and use MS database in java program.
I have seen in one tutorial that the steps are:
1. Install your database management system (DBMS) if needed
2.Install a JDBC driver from the vendor of your database
but I am not familiar with this. Any example, or is this above compulsory?
1. user clicks the link in our app (www.app1.com) , cookie set up done (respose.addCookie) 2. request will redirect to (third party software, cant change anything) 3..Here if the SSO enabled, it will redirect to the another URL (www.issues.app1.com) . 4,Have to get the cookie(User details) set in #1 here and validate.
Its working fine .But if we change the www.app1.com to www.abc.com , SSO is not working. We cant change www.issues.app1.com.
How to share the cookie in cross domain across 3 apps ? because middle app , we dont have control over it.
class Course { String courseName; } class Entry { public static void main(String[] args) { Course c = new Course(); c.courseName="java"; System.out.println(c.courseName); } }
I have defined these two classes under same java project in Eclipse IDE with no package. Above two class are having default classes. class Course is also having a instance variable courseName with default access. So when we try to compile the Entry class it will give the errors while accessing the instance variable courseName on Line 6 and 7. As both the classes are having default access modifier. class Course is not visible to class Entry, then why we do not get any compilation error while creating the object of class Course on line 5?