JSP :: How To Access Data In Different Domain

Aug 26, 2014

We have implemented SSO based on cookies.

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.

View Replies


ADVERTISEMENT

Extract Domain From Email Address And Store Domain In HashSet

Sep 13, 2014

I have two Strings

String TO = "raj@gmail.com;ra@gmail.com;RS@yahoo.com";
String CC= "rajt@in.com;rht@basss.com";

My query is i want to extract domains from above two Strings and Store these domains in HashSet. How could i do this with minimum code and performance wise.

View Replies View Related

Design - How Map Request Parameters Data To Domain Model

May 24, 2014

This is a design question is the same problem in any language.as you do to map the controller to the domain model?We have situations in general larger than ... consider the example objects .

situation.1 - We have a request that has all the parameters of the account ;{ " id" : " 1 " , "name " : "test " , "some " : " xxx " } ............. and other fields .

situation.2 - can request that has to have a certain account parameters , for example in the case of an update;{" id" , " 1" , "name " , " testUpdated "}

situation.3 - We have a request that has some parameters of the account , others have more like id as user together;{ " id" : " 1 " , "user " : " xxx " , "service " : " yyy " } in which case each piece of the request will turn an object .

Java Code:

public class Account {

private Long id;
private String name ;
private String some ;

} mh_sh_highlight_all('java');

I see a few options ;

1 - Can I get AccountForm in the controller and set the properties for the Account object and others in CONTROLLER ;

+ ok for situation.1 situations 2, and situation.3

+ Separates the requisition of the object domain

- Pollutes the controller with code conversion

- Controller is full of setters .. if a higher class as a large object as a request is very confusing .

Java Code:

controller ( AccountForm from ) {
Account account = new Account ( )
account.setNome form.getNome = ();
account.setSome form.getSome = ();
Other outher = new Other ( ) ;
other.setSome ( form.getSome ( ) ) ;
} mh_sh_highlight_all('java');

2 - Can I get AccountRequest in the controller and have a method in itself as AccountRequest.getAccount ( ) to return a mapped model , in this case the mapping is at own Request object .

+ Separates the requisition of the object domain

+ Encapsulates the conversion in a place with easy access .

+ Meets situation.1 situation.2 and situation3 ;

- Request object has two responsibilities represent the request and map to a valid model .

Java Code:

controller ( AccountForm accountRequest ) {
Account account = accountRequest.getAccount ( ) ;
Outher outher accountRequest.getOther = ( )
} mh_sh_highlight_all('java');

3 - Can I get the controller Direct Account which had been filled with nulls .

+ Eliminate object request

- Serves only situation.1 situation.2 .

Java Code:

controller (Account account ) {
account.someMethod ();
} mh_sh_highlight_all('java');

4 - Outsource this mapping request parameters to another object mapper for request ..

+ Isolates logic mapping

- Until complexity for simpler cases are used as standard for all such a find by id .

- One more class for each request ;

In the case of API gets worse response has two further classes. speaking in terms of request for response .... AccountRequest, AccountRequestMapper, Account, AccountResponseMapper, AccountResponse .....I'm doing more testing the Hybrid option 3 for simple cases (find ID or updates) .... with option 2 for example for more complex cases ..

View Replies View Related

How To Access Objects Data From Another Class

Oct 3, 2014

I've been unable to figure out how to access an objects data from another class. I ended up missing a lesson in java and haven't been able to catch up on this topic on my own through my textbook.

Error: has private access

Code:

