Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Beans > Confused about ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 1331 of 1372
Post > Topic >>

Confused about setting up Bean

by Clive_S <cliveswan@[EMAIL PROTECTED] > Nov 26, 2007 at 02:37 AM

Hi,

I am confused about setting up the Bean to be called from jsp.

I want a bean called page1, called from page1.jsp with variables:
rfcoverten, rfcoverage, rfcoverflt.

Are the variables stored in the bean created in bean called page1.java
or stored in another file.
Is the Primary key set as a string not int??

I have a database connection file SqlDB.java that connects to the
page.
With a method(?) connect

public bollean connect() throws classNotFoundException, SQlException{
Class.forName(dbDriver);
dbcon = DriverManager.getConnection(dbURL);
return true;
}

In JSP I can call the 'method' by using a scriplet
<%
SqlDB.connect();
%>

How do I access the SqlDB.connect method in the bean to retrieve and
store
the information, so that I can retrieve it in the jsp

<!--page1.java
-->
public class page1{
	private string surID ="null";
	private int rfcoverten = 0;
 	private int rfcoverage = 0;
	private int rfcoverfl = 0;


	public  String getsurID(){
	return(getsurveyID)
	}

	public void setsurID(String surID){
	if (surID != null){
	    this.surID = surID;
	    }
	}

	public int getrfcoverten(){
	return(rfcoverten);
	}

	public void setrfcoverten(int rfcoverten){
	this.rfcoverten = rfcoverten
	}
}


<!-- page1.jsp
-->
<jsp:useBean id="page1" class="page1" />

<td><jsp:getProperty name="*" property="page1.rfcoverten"/> </td>
<td><jsp:getProperty name="*" property="page1.rfcoverage"/> </td>
<td><jsp:getProperty name="*" property="page1.rfcoverfl"/> </td>


<!-- end page1.jsp
-->
 




 3 Posts in Topic:
Confused about setting up Bean
Clive_S <cliveswan@[EM  2007-11-26 02:37:05 
Re: Confused about setting up Bean
Clive_S <cliveswan@[EM  2007-11-26 08:20:07 
Re: Confused about setting up Bean
Clive_S <cliveswan@[EM  2007-11-27 03:04:31 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 4:54:17 CDT 2008.