tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From August Detlefsen <augustd...@yahoo.com>
Subject Re: Writing a bean
Date Mon, 25 Feb 2002 18:15:39 GMT
You can't define methods inside regular scriptlet blocks <% ... %>. You
have to use a declaration block <%! ... %> for the printContent()
method. You may have to make the method static as well. 

-August



--- Uma Maheswar <help@globalleafs.com> wrote:
> Hi,
> I wanted to write a java bean inside my JSP programme. My requirement
> is like this
> 
> <%
> Connection con = (.........);
> statement = con.createStatement();
> request.getParameter(name);
> request.getParameter(phone);
> rs = st.executeQuery("select * from uma where name="+name);
> if(rs.next())
> {
>     out.println("name is present in db");
>     printContent();
> }
> else
> {
>     int x = st.executeUpdate(insert into uma
> values('"+name+"','"+phone+"');
> }
> %>
> <%
> public void printContent()
> {
>     I wanted to do some printing stuff here basically HTML coding.
> }
> %>
> 
> The printContent() method is giving me errors. I get Statement
> Expected near the above method. Can any one help me? If there is any
> other way could any one tell me what it is?
> 
> Uma
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message