public class TestCoffeeDrinker {
public static void main(String[] args) {
Coffee latte = new Coffee("Starbucks Tall Latte", 2.85);
Coffee mocha = new Coffee("Starbucks Grande Mocha", 3.95);
Coffee mcdonalds = new Coffee("McDonalds McCafe", 0.99);
System.out.println(mcdonalds.toString());

[Code]...

View Replies View Related

How To Access Data In Array Of Objects

Apr 23, 2014

I want to keep count of how many students are in my array. the array i made up of objects from other classes. like the class Student how do i do this. i have tried contains but better way it to to a loop to go through the array and determine if each object is a particular type but i don't know how to do this. here is the code

import java.util.*;
import java.util.ArrayList;
public class Driver {
public static void main(String[] args){
/* Comments required
PersonFileReader pfr = new PersonFileReader("person.dat");
ArrayList<Person> testData = pfr.readData();
Database db = new Database(testData);

[Code] .....

View Replies View Related

Insert Data Into Access Database

Mar 29, 2014

I need my java program to insert data into my access database. I get no errors in my code, but it never inserts, deletes the data in my database. Here is my code:

import java.awt.*;
import java.awt.event.*;
import java.sql.*;
 public class INS extends Frame implements ActionListener{
Frame f;
Label l1, l2;
TextField t1, t2;
Button b1, b2, b3, b4, b5;
Connection c;

[Code] ....

View Replies View Related

Using Accessor Methods To Access Data From Another Class

May 6, 2014

I have been asked to write a program with 3 classes(an interface, a store and a product class) and I have been going ok until I need to display data on the interface that is held in the product class. At the moment the code will compile fine but when I run the program and try to use the writeOutput() method I get a stack overflow error.

I realise now that it is because of a non-terminating recursive call, however I can not think of a solution on how to fix the problem. And just to clarify, what I am aiming to do is have the MatesTerminal class display the data for name that is stored in the Product class(I have no way of determining which product to display at this time, so I would like to be able to display the data for all three products if possible). Anyway this is what I have so far:

The method from the MatesTerminal Class:

private void writeOutput() {
int productChoice;
Scanner console = new Scanner(System.in);

[Code].....

View Replies View Related

How To Insert Cachedrowset Data Into MS Access Database

Feb 11, 2015

I'm new to java and trying to insert data from a cachedrowset into MS Access database, Below is the error code that I get after running my program.

java.sql.SQLException: Parameter-Set has missing values.

The SQL test table that I am using.

Java Code:

create table book (
TITLE_ID CHAR(3 BYTE)
TITLE_NAME VARCHAR2(40 BYTE)
TYPE VARCHAR2(10 BYTE)
PUB_ID CHAR(3 BYTE)
PAGES NUMBER(38,0)
PRICE NUMBER(5,2)
SALES NUMBER(38,0)
PUBDATE DATE
CONTRACT NUMBER(38,0)
); mh_sh_highlight_all('java');

SQL table values with blanks:

Java Code: TITLE_ID TITLE_NAME TYPE PUB_ID PAGES PRICE SALES PUBDATE CONTRACT
T01Java history P0111121.99 566 01-AUG-001
T02Oracle history P0311419.95 9566 01-APR-981
T03SQL computer P0212239.95 25667 01-SEP-001
T04C++ psychologyP0451112.99 13001 31-MAY-991
T05Python psychologyP041016.95 201440 01-JAN-011

[code]....

Below is the piece of java code that I am using.

Java Code:

public void insertAccessTable(Connection connection, CachedRowSet CRS_insertAccess) throws Exception
{
try
{
RowSetMetaData metaData = (RowSetMetaData)CRS_insertAccess.getMetaData();
ArrayList<ArrayList<String>> TwoDimArrList = new ArrayList<ArrayList<String>>();
TwoDimArrList.add(new ArrayList<String>());
TwoDimArrList.add(new ArrayList<String>());
ArrayList<String> ColArrList = new ArrayList<String>();
for (int column = 1; column <= metaData.getColumnCount(); column++) {

[code]....

View Replies View Related

How To Read Data From Random Access File

Jul 10, 2014

I have a random access file stream. I have below code I want to written data that is currently pointed by pointer till the end and display that data on System.out Stream but it is not working my code is

//Create a Random Access File
java.io.RandomAccessFile random=new java.io.RandomAccessFile("D:/input.txt","rw");
//Position the pointer to a seek
try {
random.seek(300);
long pointer=random.getFilePointer();
System.out.println("Current Pointer is:"+pointer);
int a;
while((a=random.read())!=-1) {
System.out.println(a);
}

Where am I wrong? Although it is returning actual position of pointer in pointer using

View Replies View Related

Random Access File - How To Retrieve Particular Set Of Data

May 4, 2015

I am creating a read/write, RandomAccessFile that I will use to store several student ID and gpa score. What I don't understand is how I should go about retrieving a particular set of data.

public class ReadWrite {
static Scanner keyboard = new Scanner(System.in);
static String fileName = "Stu.dat";
static RandomAccessFile raf;
public static void main(String [] args) throws FileNotFoundException, IOException {

[Code] .....

View Replies View Related

JavaFX 2.0 :: Access Scene Graph Data From EDT

May 11, 2014

I have following methods, which I call from the Event Dispatcher Thread:
 
public void setTitle(String title) {       
Platform.runLater(() -> stage.setTitle(title));}   
public String getTitle() {       
return stage.getTitle(); // <- Access from outside JFX App Thread ok?} 

Is it thread-safe, when the getter-Method just return the value like the example show? Or must I create a Runnable, so stage.getTitle() is called inside the Java Application Thread? How I return the value then?

View Replies View Related

JavaFX 2.0 :: Should Domain Models Contain Properties?

May 2, 2014

I would like to know whether I should use properties and observable collections when creating a domain model for a new application using FX? I have read up quite a bit on the topic, but I can't find any clear answers. Most forums tend to suggest that the domain model should NOT contain properties, since this does not encourage a loose coupling of the model and the view. The alternative however is to write wrapper classes for each POJO in my domain model. This is however a lot of duplication, and it requires a complete listener system to ensure that the wrapper classes are in sync with the model classes.

View Replies View Related

Write Data For Three Products To Random Access File - Unexpected EOFException

Jul 11, 2014

I'm trying to write data for three products to a random access file, but I have a problem. Each product has a code and a price. After writing them to my file, I want to get to the second field or product. I do this by getting the length for each record, and multiplying it by the field number I want to go to. I use the result for the seek() method of the RandomAccessFile object. It is giving me an EOFException, but when I use 0 for the seek method i get the data for the first poduct or field.

Java Code:

public static void main(String[] args) {
final int RECORD_LENGTH = 16;
try(RandomAccessFile productsOutput = new RandomAccessFile("C:UsersalfonsoDesktopBinaryTestRandom.ran", "rw")) {
String[] codes = {"java", "jsps", "txtp"};
double[] prices = {49.5, 19.9, 29.9};
for(int i = 0; i < codes.length; i++) {

[Code] .....

View Replies View Related

EJB / EE :: How Many Application Servers Are There If Multiple Applications Hosted On Domain

Mar 6, 2015

Because there's little information that actually explains application servers in the real world, For one domain at www.url.com:

- How many application servers are there if there are multiple applications hosted on this domain? Ie. url.com/app1, url.com/app2, etc.?

- How many web servers will there be?

- How would I make one physical server handle all requests for one of the above applications?

- How would one make static content a standalone application built with angularJS? Not static content served by servlets.

View Replies View Related

Servlets :: How Does Multipart / Form-data Send Data Over Network During File Upload

Apr 9, 2015

I would like to understand how does multipart/form-data works during file upload scenario's, Does it chunks the data from client to server while transferring the files ?

View Replies View Related

How To Get Data Button To Display User Inputted (numbers) To Data Label

May 25, 2014

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class DisplayFinal_Panel extends JPanel {
private JLabel label1, label2, label3;
private JTextField box;

[code]....

I only want Listener 1 to work right now. Also, user input is in TextField.

View Replies View Related

How To Escape unwanted Special Characters In String Data While Converting Into XML Data

Mar 7, 2014

I'am trying to converting string data into xml data using xml beans and StringEscapeUtils.This is work fine but in one case it if the data contains special characters.
  
Code snippet
--------------------
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
public class ParseXMLData { 
    public static XmlObject parseXML(String stringXML) {
        XmlObject xmlObject = null;

[Code] ....
 
success case
---------------------------
i/p------<aaa><bbb>This converts string to xml</bbb></aaa>
o/p---<aaa><bbb>This converts string to xml</bbb></aaa>
 
Failer case
-----------------
i/p----<aaa><bbb>This fails if it contains < symbols</bbb></aaa>
expected o/p----<aaa><bbb>This fails if it contains < symbols</bbb></aaa>
 
Observed that it converts < to '<' but  as per xml rules, if data contains '< ' it fails. I want to convert staring and end tags to xml format and if data in b/w middle of starting and ending tags do'n need to convert it. How to do it.

View Replies View Related

Enterprise JavaBeans :: How To Refresh JPA Data When Table Data Is Updated From Backend

Nov 27, 2012

Is there a way to inform the Entity Manager or force the JPA provider to reload data from the database? The scenario could be data being updated by a store procedure or direct SQLPlus maintenance, without restarting the Application Server, the JPA need to load the newly updated data from the database.

I think the current JPA API is not enough. The void refresh(java.lang.Object entity) from EntityManager need to pass in the Entity object, I will like to know how to refresh the entire JPA Entity data after the physical table data being update from backend.

View Replies View Related

User Input All Of Data On A Single Line And Implement StringTokenizer To Assign That Data To File

Mar 21, 2015

By using FileReader, FileWriter and their constituents, I am creating a file to contain employee information ( name, age, hours, etc. ). The user is to input all of the data on a single line and we were asked to implement StringTokenizer to assign that data to the file. I have never used the StringTokenizer before, but I have a rough idea how it is to function. I used pw.println to test what I have so far, now I would like to let the user build the initial file with the "first employees" of the company, and then view the file, and then go back and append new employee data to that same file. My question is, how can I take the user input as a StringTokenizer and add that to the file?

In the for loop below, I thought I would see if it would work, but it does not. The loop only executes once and does not allow me to enter data.

public class Records {
public static void main(String [] args) throws IOException {
Scanner input = new Scanner(System.in);
FileWriter fw = new FileWriter("dbs3.java");
BufferedWriter bw = new BufferedWriter(fw);
PrintWriter pw = new PrintWriter(bw);
System.out.println("NEW EMPLOYEE DATA SHEET");
System.out.print("Number of new employees: ");
int number = input.nextInt();

[Code] ....

View Replies View Related

Servlets :: Multipart Form Data - Sending Additional Data?

Feb 21, 2014

I am using apache-commons-fileupload to get file from client to the server.(using JSP and Servlet).

JSP/HTML

<form method="POST" action="GetFile" enctype="multipart/form-data">
<input type="file" name="datafile">
<input type="text" name="text1">
<input type="submit" value="Next">
</form>

Servlet: GetFile

System.out.println(request.getParameter("text1"));

I am able to upload the file to the server, but I am not able to get the value of text1 in the servlet (I am getting null value of text1 in the servlet), I need this textfield in the form to submit some additional information while uploading it to the server.

--> Is enctype="multipart/form-data" option of form doesn't allow other form data to be submited? if it doesn't allow it then what are the other options I have to send this additional textfield to the server.

--> Or is there any other problem in my code?

View Replies View Related

Simple Data Classes - Serialize More Complex Data Structure

Oct 6, 2014

I have written several simple data classes that I serialized manually by converting to text. At this point I need to serialize a more complex data structure. which will include lists of the simpler elements. Can serialize store and reconstitute this type of structure automatically or do I need to do this one manually as well? Consider the pseudocode below for a clarification of my question;

Java Code:

Class Hops{
String Name;
float Alpha Acid;
float Beta Acid;
};

Class Malt{
String Name;
float extract;
};

Class Recipie{
String Name;
CList HopList;
CList MaltList;
};

CList RecipieList; mh_sh_highlight_all('java');

I read the article on Serialization presented at tutorial point, but the example only showed a simple class, not lists of class members. What I want to do is serialize RecipieList, which consists of a CList of Recipies, which in turn consist of CLists of various ingredients.

View Replies View Related

Writing Data To A Static Table - Can't Populate All Fields With Data

Jun 24, 2015

I have a program which consist of several classes. The program reads a pom file and parses the data and then writes the data to a static table. The issue I'm having is with writing my LIB file data to my table. In the HtmlDataTable Class Im trying to write the files that are read in the lib directory to the table. My table currently consist of 3 columns (missing jar files,Lib Directory files, and POM file data) currently Im only able to write the missing jar files data to my table. In the HtmlDataTable class there is a for statement where I write the missing jar file data to my table. Im also trying to write the contents of the Lib directory within this statement as well. This is where I'm having my issue. My other classes consist of a SAX parser which parses the xml file, a class that creates my static table and a class that compares the jar files in my lib directory to the jar files in my pom file. . Theres a lot of code so I included the parts I felt were useful. If needed I can include the other classes as well.
 
public class ReadPomFile extends DefaultHandler {
public static void main(String[] args) {
try {
// obtain a SAX based parser to parse XML document

[Code].....

View Replies View Related

Reading Data From A File And Putting That Data In Arrays

Feb 8, 2015

I am creating a program where it reads the data inside a file and then places this data into arrays. The file I created has numbers 1-30 in it, file named, testing1.txt .

Java Code:

public static void main(String[] args) {
// TODO Auto-generated method stub
// Variables Declaration Section
//******************************
BufferedReader br;
String sCurrentLine;
String str;

[Code] ....

My issue is that the 'str' value is not initialized, but if I initialize it, it ruins the code. I'm not sure what to do in the situation.

View Replies View Related

Java To Access SAP

May 30, 2014

Using java to access SAP? I want to create a UI to analyze SAP data and create JTable reports. Not finding much on the internet.

View Replies View Related

JSP :: Access Project Through VPN

Nov 24, 2014

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.

View Replies View Related

How To Access Webcam Using Java

Feb 13, 2014

I want to implement video-conferencing feature inside my chatting application so how can i do it?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved