Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x

Java EE

17K

Solutions

9K

Contributors

Java Enterprise Edition (Java EE) is a specification defining a collection of Java-based server and client technologies and how they interoperate. Java EE specifies server and client architectures and uses profiles to define technology sets targeted at specific classes of applications. All Java EE profiles share a set of common features, such as naming and resource injection, packaging rules and security requirements.

Share tech news, updates, or what's on your mind.

Sign up to Post

I am working in a new project on a complex GUI with Java 8 and Swing. We use among others the Container class that has a void add(Component comp, Object constraints) method that adds the component with constraints information. I want to build a dialogue with three panels, where pressing a button would result in switching the constraint information of the components that do not include the button object. How is it possible to switch the constraint information easily?
0
Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

public class Main2 {
  public static void main(String args[]) {

    int len = 100;
    int key = 50;
    int k = 0;
    out: {
      for (int i = 0; i < len; i++) {
        for (int j = 0; j < len; j++) {
          if (i == key) {
            break out;
          }
          k += 1;
        }
      }
    }
    System.out.println(k);
  }
}

Open in new window


above code produced below output

5000



i am not clear on logic how it produced 5000
please advise
0
Hi,

when working with enum as a pojo field(Choice) do i need to any additional steps apart from regular getter and setter on it?
how getter setter on emum differ from getter setter of other String field like name as below


public class MainClass {
  enum Choice { Choice1, Choice2, Choice3 }
String name;

//enum getter
getChoice()
//enum setter
setChoice
//name gettetr
getName
//name setter
setName


please advise
0
Hi,

can you please point me to any links, resources on nested loop examples with 3 for loops. Please advise
0
Hi,

can you please point me to any links, resources on nested loop examples with 4 or more for loops. Please advise
0
public class TestNestedFor4 {

	public static void main(String[] args) {
		
		for (int i = 1; i <= 5; i++) {
			for (int j = 1; j <= (5 - i); j++) {
			System.out.print(" ");
			}
			for (int k = 1; k <= i; k++) {
			System.out.print(i);
			}
			System.out.println();
			}
		}
}

Open in new window


above code produced below output with 3 nested for loops


          1
        22
      333
    4444
  55555

how to produce below output instead? please advise

    1
   22
  333
 4444
55555
0
package com.bharaththippireddy.trainings.jaxrs;

public class NestedFor2 {

	public static void main(String[] args) {
		for (int i = 1; i <= 4; i++) {
			for (int j = 1; j <= 5; j++) {
				System.out.print("*");
			}
			System.out.println();
		}

	}
}

Open in new window


when i wrote above code and ran
package com.bharaththippireddy.trainings.jaxrs;

public class NestedFor2 {

