• 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:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Setting up directory structure for Bean Component in JSP

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
want to try out a simple JSP example that uses beans. The code is
given below . What I don't understand is where do I have to put these files. I have configure Bean in Web.xml file .I guess the file I have really doubts about is StringBean.java which is the bean file. I tried putting all in
C:\tomcat4\webapps\webdir\WEB-INF\classes but nothing seems to work. I
keep getting this error:

org.apache.jasper.JasperException: Unable to compile class for JSP

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 15 in the jsp file: /StringBean.jsp
Generated servlet error:
F:\naveen\Tomcat 5.0\work\Catalina\localhost\JspBean\org\apache\jsp\StringBean_jsp.java:56: cannot find symbol
symbol : class StringBean
location: class org.apache.jsp.StringBean_jsp
StringBean stringBean = null;
^

So can someone help me determine the correct directory structure and
where to put files. Thanks.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Using Java BEAN With JSP</TITLE>
</HEAD>
<BODY>

<TABLE BORDER=5 ALIGN="center">
<TR><TH CLASS="TITLE">
Using Java BEAN With JSP</TABLE>
<jsp:useBean id="stringBean" class="StringBean"/>

<OL>
<LI>Initial Value:
<I><jsp:getProperty name="stringBean"
property="message"/></I>
<LI>Initial value from jsp expression:
<I><%= stringBean.getMessage()%><I/>
<LI><jsp:setProperty name="stringBean"
property="message"
value="Best string Bean"/>
value after setting property:
<I><jsp:getProperty name="stringBean"
property="message"/>
<LI><% stringBean.setMessage("my favourite");%>
value after setting property with scriptlet:
<I><%=stringBean.getMessage()%></I>
</OL>
</BODY>
</HTML>


JSP bean:

public class StringBean {
private String message = "No message specified";

public String getMessage() {
return(message);
}

public void setMessage(String message) {
this.message = message;
}
}


Help Me..
waiting for repply
 
Sheriff
Posts: 67752
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
The JSP FAQ covers this issue, was it not helpful?
 
naveen jayant
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear!
I got solution..
bye
 
Liar, liar, pants on fire! refreshing plug:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic