I'm trying to test setting a simple string value to my java bean's setter
method from the input of a JSP page.
Using the JSP set syntax and usebean to get a reference to my bean's setter
method, can I use response.encodeURL() to call the same current jsp and then
the same jsp calls the setter method on the bean, which then updates the
database?
I don't know if this is correct or not, but my example is not working. My
database should be fine and my java bean syntax/connection to db should be
fine. I just don't have the right syntax in my JSP page to submit the input
value to my bean - I think.
Thank you!
Here is my jsp code:
<!-- A JSP to test -->
<jsp:useBean id='happy' scope='page' class='examples.Test'
type='examples.TestIF' />
<html>
<head>
<title>Test Bean</title>
</head>
<FORM method="post" action=<% response.encodeURL("happy/setTest.jsp"); %> >
<INPUT type="text" name="fname" >
<jsp:setProperty name="happy" property="database" value="fname" />
<input type="submit">
</FORM>
</html>
Here is my error stack trace:
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL
Server]Invalid co
lumn name 'fname'.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:2494)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:314)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:
264)
at examples.Test.setDatabase(Test.java:92)
at java.lang.reflect.Method.invoke(Native Method)
______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets