So my EL expressions in my jsp are not taken into account in my project. It was working fine when I was using DAO but I switched my project to ORM using the annotations. Using Tomcat in the first place and now JBoss 7.2. Anyway take a look because I really don't understand what I have to do.
When I acces the page I create I get this : OyN3K.jpg while I'm supposed to have a form.
I don't think it's an error in my code but more or less a configuration problem. Btw I don't think it's a problem in my url since when I put a wrong one I've an error telling me it doesn't find the jsp file. That said it's clearly the ${} not being taken into account.
I understand how mixing expressions of different data types can result in an error if the assigned variable is not the same data type. But I don't understand how the below causes an error:
short totalPay, basePay = 500, bonus = 1000; totalPay = basePay + bonus; // This causes the error
500 + 1000 = 1500. 1500 falls within the short parameters. If basePay, bonus, and totalPay are all short, as well as the resulting equation, how is this erroring?
Lines 7 , 10 ,13 .... All have a Illegal Start of Expression error.
[color=blue]private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { Random rd = new Random(); int random = 0; random=rd.nextInt(6)+1; switch(random){
I'm working on a program and can't seem to fix my for loop error.I get an error at the for loop line saying illegal start of expression and i don't know how to fix it:
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */
public static void main(String[] args) { Scanner Keyboard = new Scanner(System.in); System.out.print("Please enter your name."); String name = Keyboard.next(); name = "name";
I am trying to build an expression tree program . I try to print it then I have java.nullpointer exception . Is it error in my code or what ?
I have 2 classes
one is BSTreeNode which is the nodes for the tree . It has
public class ExpressionTree { public BSTreeNode root; public BSTreeNode curr = root; ExpressionTree() { root = new BSTreeNode(null, null, null, null); curr = root;
[Code] ....
My BSTreeNode
public class BSTreeNode { BSTreeNode parent; Object element; // Binary search tree element BSTreeNode left; // Reference to the left child BSTreeNode right; // Reference to the right child // Constructor BSTreeNode (Object elem) [Code] ....
The error i am getting is
Exception in thread "main" java.lang.NullPointerException at binaryexpressiontree.ExpressionTree.insert(ExpressionTree.java:38) at binaryexpressiontree.test.main(test.java:22)
Java Result: 1
After implementing exception handler what i am getting is
java.lang.NullPointerException root 1 * root 2 1 error error error//these error print because of my catch clause
The program i am working on is to take string from the user which should be a phone number then it will return true or false based upon the method that checks to see if it meets the criteria of a certain format if does not it will return false otherwise return true. I am working on a if/else structure that will print this number is valid if it meets the criteria of the method i previously mentioned or return the number is not valid if it is false. the logic of the expression i put in the parentheses of the if/else statement. This is what i have so far:
if(){ System.out.println("The phone number is valid"); } else { System.out.println("This isn't a valid phone number"); }
Do i need to compare it based upon the method that checks if it is true?
I am working on a program to evaluate an expression without brackets using stacks. I am getting the following error :
3+1*2+4 -2.0
Exception in thread "main" java.util.EmptyStackException at java.util.Stack.peek(Stack.java:102) at java.util.Stack.pop(Stack.java:84) at assignment2.Evaluate.main(Evaluate.java:42)
I imported the Stack from java.util.Stack
package assignment2; import java.util.Scanner; import java.util.Stack; public class Evaluate { public static void main(String[] args) { Stack<String> ops = new Stack<String>();
[Code] ....
What is causing this error? Does it look like the program should function as intended?
So everything in my program is working EXCEPT when it comes to calculating the result. I am supposed to evaluate the expression using postorder traversal to return the answer. I am honestly not sure how I would get the postorder traversal to return the answer to the expression since the only thing we really went over was how it re-ordered the expression so that it would end in the postorder/postfix order. Anyways, currently the way that I have the public int evaluate(Node node)method set up is giving me a result of 0, which obviously is not correct.
Here's the section that I'm having issues with:
public int evaluate(Node node){ if(node.isLeaf()){ return Integer.parseInt(node.value); } int result = 0; int left = evaluate(node.left); int right = evaluate(node.right);
I am currently enrolled in my first Java class. I have taken C# in the past so I've messed with some regular expressions, but I am having trouble finding a good website for Java. Is the syntax the same?I want to create a regular expression to only allow the following characters: c C f F [and any 1-3 digit number].
I am getting the error "Line 54, illegal start of expression". Line 54 is where my "for" starts. It was running ok earlier, now I can't get this error to go away?
I have a string "We have 7 tutorials for Java, 2 tutorials for Javascript and 1 tutorial for Oracle" I need to replace the numbers based on the below condition.
if more then 5, replace with many if less then 5, replace with a few if it is 1, replace with "only one"
below is my code, I am missing the equating part to replace the numbers
private static String REGEX="(d+)"; private static String INPUT="We have 7 tutorials for Java, 2 tutorials for Javascript and 1 tutorial for Oracle"; //String pattern= "(.*)(d+)(.*)"; private static String REPLACE = "replace with many"; public static void main(String[] args) { // Create a Pattern object
I have a variable <c:set var="var1" value = "myvalue" /> , I want to pass var1 as <%= new customclass().method1(var1) %>.what is the syntax to pass this value.
I have some problems about performing regular expression. In the following code, the output as a result is being "valid last name". But in my opinion, it should be "invalid last name". Because "Doe" has not any space, apostroph or any hypen. Look at the regular expression statement: "[a-zA-Z]+([ '-][a-zA-Z]+)*"
package deneme; public class Deneme { public static void main(String[] args) { String lastName = "Mc-Something"; // Mc-Something if(!lastName.matches("[a-zA-Z]+([ '-][a-zA-Z]+)*")) System.out.println("Invalid last name"); else System.out.println("Valid last name"); } }
I know that the asterisk qualifier means character(s) in any number.(Is this wrong?) So for "Mc-Something", 'M' corresponds to [a-zA-Z], 'c' corresponds to +, - corresponds to [ '-], 'S' corresponds to [a-zA-Z], "o" corresponds to +, and finally "mething" corresponds to *, doesn't they? But for "Doe", there is no any space, apostroph or hypen.
In my Icefaces 3 application I have a ManagedBean ancestor that defines common attributes to those they spread it. Including CSS styles to be apply at the menu as icons depending on whether they are selected or not. Classes that extend the CommonMBean class define styles. My question is what do I have to put in the language experssion styleClass to tell him that the getter to use is that of the parent class.
CommonMBean.java package com.omb.view; public class CommonMBean private String menu1Css = ""; private String menu2Css = "";
String name = "James Bond"; Session.setAttribute("name", name);
Why is the attribute name and attribute value the same in all the books I've read. I know one is a string literal and one is an object but must it be the same?
Second thing I'm confused about... let's say I change the servlet code to
String name = "James Bond"; Session.setAttribute("hisname", name); When I try to access it using JSP: ${sessionScope.name}
it works fine. So what is the point of the first argument in Session.setAttribute() ?
In this i Write a Java program to parse a syntactically correct arithmetical expression and produce an equivalent Expression TREE. Remember, in an expression tree the terminal nodes are variables and constants, and the interior nodes are operators (such as +,-,*,/). For instance the expression: (1 + 2) * 3 can be represented by the following tree:
I have just started to learn programming in the book I am teaching myself from it said how would you write the following arithmetic expression with it being the quadratic formula but only the plus part of it in the plus or minus..
package javalearning; import java.util.Scanner; public class QuadraticFormula { public static void main(String[] args){ Scanner input = new Scanner(System.in); System.out.print("Enter value for B: "); double B = input.nextDouble(); System.out.print("Enter value for A: "); double A = input.nextDouble(); System.out.print("Enter value for C: "); double C = input.nextDouble(); double negativeOfB = -B;
Given a LISP expression, perform operations on the expression. There will be no list elements that also contain a list such as '(A (B (C D))), which has one atom and one list but the list contains a sublist
INPUT: There will be 5 lines of input. Each line will contain a valid LISP expression. There will be a space between each atom and each list. There are no spaces immediately after or immediately before parentheses in a list. The entire expression must be inputted as a single string.
OUPUT: Perform the given operation on the like numbered expression. The 5 operations are:
1. Print the expression with the list in reverse order. The list will contain only atoms.
2. Print the expression with the list written with consecutive duplicates encoded as sublists in (count element) order. The list will contain only atoms.
3 Print the expression with the list written with consecutive duplicates encoded as sublists in (count element) order except that singletons are listed as atoms. The list will contain only atoms.
4. Print the expression with the list written with every Nth element deleted and where N is the last element of the list.
5. Print the expression written as 2 expressions where the number of lists in first expression is the last element of the expression.
SAMPLE INPUT SAMPLE OUTPUT 1. '(A B C D) 1. ′(D C B A) 2. '(A A A A B C C A A D E E E E) 2. ′((4 A) (1 B) (2 C) (2 A) (1 D) (4 E)) 3. '(A A A A B C C A A D E E E E) 3. ′((4 A) B (2 C) (2 A) D (4 E)) 4. '((4 A) (1 B) (2 C) (2 A) (1 D) (4 E) 2) 4. ′((4 A) (2 C) (1 D) 2) 5. '((4 A) (1 B) (2 C) (2 A) (1 D) (4 E) 3) 5. ′((4 A) (1 B) (2 C)) ′((2 A) (1 D) (4 E) 3)