Struts Exception Again!!!! Help plz.........
Hello again,
Hope this time i'll get some response regarding my error in a simple struts exception.........i've an application in which i've main page i.e "index.jsp", frm this page i've a html link tag fwdin to another jsp page i.e "search.jsp".Now when i click on the link at my index.jsp page i'm getting the following exception:-
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented
it from fulfilling this request.
exception
org.apache.jasper.JasperException: /search.jsp(44,26) equal symbol
expected
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHan
dler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.jav
a:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.jav
a:90)
org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:193)
org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:143)
org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1328)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1560)
org.apache.jasper.compiler.Parser.parseBody(Parser.java:1789)
org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1060)
org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1367)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1560)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.ja
va:220)
org.apache.jasper.compiler.ParserController.parse(ParserController.java
:101)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.j
ava:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.j
ava:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.ja
va:1069)
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward
(RequestProcessor.java:1012)
org.apache.struts.action.RequestProcessor.processValidate(RequestProces
sor.java:980)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java
:255)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache
Tomcat/5.0.27 logs.
Apache Tomcat/5.0.27
Plz help me by telling what kind of equal symbol is expected by the application and where possibly it can be????????i've only 2 reference for "search.jsp" tht too in struts-config.xml file...........
here's the search.jsp file:-
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<head>
<title>Gaurav, Human Resource Portal</title>
</head>
<body>
<font size="+1"><b>Gaurav, Human Resource Portal - search.jsp</b></font>
<hr width="100%" noshade="true">
<html:errors/>
<html:form action="/search">
<table>
<tr>
<td align="right"><bean:message key="label.search.name"/>:</td>
<td><html:text property="name"/></td>
</tr>
<tr>
<td></td>
<td>--- or ---</td>
</tr>
<tr>
<td align="right"><bean:message key="label.search.ssNum"/>:</td>
<td><html:text property="ssNum"/> (xxx-xx-xxxx)</td>
</tr>
<tr>
<td></td>
<td><html:submit/></td>
</tr>
</table>
</html:form>
<logic:present name="searchForm" property="results">
<hr width="100%" size="1" noshade="true">
<bean:size id="size" name"searchForm" property="results"/>
<logic:equal name="size" value="0">
<center><font color="red"><b>No Employees Found</b></font></center>
</logic:equal>
<logic:greaterThan name="size" value="0">
<table border="1">
<tr>
<th>Name</th>
<th>Social Security number</th>
</tr>
<logic:iterate id="result" name="searchForm" property="results">
<tr>
<td><bean:write name="result" property="name"/></td>
<td><bean:write name="result" property="ssNum"/></td>
</tr>
</logic:iterate>
</table>
</logic:greaterThan>
</logic:present>
</body>
</html>
Similar Messages
-
Hi,
Im new to struts
im using Tomcat 5.5.9, Struts 1.2.4, jdk 1.4.1
Im getting an error while submitting form
Error like
type Status report
message /struts/userRegistration.do
description The requested resource (/struts/userRegistration.do) is not available.
Apache Tomcat/5.5.9Another exception also while all the fields get filled in the UserRegistrationForm.jsp and submit
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:516)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:423)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException
strutsTutorial.UserRegistrationAction.execute(UserRegistrationAction.java:33)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs. -
Hello , my previous purchased app do not occur again ,help me plz ?
Hello , my previous purchased app do not occur again ,help me plz ?
Have you changed countries since buying it, and is the app still available in your country's store ? If you've changed countries or it's been removed then you won't be able to redownload it - in which case do you have a copy of it in the Apps part of your computer's iTunes library, or on your backup of your downloads/library, so that you can sync it back to your iPad ?
If it is still in the store and it's not showing in the Purchased tab in the App Store app for redownloading then check to see if it's hidden : iTunes Store: Hiding and unhiding purchases. -
Help Plz i've blank LCD in Lenovo G530
Help Plz i've blank LCD in Lenovo G530
the unit is working and the power & wireless indicators is on but the LCD is blank
i've allready unpluged the battery and powered the unit with the charger only and plug the battery again but still have the same problem.
so plz advice what to do ?????Try to plug in external monitor and look if anything shows. Then try to check monitor configuration. Maybe it is switched off...
Regards,
Publius
Lenovo 3000 V200 -
Struts exception handling - Exception handler
Hi ,
I need some help for struts exception handling . Global exception is working fine in my struts application . But I need to show the exception stack trace also in the screen whenever the exception occurs.I guess this can be achieved if we use a custom exception handler instead of struts default exception handler . Can anyone please provide me a sample code to deal with a custom ExceptionHandler class ?
Thanks in advance...
Regards,
BGThe struts provides org.apache.struts.action.ExceptionHandler class for creating the custom exception handlers. All the custom Exception Handlers should extend the ExceptionHandler class and override the execute() method.
//An Example
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ExceptionHandler;
import org.apache.struts.config.ExceptionConfig;
public class CustomExceptionHandler extends ExceptionHandler {
public ActionForward execute(Exception exception, ExceptionConfig config, ActionMapping mapping, ActionForm formInstance,
HttpServletRequest request, HttpServletResponse response) throws ServletException {
try {
// TODO CustomeCode
System.out.println("Exception Handler for the specific error");
}catch (Exception e) {
return (super.execute(exception, config, mapping, formInstance, request, response));
Struts-config.xml File
<exception key="error.system" type="java.lang.RuntimeException"
handler="com.visualbuilder.handler.CustomExceptionHandler" path="/index.jsp" />
Note:- This will transfer the control to the index.jsp after calling the exception handler. In the struts-config.xml we are adding the global exception for RuntimeException. You can add any exception like the previous example to some actions only.
I have taken this example from following link. You may visit it.
http://www.visualbuilder.com/jsp/struts/tutorial/pageorder/38/
I would like if you share knowledge with me. -
BeanUtils.populate exception (Need Help)
Dear All,
Am getting a strange exception when try to do a action in struts, below is my exception, please help me in solving this issue.
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: BeanUtils.populate
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1190)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
java.security.AccessController.doPrivileged(Native Method)
java.security.AccessController.doPrivileged(Native Method)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
root cause
java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
java.security.AccessController.checkPermission(AccessController.java:427)
java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
java.lang.SecurityManager.checkMemberAccess(SecurityManager.java:1662)
java.lang.Class.checkMemberAccess(Class.java:2125)
java.lang.Class.getDeclaredMethods(Class.java:1762)
org.apache.commons.beanutils.MappedPropertyDescriptor$1.run(MappedPropertyDescriptor.java:386)
java.security.AccessController.doPrivileged(Native Method)
org.apache.commons.beanutils.MappedPropertyDescriptor.getPublicDeclaredMethods(MappedPropertyDescriptor.java:383)
org.apache.commons.beanutils.MappedPropertyDescriptor.internalFindMethod(MappedPropertyDescriptor.java:453)
org.apache.commons.beanutils.MappedPropertyDescriptor.findMethod(MappedPropertyDescriptor.java:527)
org.apache.commons.beanutils.MappedPropertyDescriptor.<init>(MappedPropertyDescriptor.java:149)
org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:865)
org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:991)
org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:865)
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:343)
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1188)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
java.security.AccessController.doPrivileged(Native Method)
java.security.AccessController.doPrivileged(Native Method)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.Thanks in advance,
vyrav.Thanks for ur reply Ganesh.
This is my JSP
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html:html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Uploaded File Details</title>
<script>
function logOut()
document.adminForm.action="upload.do?parameter=logout";
document.adminForm.submit();
function download(temp)
document.adminForm.fileId.value = temp;
document.adminForm.action="download.do";
document.adminForm.submit();
</script>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<table align="right">
<tr>
<td>
<a href="javascript:logOut();">Logout</a>
</td>
</tr>
</table>
<%
if(session.getAttribute("name")!=null)
String userName= (String) session.getAttribute("name");
%>
<br /><br /><b>Welcome <%=userName%></b><br />
<%
%>
<center>
<html:form action="/download.do" name="adminForm" type="com.roots.AdminForm">
<br /><br />
<html:hidden property="fileId"/>
<table align="center" border="1">
<tr bgcolor="#FFCC66">
<td align="center">
No
</td>
<td align="center">
Name
</td>
<td align="center">
Uploaded Date
</td>
<td align="center">
File Name
</td>
</tr>
<logic:iterate name="adminForm" property="displayList" id="displayDto">
<tr>
<td align="center">
<bean:write name="displayDto" property="serialNo"/>
</td>
<td align="left">
<bean:write name="displayDto" property="empName"/>
</td>
<td align="left">
<bean:write name="displayDto" property="uploadedDate"/>
</td>
<td align="left">
<a href="javascript:download('<bean:write name="displayDto" property="serialNo"/>');"><bean:write name="displayDto" property="fileName"/></a>
</td>
</tr>
</logic:iterate>
</table>
</html:form>
</center>
</body>
</html:html>This is my struts config
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<data-sources>
</data-sources>
<form-beans>
<form-bean name="loginForm" type="com.roots.LoginForm" />
<form-bean name="uploadForm" type="com.roots.UploadForm" />
<form-bean name="adminForm" type="com.roots.AdminForm" />
</form-beans>
<global-forwards></global-forwards>
<action-mappings>
<action path="/login"
name="loginForm"
scope="request"
validate="true"
input="/login.jsp"
type="com.roots.LoginAction" >
<forward name="SUCCESS" path="/upload.jsp" />
<forward name="FAILURE" path="/login.jsp" />
<forward name="ADMIN" path="/admin.do" />
</action>
<action path="/upload"
name="uploadForm"
scope="request"
parameter="parameter"
input="/upload.jsp"
type="com.roots.UploadAction" >
<forward name="SUCCESS" path="/upload.jsp" />
<forward name="FAILURE" path="/login.jsp" />
</action>
<action path="/download"
type="com.roots.FileDownloadAction">
</action>
<action path="/admin"
name="adminForm"
scope="request"
validate="false"
type="com.roots.AdminAction" >
<forward name="DISPLAY" path="/admin.jsp" />
<forward name="FAILURE" path="/login.jsp" />
</action>
</action-mappings>
<message-resources parameter="application_fr"/>
<message-resources parameter="application_es"/>
<message-resources parameter="application_en"/>
<message-resources parameter="application_de"/>
<message-resources parameter="application" />
</struts-config>this is my form package com.roots;
import java.util.List;
import org.apache.struts.action.ActionForm;
public class AdminForm extends ActionForm {
private List displayList = null;
public String fileId;
public String getFileId() {
return fileId;
public void setFileId(String fileId) {
this.fileId = fileId;
public List getDisplayList() {
return displayList;
public void setDisplayList(List displayList) {
this.displayList = displayList;
}Please let me know wat am doing wrong, this is killing me for the last two days.
Thanks,
vyrav. -
Run Time error!!!Help plz
hi ..
every time i run my application i get this error which i can't understand where exactly the error is
can any one help plz
)at javax.swing.JLayeredPane.paint(JLayeredPane.java:546
)at javax.swing.JComponent.paintChildren(JComponent.java:498
)at javax.swing.JComponent.paint(JComponent.java:669
)at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:23
:at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java
)54
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:91
)at java.awt.Container.paint(Container.java:960
)at javax.swing.JFrame.update(JFrame.java:329
)at sun.awt.RepaintArea.update(RepaintArea.java:337
)at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:200
)at java.awt.Component.dispatchEventImpl(Component.java:2663
)at java.awt.Container.dispatchEventImpl(Container.java:1213
)at java.awt.Window.dispatchEventImpl(Window.java:914
)at java.awt.Component.dispatchEvent(Component.java:2497
)at java.awt.EventQueue.dispatchEvent(EventQueue.java:339
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
)read.java:131
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
)ad.java:98
)at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93
)at java.awt.EventDispatchThread.run(EventDispatchThread.java:85
this is part of the code:
public void actionPerformed(ActionEvent e)
FileInputStream fis = null;
if (e.getSource() == add) //The ADD button.
//User has not populated all the input fields.
if(name.getText().equals("")|| address.getText().equals("")|| phone.getText().equals("")|| sex.getText().equals("")|| dob.getText().equals("")|| photo.getText().equals(""))
JOptionPane.showMessageDialog(null, "Please fill in all the fields","Missing Fields",JOptionPane.INFORMATION_MESSAGE);
else
// save the new customer:
try
//1. take the customer's data and photo:
int userId = Integer.parseInt(id.getText());
String userName = name.getText();
String userAddress = address.getText();
String userPhone = phone.getText();
String userSex = sex.getText();
String userDateBirth = dob.getText();
//String userDateBirth=Date.parse(dob);
String photoName = photo.getText();
String audioName= audio.getText();
File file = new File(photoName);
int fileLength = (int)file.length();
//2. Set the user's photo into the photoHolder:
photoHolder.setVisible(false);
photoHolder = null;
comments.setVisible(false);
comments = null;
Icon[] custPhotos = {new ImageIcon(photoName)};
JList photosList = new JList(custPhotos);
photosList.setFixedCellHeight(100);
photosList.setFixedCellWidth(80);
photoHolder = new JPanel();
photoHolder.add(photosList);
makeComments();
//3. Insert the data and photo into the database:
if(fileLength > 0)
fis = new FileInputStream(file);
String query = " INSERT INTO CUSTOMER VALUES('"+userId+"', '"+ userName+ "', '"+ userAddress+ "', " +" '"+ userPhone+ "', '"+ userSex+ "', '"+ userDateBirth+ "', ?,?,? ) ";
PreparedStatement pstmt = conn.prepareStatement(query);
pstmt.setBinaryStream(1, fis, fileLength);
pstmt.setString(2,photoName);
pstmt.setString(3,audioName);
pstmt.executeUpdate();
comments.setText(userName+", added.");
else
String query = " INSERT INTO CUSTOMER (id, name, address, phone, sex, dob) VALUES('"+userId+"', '"+userName+"', '"+userAddress+"', '"+userPhone+"', '"+userSex+"', '"+userDateBirth+"') ";
stat.executeUpdate(query);
comments.setText("Customer saved without a photo.");
backPanel.add(photoHolder);
backPanel.add(comments);
updateTable();
//AddScroll();
} //try
catch (Exception ee)
//The danger of putting creating the JOptionPane in here is that it will show the same message regardless of the error.
JOptionPane.showMessageDialog(null, "Customers CPR already exits!!Please enter another CPR","Invalid",JOptionPane.INFORMATION_MESSAGE);
System.out.println("Caught exception in add action: " + ee);
ee.printStackTrace();
} //catch
} //if
}//add buttonhi...
i got where the error is..
now i have another problem..
Connecting to database..
Valid Login
Caught updateTable exception: java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
at UtilityMethods.updateTable(UtilityMethods.java:305)
(which is this line:
tableData[currentRow] = fieldString;)-----> i did this because one of the fields will be a Date and the others are strings
at UtilityMethods.updateTable(UtilityMethods.java:429)
at Login.validLogin(Login.java:114)
at Login.actionPerformed(Login.java:80)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:14
50)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
ctButton.java:1504)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:378)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:216)
at java.awt.Component.processMouseEvent(Component.java:3715)
at java.awt.Component.processEvent(Component.java:3544)
at java.awt.Container.processEvent(Container.java:1164)
at java.awt.Component.dispatchEventImpl(Component.java:2593)
at java.awt.Container.dispatchEventImpl(Container.java:1213)
at java.awt.Component.dispatchEvent(Component.java:2497)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
at java.awt.Container.dispatchEventImpl(Container.java:1200)
at java.awt.Window.dispatchEventImpl(Window.java:914)
at java.awt.Component.dispatchEvent(Component.java:2497)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:131)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:98)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
this is the code :
void updateTable()
ResultSet results = null;
ResultSet results1 = null;
try
//Get the number of rows in the table so we know how big to make the data array..
int rowNumbers = 0;
int columnCount = 6;
results = stat.executeQuery("SELECT COUNT(*) FROM CUSTOMER ");
if(results.next())
rowNumbers = results.getInt(1);
} //if
if(rowNumbers == 0)
rowNumbers = 1;
tableData = new String[rowNumbers][columnCount];
//Initialize the data array with "" so we avoid possibly having nulls in it later..
for(int i =0;i<tableData.length;i++)
for(int j=0;j<tableData[0].length;j++)
tableData[i][j] = "";
//Populate the data array with results of the query on the database..
int currentRow = 0;
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
results1 = stat.executeQuery("SELECT * FROM CUSTOMER ORDER BY ID");
while (results1.next())
for(int i = 0; i < columnCount; i++){
Object field = results1.getObject(i + 1);
// actually this next line should be put outside your loop so you don't keep creating this object
// or whatever format you want
String fieldString;
if (field instanceof Date)
fieldString = sdf.format((Date) field);
else
fieldString = field.toString();
tableData[currentRow] = fieldString;
//tableData[currentRow][i] = results1.getString(i + 1);
currentRow++;
} //while
}//for
final String[] colName = { "CPR", "Name", "Address", "Phone", "Sex", "Date OF Birth" };
TableModel pageModel = new AbstractTableModel()
public int getColumnCount()
return tableData[0].length;
} //getColumnCount
public int getRowCount()
return tableData.length;
} //getRowCount
public Object getValueAt(int row, int col)
return tableData[row][col];
} //getValueAt
public String getColumnName(int column)
return colName[column];
} //getcolName
public Class getColumnClass(int col)
return getValueAt(0, col).getClass();
} //getColumnClass
public boolean isCellEditable(int row, int col)
return false;
} //isCellEditable
public void setValueAt(String aValue, int row, int column)
tableData[row][column] = aValue;
} //setValueAt
//dataTable.setValue( new JScrollBar(JScrollBar.HORIZONTAL), 2,1 );
}; //pageModel
//Create the JTable from the table model:
JTable dataTable = new JTable(pageModel);
// dataTable.setModel(); -
Im new to the 5g ipod help plz
will the ipod turn off if i leave it on pause? i know i have a really stupid question but help plz thx
Yes.
-
My Apple TV is not working. On tv display, I'm getting a message 'unsupported signal. Check your device output. ' Can anyone help plz.
connect it to a tv which support full hd and go into the settings and lower the resolution as much as possible and then connect it with your tv once more
-
I have just getting a new phone and I have forgot my password an Apple ID what I made new for the new phone now I cannot get on it because asking for id and password what should I do help plz thank u
Try
https://iforgot.apple.com -
my Ipad is not charging, it started after the battery died while i was playing a game, when i tried charging its only flashing the apple icon and it switches off again, help PLIIZ
Not charging
1. Reset iPad
2. Try another wall socket
3. Try another cable (make sure it's an original Apple cable)
4. Try another charger (make sure it's an original Apple charger)
5. Clean Lightning port with compress air or new paint brush -
i lost my phone and i got an unlocked 4s from my gf she used it before an its still connected to her icloud is there a way i can restore my icloud back up to replace hers without messing up the unlock also my latest backup isnt showing on my pc help plz!!
Please please help me, if you know how.
-
I cant get voice over to work on my 4G shuffle it clicks off every time help plz
i need help plz it wont work
Hello,
Welcome to Adobe Forums.
Try uninstalling Adobe Flash Player from Flash Player uninstaller : http://helpx.adobe.com/flash-player/kb/uninstall-flash-player-mac-os.html#main_uninstall
Try a clean installation using this KB : http://helpx.adobe.com/content/help/en/flash-player/kb/installation-problems-flash-player- mac.html
Thanks,
Vikram -
Help Plz.......!!!!its urgent
hi nokia users
flash lite on my 5530 only plays youtube videos,and when tried to play videos on other sites then it says flash player is required............do ui use any software that supports web videos...???
help plz.....
thanks in advanceFalshplayer vedio cant acces in your device?
-
help plz so my gf said she block me and we txt back to back but later on i sent her a messages and it said it was read so am I blocked
The proper way to close Firefox is through the File menu "Exit" or the equivalent with the Firefox button.
More detail in item '''#38 Firefox already running '''
of
[http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface Fix Firefox 4.0 toolbar user interface, problems (Make Firefox 4.0 look like 3.6) (#fx4interface)]
Firefox already running, to properly shutdown Firefox when closing the last window use File → Exit/Quit (or Firefox button → Exit). Closing Firefox with the [X] in the upper right corner closes the window ("Ctrl+W") but that does not necessarily close Firefox if it has subtasks running. If you want to close and reopen Firefox use the "Restart" within Add-ons if you made a change requiring a restart, or install "[https://addons.mozilla.org/firefox/addon/restartless-restart/ Restartless Restart]" ("Ctrl+Alt+R") which will allow you to take Firefox down and restart without having to check the Windows Task Manager to see if Firefox first actually ended. [http://kb.mozillazine.org/Firefox_hangs Firefox hangs]
Maybe you are looking for
-
Error: Document not found. (WWC-46000) while updating a form whit blob items
Hi all, I have to manage a table-based form. The table has a BLOB field that allows NULL. The blob field of the form is hidden. When I try to INSERT all works well but when I attempt to UPDATE I get "Error: Document not found. (WWC-46000)". Have you
-
How to handle sales forecast in OM? For comparative analysis, user wants to input sales forecast per item in terms of quantity and sales amount for them to be able to generate and view report regarding the following: 1) Comparative Report Forecast vs
-
Modifying alternate text for links / changing tags?
I found this page: http://help.adobe.com/en_US/Acrobat/9.0/Professional/WS58a04a822e3e50102bd615109794195ff-7 ce8.w.html But I don't quite understand it. I have links in my document that I need to be accessible. The above-referenced page talks abou
-
Mass Transfer Posting From Quality Stock to Return Stock with FI Effect
Dear Gurus, 1 Is there any way To do Transfer Posting At a stretch 1500 material list from Quality Stock to Returns Stock within a plant ?... 2 Effect of Financial Entries eg Cost ?.. Thanks & Regards Darvesh
-
I am streaming live video (CCTV set up) to iPod Touch. Is it possible to playback info (i.e. using iPod as a DVR?)