Servlets :: Error Message To JSP
Jan 6, 2015
I have a servlet that adds entries to a table and when there is a duplicate it redirects to an error page and I'd like to make it display the duplicate entry id.The problem is when I try to get the parameter and show the error (the duplicate entry id) on my jsp error page it shows null instead of the appropriate number.this is my servlet:
package package_ergasia;
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
[code]....
View Replies
ADVERTISEMENT
Mar 11, 2014
I'm very new to java code I'm currently learning about loops I've tried to write this for a statement in the program I'm making but its not working. I keep getting this message
LoanQualifier.java:26: error: illegal start of expression
if (salary >0||<=250000)
^
LoanQualifier.java:28: error: illegal start of type
if (yearsOnJob >0||<50)
I'm using Jgrasp for a complier
View Replies
View Related
Apr 14, 2015
I am trying to print out all of the values of an array and the average. I am getting part of the printout but I am also getting an array out of bound error message. what I am doing wrong?
int [][] points = new int [2] [3];
points [0][0]= 3;
points [0][1]= 2;
points [0][2]= 4;
points [1][0]= 2;
points [1][1]= 2;
points [1][2]= 2;
int totalPoints = 0;
int totalShots = 0;
[code]...
View Replies
View Related
May 30, 2014
I am trying to uncover why I am getting an error message when trying to view a panoramic photo on my wordpress website.We are using the PTviewer plugin.This is the error message when you load the page: URL....I recently took over as webmaster for this site am not sure how the previous developer decided to set this up.Here is the raw code:
<div style='padding: 15px'><h2 style='font-size: 13pt; color: #DB592D; margin-left: 5px; margin-bottom: 5px; font-family: georgia;'>Spacious One & Two Bedroom Suites</h2><p style="">Stay & Play at Pacific Plaza and your stay will be filled with fun, excitement in a relaxing beach atmosphere.<p style="">Choose from our spacious one bedroom and two bedroom suites.
[code]....
View Replies
View Related
May 5, 2014
I am getting the error message as Exception in thread "main" java.lang.Error: Unresolved compilation problems: NewExcel cannot be resolved to a type for the line NewExcel test = new NewExcel(); in the below code to read the columns from an excelsheet "test.xls". Why I am getting the error message :-
import java.io.File;
import java.io.IOException;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class ReadExcel
[Code] .....
View Replies
View Related
Apr 16, 2015
I made a guess a number program but I am having issue figuring out a way that when a user enter's in nothing for the program to spit out a message saying "hey entering nothing doesn't work try again" then ask for input. I have done some research and from what I have found is to read the input in as a String rather than int, and use something like Integer.valueOf() to get the integer value but I am completely lost on how to apply that to my program here is my code
//import statements
import java.util.*; //for scanner class
// class beginning
public class Guess {
public static void main(String[] args ) {
//Declare variables area
int guess, secretNumber = (int) (Math.random() * 10 + 1), lowGuess,highGuess;
[Code] ....
View Replies
View Related
Jul 10, 2014
I am trying to encrypt a message using RSA algo but getting the following error:
java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectI nputStream.java:753)
at java.io.ObjectInputStream.<init>(ObjectInputStream .java:268)
Java Code :
public static final String PUBLIC_KEY_FILE = "C:/TXT.key";
final String originalText = "Text to be encrypted ";
ObjectInputStream inputStream = null;
FileInputStream f= new FileInputStream(PUBLIC_KEY_FILE);
// getting error on the below line
inputStream = new ObjectInputStream(f);
final PublicKey publicKey = (PublicKey) inputStream.readObject();
final byte[] cipherText = encrypt(originalText, publicKey);
View Replies
View Related
Jul 29, 2014
What's wrong with my Java program? When I open it using appletviewer, the applet opens but stays blank and an error message appears in Terminal.
Java Code:
import java.applet.*;
import java.awt.*;
public class DemoColor extends Applet
{
Font littleFont = new Font("Helvetica", Font.ITALIC, 6);
public void paint(Graphics gr)
[Code] ....
Error Message:
Exception in thread "AWT-EventQueue-1" java.lang.IllegalArgumentException: Color parameter outside of expected range: Red Green Blue
at java.awt.Color.testColorValueRange(Color.java:310)
at java.awt.Color.<init>(Color.java:395)
at java.awt.Color.<init>(Color.java:369)
at DemoColor.paint(DemoColor.java:24)
[Code] ....
HTML file:
<HTML>
<APPLET CODE="DemoColor.class" WIDTH = 420 HEIGHT = 300>
</APPLET>
</HTML>
View Replies
View Related
Apr 17, 2015
I am assigned to create a program "Simpletron" that the only language understands it is Simpletron Machine Language or SML. I figured out the most but I get the message "No main methods, applets, or MIDlets found in file" when compiling the program. I pasted my program so that you can see.
//A Simpletron computer simulator */
import javax.swing.*;
import java.text.DecimalFormat;
import java.awt.*;
import java.awt.event.*;
[code]....
View Replies
View Related
Sep 28, 2014
The problem is the result of encoded message can't not restore to the original message by the decoder. Here are my three class's code
SecureMsgMain:
package securemsg.core;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import securemsg.database.*;
public class SecureMsgMain {
[Code] .....
View Replies
View Related
Sep 29, 2014
I've the below data in my HTML.
<body>
<div class="container">
<form name="main" action="Insert_Record" method="post">
<table class="bordered">
<tr>
[Code]....
I'm getting the below error.
java.text.ParseException: Unparseable date: "09-10-14"
if i use d-MM-yyy, the output is
Thu Aug 09 00:00:00 IST 14
but i want the date in output to be.
09-10-14
below is how my data base is like.
how can i get this.
View Replies
View Related
Mar 9, 2014
i am using netbeans6.7.1 version i implemented one program i.e web application ..when am excuting this one i got one error http status 500...
this is the code:
SumServlet.java
package com.sum;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
[code]....
View Replies
View Related
Mar 9, 2014
correct this error
WishSrv.java
package com.wish;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Calendar;
import javax.servlet.ServletException;
[code]...
View Replies
View Related
Feb 20, 2014
I am trying to use hidden variable in project.When I launch my project i am able to get the welcome page.But when submit login values i am getting HTTP 404 error- Resource not found error.
`My home Page/Login Page
<body>
<form action="<%=request.getContextPath() %>/LoginServlet" method="get">
USERNAME<input type="text" name="uname"><br>
PASSWORD<input type="password" name="pass"><br>
<input type="submit" name="submit" value="submit">
My LoginServlet
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
System.out.println("sandeep");
PrintWriter out=response.getWriter();
String userName=request.getParameter("uname");
[code].....
View Replies
View Related
Feb 26, 2014
Below is my Servletclass code
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MyFirstServlet extends HttpServlet {
[Code] .....
I have configured tomcat7 in my ecclipse ide...
View Replies
View Related
Dec 14, 2014
My dynamic web project has a java class that captures a session variable with the following code.
HttpSession LoginSession = request.getSession();
String VAR = LoginSession.getAttribute("myVar").toString(); //This is the row 127
If i test the app in local (Mac + Java 1.8 + Tomcat 8) all works. In my remote cloud server (Ubuntu 14.10 + Java 1.8 + Tomcat 8) all works, except this class, that has this code. I copy the complete error here. Note that the row 127 of the error message is the second row of the previous code; and, if i comment this row with // and assign a fix variable all works. So, the problem is that 127^ row.
14-Dec-2014 08:15:23.923 SEVERE [http-nio-8080-exec-14] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [srvNavigation.SrvPT] in context with path [/myapp] threw exception
java.lang.NullPointerException
at srvNavigation.SrvPT.doGet(SrvPT.java:127)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
[Code] ....
How can i solve the problem?
View Replies
View Related
Sep 9, 2014
I am stuck with my application. I have jsp, servlet application with jasper report server. When I run the application through eclipse, everything works perfectly. But When I try to run it in Tomcat (without eclipse) it gives me the "Unable to resolve the class file " error. I tried all the solutions I got through the google, but still I am unable to come over it.
View Replies
View Related
Nov 5, 2014
I m new to programming and am working on the college project. I have MySQL 5.6.20, Eclipse Kepler and Apache Tomcat 7.0.54. I m trying to retrieve the whole table from MySQL schema into a jsp. All the possible things i can do, i have already tried, but none of them are working.
The following attachment contains the whole project. I have my sql connection code in Sample.java file, which i want to get working in Fetch.jsp on the Submit button click. But it shows the tomcat error as localhost:8080/Sample HTTP Status 404-/Sample ; type Status report; message /Sample; Description The requested resource is not available.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
[Code] ....
View Replies
View Related
Jan 22, 2015
I made a web app to test the ServletContextListener in tomcat according to the book head first servlets and jsps and used the code
out.println("test context attributes set by listener<br>");
Dog dog = (Dog) getServletContext().getAttribute("dog");
out.println("Dog's breed is: "+dog.getBreed());
in the listener class.But the output is showing the first line only and the second println() is not showing any output whereas my Dog class compiled successfully and I didn't see any NullPointerException as expected in the book but somehow it seems like the problem is in the 2nd line of code only but I don't know what.
I also tried to add a 4th line at the end with println() only but with a simple text even that is not running but when I put that same line after the 1st line, the output is shown.I am unable to see what has gone wrong in the 2nd line of code.
View Replies
View Related
May 22, 2014
I'm trying to learn java by making a login page using java, servlet, javascript, html and mysql. I can login with username and password, I can get all the information from database in the edit page. However, when I edit and click on "Submit" in EditPage.jsp, it gives HTTP Status 404. Same screen appears when I click on "Sign Up" from first page (NewFile.jsp) and click on "Submit" button after filling up user information.
I am posting all my code here but probably important ones are:
EditPage.jsp, Edit.java, EditDetails.java, UpdateUser.java and for Sign Up SignUpPage.jsp and Registration.java.
Firstly here are my error message and ss from my project explorer:
Here is my code:
LoginServlet.java
package com.amzi.servlets;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
[Code] ....
View Replies
View Related
May 20, 2014
I'm a new Java user and I'm trying to code a simple login page. In first page (NewFile.jsp) users should enter their username and password and should click on "login", or click on "sign up".
1.) If user enters his username and password correctly, a login page (LoginPage.jsp) appears and says "welcome null" but it should show the name of that user instead of null.
2.) In that login page there is an edit button to edit profile information. When I clicked on it, every information is "null" and when I edit them and click on "Submit" button;
HTTP Status 404 -
type Status report
message
description The requested resource () is not available.
GlassFish Server Open Source Edition 3.1.2
that message appears.
3.) If I click on "Sign Up" button at the beginning, a registration jsp (SignUpPage.jsp) appears. After filling up text boxes and clicking on "Submit", same Status 404 screen appears.
I created a mysql database called "loginpage" using xampp. In that database there is a table called "users" and it has un, pass, name, surname, email and degree attributes.
Here is a screenshot of my project explorer:
Here is my code:
1. NewFile.jsp
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
[Code] .....
View Replies
View Related
Mar 14, 2014
import java.awt.*;
import javax.swing.*;
public class InstantMessageFrame extends JFrame
{
private JList friends;
private JTextField message;
private JButton send;
[code]...
1. Open the source code file of your InstantMessageFrame class from Lab 12.2.
2. Add the following three fields to the InstantMessageFrame class: a JTextField named message, a JList named friends, and a JButton named send.
3. Add a method to your InstantMessageFrame class named getMessagePanel()that returns a JPanel and has no parameters. (This method will create a JPanel that will appear in the south border of your JFrame. It will contain a text field in which a message can be entered and a button that sends an instant message to all the friends in the list.)
4. Within getMessagePanel(), instantiate a new JPanel and give it BorderLayout.Assign a message equal to a new JTextField by using the no-argument constructor of JTextField. Assign send to a new JButton,passing in "Send" to the constructor. (This will be the label on the button.)
5. Within getMessagePanel(), add the message text field to the center of the JPanel and add the send button to the east border of the JPanel. The panel is now ready, so return the JPanel reference.
6. Add a method to your InstantMessageFrame class named get-FriendsPane() that returns a JScrollPane and has no parameters.(This method will create a scrollable list that will contain the names of others that you can chat with.)
7. Within getFriendsPane(), assign friends to a new JList by using theno-argument constructor of JList.
8. Within getFriendsPane(), instantiate a new JScrollPane using the following statement: JScrollPane pane = new JScrollPane(friends);
9. The scroll pane is ready, so return the reference pane at the end of getFriendsPane().
10. Within the constructor of InstantMessageFrame, invoke getMessagePanel(),placing the returned panel in the south border of the content pane of InstantMessageFrame.An Introduction to GUI Programming 399
11. Within the constructor of InstantMessageFrame, invoke get-FriendsPane(), placing the returned scroll pane in the center of the content pane of InstantMessageFrame.
12. Save, compile, and run the InstantMessageFrame class.Your InstantMessageFrame now has three visible components: a JList,a JTextField, and a JButton.
View Replies
View Related
Apr 4, 2015
if i send messages as in the code below, is there a way to read only one message, if the client doesn't know how long it is (or if he only knows the maximum length)?in the documentation it says, that the method read(byte[]) reads until no data ist available or end of file is decteted. What does the latter mean? Can i extend the array that i sent by a byte that signals the end? Here is my Code:
Server
public class Server implements Runnable{
ServerSocket server;
HashMap<Short,Socket> clients;
public Server(){
clients = new HashMap<>();
[code]....
Both are startet in seperate threads. At the moment the first output of the client is "12 bytes read", and then continously "-1 bytes read"(because the server closes).
View Replies
View Related
Apr 22, 2014
I am new to the JMS technology. I have written one sample sender and receiver program to pass a string message to the JMS queue and retrieve it back. It is working fine as well. But now, I want to pass a xml file to the JMS queue. Then from there I need to read the XML file and convert it into a Java object Using Jaxb. I know how to convert an XML into java object using Jaxb. But i am unable to send the XML file as a jms message to the listener.
View Replies
View Related
Jan 22, 2015
I want to send a message to a specific client in a server. This is my code and what I tried(I have only given you 3 classes in which I believe I have the problem).
TextClient:
import java.io.*;
import java.net.*;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.concurrent.TimeUnit;
public class TextClient {
public TextClient() {
[Code]...
View Replies
View Related
Sep 17, 2014
Im debugging a code that has the following setting:
<application>
<message-bundle>com.web.resources</message-bundle>
<locale-config>
<default-locale>en_US</default-locale>
<supported-locale>fr_FR</supported-locale>
</locale-config>
<resource-bundle>
<base-name>com.web.resources.message</base-name>
<var>message</var>
</resource-bundle>
</application>
Just want to ask, for example I have message_en_US.properties and message_en_SG.properties.And the web is currently using the SG property but one property is not exist on it, can I just redirect to use the US property?
View Replies
View Related