      public static void main(String[] args) {
            for (int i = 1; i <= 4; i++) {
                  for (int j = 1; j <= 5; j++) {
                        System.out.print("*");
                  }
                  System.out.println();
            }

      }
}

i got below output

*****
*****
*****
*****


i cannot get above output without nested for loops right?
1
hi,

https://www.cs.utexas.edu/users/scottm/cs305j/handouts/slides/Topic6NestedForLoops_4Up.pdf

I wonder why there is not println in below example but simply print without ln


What is the output of the following nested What is the output of the following nested for
loop?
for (int i = 1; i <= 6; i++) {
for (int j = 1; j <= i; j++) {
System.out.print("*");
}
System.out.println();
}


please advise
0
Hi,
http://codingbat.com/prob/p134133
I am trying to solve challenge

We'll say that 2 strings "match" if they are non-empty and their first chars are the same. Loop over and then return the given array of non-empty strings as follows: if a string matches an earlier string in the array, swap the 2 strings in the array. When a position in the array has been swapped, it no longer matches anything. Using a map, this can be solved making just one pass over the array. More difficult than it looks.


allSwap(["ab", "ac"]) → ["ac", "ab"]
allSwap(["ax", "bx", "cx", "cy", "by", "ay", "aaa", "azz"]) → ["ay", "by", "cy", "cx", "bx", "ax", "azz", "aaa"]
allSwap(["ax", "bx", "ay", "by", "ai", "aj", "bx", "by"]) → ["ay", "by", "ax", "bx", "aj", "ai", "by", "bx"]

i was not very clear on the approach and above description as well.

How to design and code and test above kind of challenges? please advise
0
Hi,

http://codingbat.com/prob/p150113

I am trying to solve above challenge
We'll say that 2 strings "match" if they are non-empty and their first chars are the same. Loop over and then return the given array of non-empty strings as follows: if a string matches an earlier string in the array, swap the 2 strings in the array. A particular first char can only cause 1 swap, so once a char has caused a swap, its later swaps are disabled. Using a map, this can be solved making just one pass over the array. More difficult than it looks.


firstSwap(["ab", "ac"]) → ["ac", "ab"]
firstSwap(["ax", "bx", "cx", "cy", "by", "ay", "aaa", "azz"]) → ["ay", "by", "cy", "cx", "bx", "ax", "aaa", "azz"]
firstSwap(["ax", "bx", "ay", "by", "ai", "aj", "bx", "by"]) → ["ay", "by", "ax", "bx", "ai", "aj", "bx", "by"]

Open in new window



How to approach this challenge. I was not clear on above description either. please advise
0
Concerto Cloud for Software Providers & ISVs
LVL 4
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Hi,
http://codingbat.com/prob/p190862
I am trying above challenge as below


public Map < String, Boolean > wordMultiple(String[] strings) {
 Map < String, Boolean > map = new HashMap < String, Boolean > ();
 int x=0;

  String result = "";
  for (int i = 0; i < strings.length - 1; i++) {
   if (strings[i] == strings[i + 1]) {
   map.put(strings[i], true);
   }
   else{
      map.put(strings[i], false);
   }

  }
  return map;

 }

Open in new window


I am failing below tests cases
Expected      Run            
wordMultiple(["a", "b", "a", "c", "b"]) → {"a": true, "b": true, "c": false}      {"a": false, "b": false, "c": false}      X      
wordMultiple(["c", "b", "a"]) → {"a": false, "b": false, "c": false}      {"b": false, "c": false} missing: "a": false      X      
wordMultiple(["c", "c", "c", "c"]) → {"c": true}      {"c": true}      OK      
wordMultiple([]) → {}      {}      OK      
wordMultiple(["this", "and", "this"]) → {"and": false, "this": true}      {"and": false, "this": false}      X      
wordMultiple(["d", "a", "e", "d", "a", "d", "b", "b", "z", "a", "a", "b", "z", "x"]) → {"a": true, "b": true, "d": true, "e": false, "x": false, "z": true}      {"a": false, "b": false, "d": false, "e": false, "z": false} missing: "x": false      X      
other tests
X

How to tweak my code to fix those errors. Any simple solution for this?
0
Hi,

http://codingbat.com/prob/p103593

public String wordAppend(String[] strings) {
  String result="";
  for(int i=0;i<strings.length-1;i++){
  if(strings[i]==strings[i+1])
  {
     result=result+strings[i];
  }
  
}
return result;
}

Open in new window


I WROTE MY CODE AS above and got below results

Expected      Run            
wordAppend(["a", "b", "a"]) → "a"      ""      X      
wordAppend(["a", "b", "a", "c", "a", "d", "a"]) → "aa"      ""      X      
wordAppend(["a", "", "a"]) → "a"      ""      X      
wordAppend([]) → ""      ""      OK      
wordAppend(["a", "b", "b", "a", "a"]) → "ba"      "ba"      OK      
wordAppend(["a", "b", "b", "b", "a", "c", "a", "a"]) → "baa"      "bba"      X      
wordAppend(["a", "b", "b", "b", "a", "c", "a", "a", "a", "b", "a"]) → "baaba"      "bbaa"      X      
wordAppend(["not", "and", "or", "and", "this", "and", "or", "that", "not"]) → "andornot"      ""      X      
wordAppend(["a", "b", "c"]) → ""      ""      OK      
wordAppend(["this", "or", "that", "and", "this", "and", "that"]) → "thisandthat"      ""      X      
wordAppend(["xx", "xx", "yy", "xx", "zz", "yy", "zz", "xx"]) → "xxyyzzxx"      "xx"      X      
other tests
X



how do i tweak my code to pass all tests. please advise
0
hi,

what is difference and usage of
eclipse call hierarch y vs type hierarchy

also
on mehtod when i right click saw reference then project otherwise other option reference within project option
what is difference between above two
when to use which one? please advise
0
Hi,

i am going through below link

http://www.summa.com/blog/2009/05/19/top-10-not-so-popular-eclipse-shortcuts

eclipse what is difference between control1 and control 2 when to use which one?

please advise
0
Hi,

I am reading as below.
I wonder why stateful EJB are more resource intensive and server need more work for them(is it just to save data at class level)?
https://www.javaworld.com/article/2071724/java-web-development/ejb-fundamentals-and-session-beans.html

There may be more work involved for the server to share stateful session beans than is required to share stateless beans. Storing the state of an EJB is a very resource-intensive process, so an application that uses stateful beans may not be easily scalable. Stateless session beans provide excellent scalability, because the EJB container does not need to keep track of their state across method calls

please advise
0
Hello,
facing a problem to choose best client side framework for localization with jsp?
I have REST API which i need to consume at client side and display it on jsp will it be safe to use spring mvc for client side?
What is the best practice to integrate client-server ?
0
For a prarticular value say DOB to insert into database table say CUSTOMER some
xYZMain calls---XYZOrchestrator class ----which calls ----XYZDAO ---where some jdbc call happens with callble statments with ?,? as arguments to insert.

Now my question is how to trace in eclipse which method of which class calls which method of which class starting from main upto DAO.

call hierarchy in eclipse control+alt+h on particular method just gives details of who is calling particular method.

please advise
0
In eclipse when i selected a method and do control+alt+H i get
An internal error occurred during: "Fetching children of orchestrate".
GC overhead limit exceeded

how to resolve this error. please advise
0
Hi,
I am reading below link

https://docs.oracle.com/cd/E19798-01/821-1841/6nmq2cp1v/index.html

I was not very clear when we use content type application/xml  and when we use application/x-www-form-urlencoded and when we use json. what is importance of content type and practical uses of it. How media type is different from content type or mime type. what is the meaning of payload. please advise
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE
LVL 4
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

how to configure https in jboss7
0
right click on that imported project and properties and target run times selected that fixed the issue
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
how

right clicking on the project --->and going to properties --->changing target run time--> to tomcat 8 etc different from



windows -->preferences--->server-->run time environment--->Add-->tomcat 8 etc here
0
we have web portal running on jboss7.
how to support both IPv6 and IPV4 for web portal.
0
We are using Jasper reports in our product, and there is a requirement to sort the report based on the click on the header of any column.

We are not using the Reports Server but the Jasper libraries are bundled within our Web-application itself, and the report content is loaded into an iFrame via a Servlet.

However, while the column cells can contain hyperlinks and are clickable, but the column headers are not coming as clickable at all but they are static.

We have tried the sample application provided with Jasper library that enables Jive features, however in that one we are unable to send custom parameters to the report/ data-source.

If anyone has experience in Jasper reports libraries bundling within Java EE web-apps and sorting of columns based on header-click, please revert.
0
Hello All,

Is it possible to convert an Indesign file ( i.e. CS 5.5, CS 6) into a Word document (.docx)?

Please help me out how it can be done and what will be the steps for the same?

Thanks in advance....
0
Hi,

when and why we use what is maven update project by right clicking on project. do w e have to do afetr maven clean or before maven clean?
what does it do?
please advise
0

Java EE

17K

Solutions

9K

Contributors

Java Enterprise Edition (Java EE) is a specification defining a collection of Java-based server and client technologies and how they interoperate. Java EE specifies server and client architectures and uses profiles to define technology sets targeted at specific classes of applications. All Java EE profiles share a set of common features, such as naming and resource injection, packaging rules and security requirements.