Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
|
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 9th, 2006, 09:35 AM
Registered User
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kousik
Default what wrong with thi code(Jsp:useBean)

hi every body Iam unable run the program.plz help me.When I give request it says comilation error :- canot resolve symbol
codeS:
bean.html
------------------
<HTML><HEAD>
<TITLE> New Document </TITLE>
<BODY bhcolor = pink>
<form method=post action="bean.jsp">
<p>Plz enter u r Name:
<input type="text" name="name">
<br>What is u r favorite language?
<select name="language">
<option value= "c"> C
<option value= "c++"> C++
<option value= "Java"> Java
</select></p>
<input type="submit" Value ="Submit Value"></BODY>
</HTML>
bean.jsp:
------------------
<jsp:useBean id="languageBean" scope="page" class="LanguageBean">
<jsp:setProperty name="languageBean" property="*">
</jsp:useBean>
<html><head><title>UseBean Action test</title>
<body bgcolor=yellow>
<p>Hello,<jsp:getProperty name="languageBean" property="name" /></p>
<p>Your Favorite Language is:
<jsp:getProperty name="languageBean" property="language" /></p>
<p>My coment on this Language is:
<jsp:getProperty name="languageBean" property="languageComent" /></p>
</body></html>
LanguageBean:
-------------------
 public class LanguageBean
{
    private String name;
    private String language;
    public LanguageBean(){ }
    public void setName(String name) {
        this.name=name;
        }
        public String getName(){
            return name;
        }
    public void setLanguage(String language){
        this.language=language;
        }

        public String getLanguage() {
            return language;
            }
            public String getLanguageComent() {
                if (language.equals("c")){
                    return "The Mother of all Language";
                    }
                    else if(language.equals("c++")){
                    return "The king of OO Language";
                    }
                    else if(language.equals("Java")){
                    return "The Powerful Language for OO";
                    }
                    else
                {
                        return "Sorry I have no idea about this language";
                }
            }
}


 
Old March 10th, 2006, 06:21 AM
Authorized User
 
Join Date: Jan 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to longjava
Default

In your bean.jsp file, replace the line:

<jsp:setProperty name="languageBean" property="*">

with <jsp:setProperty name="languageBean" property="*"/>






Similar Threads
Thread Thread Starter Forum Replies Last Post
jsp:useBean and ArrayList IronStar JSP Basics 1 October 30th, 2008 04:32 AM
<jsp:useBean> action problem austinf JSP Basics 1 August 21st, 2006 04:23 PM
What is wrong with code? rtr1900 Classic ASP Databases 1 April 3rd, 2006 03:20 AM
Please Help. mr_newreq.jsp:78: jsp:useBean can't f batken JSP Basics 0 February 22nd, 2006 09:56 PM
What is wrong with this code? SaharaWizard VB Databases Basics 2 January 28th, 2006 08:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.