JSP :: Adding Scriptlet In Directive
Sep 21, 2014
<jsp:directive.include file='<%= session.getAttribute("htmlPath").toString(); %>' / I tried to add a Scriptlet in a jsp directive like above. But am keep getting the below error.
HTTP Status 500 - /parseXML.jsp (line: 86, column: 1) File "<%= session.getAttribute("htmlPath").toString(); %>" not found
type Exception report message /parseXML.jsp (line: 86, column: 1) File "<%= session.getAttribute("htmlPath").toString(); %>" not found description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /parseXML.jsp (line: 86, column: 1) File "<%= session.getAttribute("htmlPath").toString(); %>" not found
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:443)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:133)
org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:322)
org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:357)
org.apache.jasper.compiler.Parser.parseXMLDirective(Parser.java:533)
org.apache.jasper.compiler.Parser.parseFileDirectives(Parser.java:1764)
org.apache.jasper.compiler.Parser.parse(Parser.java:135)
[code]....
View Replies
ADVERTISEMENT
Apr 10, 2007
E.g:
onblurr="check(this, '<%=company.getId()%>' );return false;"
doing this, function check(field, inputVal) {
alert("companyId:" + inputVal);
}
Gave me the alerted value as :
companyId:<%=company.getId()%>
instead, if the company.getId() --> 30
When I do like this, how to get the value 30 inside the function? i want companyId:30
View Replies
View Related
May 25, 2011
I'm having an issue when I try to define a variable in a JSP scriptlet, and then in a separate scriptlet on the same page attempt to use the variable. It looks like it goes out of scope.
I also cannot reference a variable from a servlet in a JSP expression tag. So I've had to write the entire page basically in one scriptlet.
I'm using Tomcat 6.0.
View Replies
View Related
Jun 12, 2014
When using trim-directive-whitespaces in a Tomcat 7 application this expression also get trimmed:
<div class="${item.view} ${item.className}">
resulting in the HTML
<div class="personchild">
instead of
<div class="person child">
On the other hand, when I first assign the expression to a varibale it's fine:
<c:set var="className" value="${item.view} ${item.className}"/>
<div class="${className}">
results in the desired HTML
<div class="person child">
Is this the intention of the trim whitespace directive or does this look like a bug?
View Replies
View Related
Mar 17, 2014
I have the below code with spaces on uri and prefix (directive attribute).
<%@ taglib uri=" news.tld" prefix=" news" %>
how to fix without altering the JSP? Can i handle with web.xml or any other property available.
I have hundreds of jsp like this and wanted to handle without code fixes.
I tried JSP trimSpaces but it fixes the namespace but not the attributes.
View Replies
View Related
Feb 26, 2014
May be I did not understand the meaning and usage of attribute "session" in page directive. My understanding is if session=false, in page directive, then the JSP page will not participate in the session. However, I have my welcomepage as below:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="true"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
........
.......
<%= session %>
<c:out value="${pageContext.request.session}"/>
if I choose session=true, then both ways of accessing session works , which means the JSP page participated in the session.
But if I change the session=false, then <%= session %> fails, but <c:out value="${pageContext.request.session}"/> does not fail.
how can c:out still show the session, when session = false
View Replies
View Related
Jan 1, 2015
I am working on a text based adventure game. (This is NOT OOP at all) The problem comes in at my second if statement inside my loop, it is not adding 1 to my array locations[] it keep printing location[0] then a 1 at the end. Not really sure what is going on here. I would like it to when I type "Go north" it adds 1 to locations[]
E.G
locations[0]
Go north
locations[1]
go north
locations[2]
package com.PenguinGaming;
import java.util.Scanner;
public class Game{
[code]....
View Replies
View Related
Apr 5, 2014
I'm really struggling adding JLabels to my GUI. The code is giving no errors but the JLables aren't showing up as I think I've done something else wrong. Here's my method for adding the JLabels:
public void showGraphics(){
for(int i=0; i<message.length(); i++){
if(message.charAt(i) == '#'){
JLabel localLabel = new JLabel("test label");
getContentPane().add(localLabel);
}
}
}
I think the problem might be to do with how the rest of the GUI is setup and the fact that I haven't specified where to add the JLabel just that I'm adding them.
Here's what my GUI looks like.
I want the JLabels above the JTextArea.
View Replies
View Related
Jul 28, 2014
Code of file:
Java Code: import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JPanel;
[code]...
The serializable class ImagePanel does not declare a static final serialVersionUID field of type long public class ImagePanel extends JPanel{ ^^^^^^^ ^ ^^2 problems (1 error, 1 warning) mh_sh_highlight_all('java');
im basically just trying to put the image inside the GUI and centre the text underneath it. Which is hard to believe since the text is above the image in the code .
View Replies
View Related
Feb 1, 2014
I'm trying to make a simple program that will show the amount of a bill, the tip, tax and total with all 3 added.
Right now i am having issues with line 12. I am getting the error "Variable amount might not have been initialized
I thought i did initialized it.
import javax.swing.JOptionPane;
public class BillAmt {
public static void main(String[] arg) {
String amt;
double tax, taxTotal, tip, total;
tax = 6.75;
double amount;
taxTotal = amount + tax;
tip = taxTotal *.15;
total = tip + taxTotal;
amt = JOptionPane.showInputDialog("Please enter the amount: ");
amount = Double.parseDouble(amt);
View Replies
View Related
Nov 5, 2014
package calculator;
public class operations {
int a = 5;
int b = 10;
public void add(int a,int b)
{
int c = a+b;
System.out.println(c);
}
}
I am not getting output to this question though it runs.
View Replies
View Related
Mar 25, 2015
I have a supermarket checkout line where i have a list of available products on the left and then a basket on the right with the products in. The products are listed in an array, here is the product class
public class Product {
private String name;
private double weight;
private double price;
[Code] ....
with getters and setters excluded, and the list these are put into
public class productList extends DefaultListModel {
public productList (){
super();
}
public void addProduct (String name, double weight, double price, int code){
super.addElement(new Product(name, weight, price, code));
i have the price for each product to be displayed in a text field with the following code
addBasketItem = new JButton();
getContentPane().add(addBasketItem);
addBasketItem.setText("Add >");
[Code] ....
defaultCheckoutList contains my available items and defaultMainList is the basket, with mainTillPrice being the jtextfield.
This works to get the price however it just replaces each time i make a new entry with the price for the next item, i want a total of the price of all the items i have added, but not sure how.
View Replies
View Related
Mar 11, 2014
how can I add the numbers in quantity where it will automatically put in total?
im using netbeans.
just want the codes for how to add the listed quantity?
View Replies
View Related
Nov 17, 2014
I want to add validation to some of the elements in my constructor.
Person(String idIn, String nameIn, ) {
this.id = idIn;
this.name = nameIn;
}
I want to be able to check that the data for the ID is limited to a certain collection of characters formatted in a certain. For example, I may wish to limit it to 5 lowercase letters or numbers, or a combination of both. How could I do this?
View Replies
View Related
Apr 12, 2015
Here is my program. I have to add the outputs from variable 'done' together. It seems to not work inside or outside the loop.
//A program that will find the last/check digit of a Book ISBN number.
import java.util.*;
public class ISBN {
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
System.out.println("Enter the ISBN number>");
String isbn = kb.nextLine(); //Even though the ISBN code is a number,
[Code] .....
View Replies
View Related
Sep 27, 2014
How do i add a ratio into this program. it needs to find the ratio from lowercase to uppercase.
import java.util.Scanner;
public class Strings
{
public static void main(String[] args)
[Code]....
View Replies
View Related
Nov 24, 2014
I wanted to create a interface with buttons ofshapes and type of transformation where user first select a shape, the shape will appear and user will have to click on the buttons on resize, reflect, rotate or skew to transform to shape. How can i do the coding? such as adding listeners to the shapes?
View Replies
View Related
Apr 21, 2014
I am doing a few Spring tutorials and in eclipse and for each tutorial I have to right click my project, build path, and then add external archives and then select the spring JAR files I want to bring in and use before my project will successfully compile and run. I was just wondering is this required for every project or is there a way I can set eclipse up to look in these locations for every project without me having to explicitly tell it too?
View Replies
View Related
Jan 16, 2014
I have been trying my hand at making 2d top down view games and have found myself repeatedly using the same code so i created a file with all the functions so when it is down i just import the jar and dont have to keep rewriting functions. I have trouble because the background is loaded on the screen and i dont know why as i didn't tell it to load. In fact I set the panels visiblity to false. Both of my classes are in the same package. Why I still get the Image.
Walking Turtle
Java Code: import javax.swing.*;
import java.awt.event.*;
public class turtleWalker extends JFrame{
public static void main(String[] args){
JFrame frame = new JFrame("Walking Turtle");
[code]....
View Replies
View Related
Oct 2, 2014
I am trying to add two bytes together in binary. The problem is that I need to print the carryover also. The printed result should be 8-bits long if the byte or the integer converted in binary is less than 8-bits the empty space should be filled with 0-s. I figured out how to print and add them, the part with the filling the blank with 0-s too. how to print the carryover. For example:
byte x =15;
byte y =9;
the output will be :
00011110 - carryover
x 00001111
y + 00001001
__________________
00011000 - result
import java.util.Scanner;
public class Addbytes
{
public static void main(String args [])
[code]....
View Replies
View Related
Nov 27, 2014
I am new to swing and I wanted to know how to be able to make a second row of buttons. Right now I have a text pane at the top and at the bottom one row of buttons. But I need to add another row or two of buttons. I've only been coding in Java.
public class TextPane {
public static void main(String[] args) throws IOException
{
/////////////
//I/O FILES//
/////////////
//Create the input file
FileWriter inputFile = new FileWriter("userInputStory.txt");//story user creates with the <nouns>, <verbs>, etc
PrintWriter inputFileWriter = new PrintWriter(inputFile);
[Code] .....
View Replies
View Related
May 4, 2014
So I'm doing a basic MVC layout for a pretty basic game that I am making in order to understand the whole MVC layout. The game requires the user to move up/down/left/right via JButtons on the GUI. Since I'm using an MVC layout and my buttons are in a different class than the ActionListeners, I was wondering what the best way to add the action listeners are?
Method 1:
View Class ActionListener method:
Java Code: public void addMovementListeners(ActionListener u, ActionListener d, ActionListener l, ActionListener r){
moveUp.addActionListener(u);
moveDown.addActionListener(d);
moveLeft.addActionListener(l);
moveRight.addActionListener(r);
[Code] ....
Which method is better? Is there another method that is even better than these two? Trying to get this MVC thing down.
View Replies
View Related
Apr 9, 2014
I am trying to add an image to this button.
button3 = new JButton();
button3.setIcon(new Image("C:\Users\Owner\Desktop\AUSE.jpg"));
button3.setEnabled(true);
panel.add(button3);
add(panel);
Error I am getting?
BackgroundImageHelper.java:77: error: Image is abstract; cannot be instantiated
button3.setIcon(new Image("C:\Users\Owner\Desktop\AUSE.jpg"));
^
1 error
[Code] ....
View Replies
View Related
Nov 28, 2014
I am making a graph to implement Breadth First Search and Depth First Search. I changed the program because I want each button to be its own node. However I am having an issue placing them into a panel. When I run the program I get the following error:
The method add (Component) in the type Container is not applicable for the arguments (Buttons)
JPanel matrixPan(){
Buttons[][] matrixBtn = new Buttons[25][25];
JPanel panel = new JPanel();
panel.setSize(550,550);
panel.setLayout(new GridLayout(25,25));
[Code] .....
View Replies
View Related
May 23, 2015
I am trying to create a simple programme that adds two defined matrices together,
public class Question4 {
int [][] numeros1 = { {1,2,3},
{4,5,6}
};
int [][] numeros2 = {{2,5,8},
{3,7,9}
[Code] ....
View Replies
View Related
Sep 18, 2014
I was assigned to create a program that opens up a window that asked the user for an input of 0-10. This input will create three windows with the correct number of rows and columns of JTextFields in the form of a matrix. the third window has a button that adds the two matrices (which also take user input) and adds them together and prints them in the correct matrix fields. I am having trouble declaring the 2d array from the user input and creating the windows with the correct amount of jtextfields to move on with my program.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class Matrices implements ActionListener {
private JFrame win1, win2, win3, win4;
private JButton button1, button2;
[Code] .....
View Replies
View Related