Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

HTTP ERROR: 500

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Im trying to process data from a form. I have java bean. And method call validata(). whicj check if any required field is empty.if it its then it send to retry.jsp page. Otherwise send to success.jsp. When i try to use it..it give me erroe saying
HTTP ERROR: 500 /jsp/ac/process.jsp(16,32) Attribute )% has no value
I dont know what is wrong here.
can someone help me here.
Here my code
Process.jsp
<%@ page import="java.util.*" %>
<%!
ResourceBundle bundle =null;
public void jspInit() {
bundle = ResourceBundle.getBundle("forms");
}
%>
<jsp:useBean id="formHandler" class="foo.FormBean" scope="request">
<jsp:setProperty name="formHandler" property="*"/>
</jsp:useBean>
<%
if (formHandler.validate()) {
%>
<jsp:forward page="sucess.jsp")%>"/>
<%
} else {
%>
<jsp:forward page="retry.jsp"/>
<%
}
%>
My bean code:
package foo;
import java.util.*;
public class FormBean {
private String userName;
private String password;
private String firstName;
private String lastName;
private String cName;
private String cAddress;
private String city;
private String state;
private String zipCode;
private String phone;
private String fax;
private String email;
private Hashtable errors;
public boolean validate() {
boolean allOk=true;
if (userName.equals("")) {
errors.put("userName","Please enter your User name");
userName="";
allOk=false;
}
if (password.equals("") ) {
errors.put("password","Please enter a valid password");
password="";
allOk=false;
}
if (firstName.equals("")) {
errors.put("firstName","Please enter your first name");
firstName="";
allOk=false;
}
if (lastName.equals("")) {
errors.put("lastName","Please enter your last name");
lastName="";
allOk=false;
}
if (cName.equals("")) {
errors.put("cName","Please enter your Company name");
cName="";
allOk=false;
}

if (cAddress.equals("")) {
errors.put("cAddress","Please enter your address");
cAdress="";
allOk=false;
}

if (city.equals("")) {
errors.put("city","Please enter your city name");
city="";
allOk=false;
}
if (state.equals("")) {
errors.put("state","Please enter your state name");
state="";
allOk=false;
}
if (zipCode.equals("") || zipCode.length() !=5 ) {
errors.put("zipCode","Please enter a valid zip code");
zipCode="";
allOk=false;
} else {
try {
int x = Integer.parseInt(zip);
} catch (NumberFormatException e) {
errors.put("zipCode","Please enter a valid zip code");
zipCode="";
allOk=false;
}
}
if (phone.equals("")) {
errors.put("phone","Please enter valid Phone number");
phone="";
allOk=false;
}
if (fax.equals("")) {
errors.put("fax","Please enter your fax number");
fax="";
allOk=false;
}
if (email.equals("") || (email.indexOf('@') == -1)) {
errors.put("email","Please enter a valid email address");
email="";
allOk=false;
}

return allOk;
}
public String getErrorMsg(String s) {
String errorMsg =(String)errors.get(s.trim());
return (errorMsg == null) ? "":errorMsg;
}
public FormBean() {
userName="";
password="";
firstName="";
lastName="";
cName="";
cAddress="";
city="";
state="";
zipCode="";
phone="";
fax="";
email="";
errors = new Hashtable();
}
public String getUserName() {
return userName;
}
public String getPassword() {
return password;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String getCName() {
return cName;
}
public String getCAddress() {
return cAddress;
}
public String getCity() {
return city;
}
public String get State() {
return state;
}
public String getZipCode() {
return zipCode;
}
public String getPhone() {
return phone;
}
public String getFax() {
return fax;
}
public String getEmail() {
return email;
}
public void setUserName(String u) {
userName=u;
}
public void setPassword(String p) {
password=p;
}
public void setFirstName(String fname) {
firstName =fname;
}
public void setLastName(String lname) {
lastName =lname;
}
public void setCName(String company) {
cName =company;
}
public void setCAddress(String address) {
cAddress =address;
}
public void setCity(String c) {
city =c;
}
public void setState(String s) {
state =s;
}
public void setZipCode(String z) {
zipCode=z;
}

public void setPhone(String ph) {
phone=ph;
}
public void setFax(String f) {
fax=f;
}
public void setEmail(String eml) {
email=eml;
}
public void setErrors(String key, String msg) {
errors.put(key,msg);
}
}

 
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Examine this line carefully.
hth,
bear
P.S. In future posts please be sure to enclose your code in the UBB code tags for easier reading.
[ March 18, 2003: Message edited by: Bear Bibeault ]
 
viral patel
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i found the problem..but thank for anyway
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic