Author |
Message |
h #1 / 15
|
 Why,Why,Why are javabeans completely ignored?
Trying to get what should such a simple thing to work - why is it with anything to do with Java takes 10 times longer than any other language? Anyway all I'm trying to do is get a JSP page to use a JavaBean. This page is sent from a servlet which DEFINETELY sets a session var called "app" with a valid filled object of type ceaApplication as part of a class called ceadwac. The JSP totally ignores this object & even using the setProperty (which I understand it should create a new object if it fails to find an existing one) method it still refuses to display anything n the getProperty method a few lines down. Viewing the source code from the browser (IE 5.5) shows these lines exactly as they ar in the source file. this is the jsp page -
<jsp:useBean id="app" class="ceadwac.ceaApplication" scope="session"/> <jsp:setProperty name="app" property="AppArea" value="test app area"/> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> <p>from here <jsp:getProperty name="app" property="AppArea"/> to here </p> <p> </p> </body> </html> This is the javabean class i.e package ceadwac; import java.io.Serializable; public class ceaApplication implements java.io.Serializable { private String appArea; public ceaApplication() { } public void setAreaName(String buf) { areaName = buf; } public String getAreaName() { return areaName; } Quote: }
Surely this should be so simple? Any ideas? thanks h
|
Thu, 04 Nov 2004 00:17:57 GMT |
|
 |
Virgil Gree #2 / 15
|
 Why,Why,Why are javabeans completely ignored?
Quote: > Trying to get what should such a simple thing to work - why is it with
anything to do with Java Quote: > takes 10 times longer than any other language? > Anyway all I'm trying to do is get a JSP page to use a JavaBean. This page
is sent from a servlet Quote: > which DEFINETELY sets a session var called "app" with a valid filled
object of type ceaApplication Quote: > as part of a class called ceadwac. The JSP totally ignores this object &
even using the setProperty Quote: > (which I understand it should create a new object if it fails to find an
existing one) method it Quote: > still refuses to display anything n the getProperty method a few lines
down. Viewing the source code Quote: > from the browser (IE 5.5) shows these lines exactly as they ar in the source file. > this is the jsp page -
import="java.sql.*"%> Quote: > <jsp:useBean id="app" class="ceadwac.ceaApplication" scope="session"/> > <jsp:setProperty name="app" property="AppArea" value="test app area"/>
If I read the code below properly, you should be using property="AreaName" because AreaName is the name of the property according to your get/set methods. There is no property called appArea, only a private instance variable by that name. Quote: > <html> > <head> > <title>Untitled Document</title> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> > </head> > <body bgcolor="#FFFFFF" text="#000000"> > <p>from here > <jsp:getProperty name="app" property="AppArea"/> > to here </p> > <p> </p> > </body> > </html> > This is the javabean class i.e > package ceadwac; > import java.io.Serializable; > public class ceaApplication implements java.io.Serializable > { > private String appArea; > public ceaApplication() > { > } > public void setAreaName(String buf) > { > areaName = buf; > } > public String getAreaName() > { > return areaName; > } > }
|
Thu, 04 Nov 2004 00:31:58 GMT |
|
 |
Virgil Gree #3 / 15
|
 Why,Why,Why are javabeans completely ignored?
Quote: > Trying to get what should such a simple thing to work - why is it with
anything to do with Java Quote: > takes 10 times longer than any other language? > Anyway all I'm trying to do is get a JSP page to use a JavaBean. This page
is sent from a servlet Quote: > which DEFINETELY sets a session var called "app" with a valid filled
object of type ceaApplication Quote: > as part of a class called ceadwac. The JSP totally ignores this object &
even using the setProperty Quote: > (which I understand it should create a new object if it fails to find an
existing one) method it Quote: > still refuses to display anything n the getProperty method a few lines
down. Viewing the source code Quote: > from the browser (IE 5.5) shows these lines exactly as they ar in the source file. > this is the jsp page -
import="java.sql.*"%> Quote: > <jsp:useBean id="app" class="ceadwac.ceaApplication" scope="session"/> > <jsp:setProperty name="app" property="AppArea" value="test app area"/> > <html> > <head> > <title>Untitled Document</title> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> > </head> > <body bgcolor="#FFFFFF" text="#000000"> > <p>from here > <jsp:getProperty name="app" property="AppArea"/> > to here </p> > <p> </p> > </body> > </html> > This is the javabean class i.e > package ceadwac; > import java.io.Serializable; > public class ceaApplication implements java.io.Serializable > { > private String appArea; > public ceaApplication() > { > } > public void setAreaName(String buf) > { > areaName = buf;
And I just noticed that you are attempting to set a variable called areaName here, but it isn't declared anywhere. You sould be setting appArea here (and returning it below). Did you post actual code? I can't see how this would compile... Quote: > } > public String getAreaName() > { > return areaName; > } > }
|
Thu, 04 Nov 2004 00:35:04 GMT |
|
 |
h #4 / 15
|
 Why,Why,Why are javabeans completely ignored?
Sorry, my fault the problem is still there - I was trying to put together an example but copied the wrong function in the post - they should have been - public void setAppArea(String buf) { appArea = buf; } public String getAppArea() { return appArea; }
|
Thu, 04 Nov 2004 00:36:53 GMT |
|
 |
Laurence #5 / 15
|
 Why,Why,Why are javabeans completely ignored?
Quote:
>Trying to get what should such a simple thing to work - why is it with anything to do with Java >takes 10 times longer than any other language?
Some things do take a lot longer to implement in Java, most are exactly the opposite... assuming you're trying to implement a non-trivial, modern system (incl. GUI, internationalization, advanced graphics, etc...) L. --- World-on-a-Disc, Interactive Map-Driven CD-ROMs Bursting with Photographs. http://www.worldonadisc.com
|
Thu, 04 Nov 2004 01:16:04 GMT |
|
 |
Hywel Jenkin #6 / 15
|
 Why,Why,Why are javabeans completely ignored?
says... Quote: > Trying to get what should such a simple thing to work - why is it with anything to do with Java > takes 10 times longer than any other language? > Anyway all I'm trying to do is get a JSP page to use a JavaBean.
So you post JavaScript and VB groups? Any particular reason? -- Hywel Never knowingly understood WSWIP http://hyweljenkins.co.uk/ MicroFAQ http://hyweljenkins.co.uk/mfaq.php
|
Thu, 04 Nov 2004 01:24:21 GMT |
|
 |
Virgil Gree #7 / 15
|
 Why,Why,Why are javabeans completely ignored?
This seemed interesting... don't know if it will help since the value of "true" is the default: ============ session - You can use the Bean from any JSP page in the same session as the JSP page that created the Bean. The Bean exists across the entire session, and any page that participates in the session can use it. The page in which
============ - Virgil
Quote: > Trying to get what should such a simple thing to work - why is it with
anything to do with Java Quote: > takes 10 times longer than any other language? > Anyway all I'm trying to do is get a JSP page to use a JavaBean. This page
is sent from a servlet Quote: > which DEFINETELY sets a session var called "app" with a valid filled
object of type ceaApplication Quote: > as part of a class called ceadwac. The JSP totally ignores this object &
even using the setProperty Quote: > (which I understand it should create a new object if it fails to find an
existing one) method it Quote: > still refuses to display anything n the getProperty method a few lines
down. Viewing the source code Quote: > from the browser (IE 5.5) shows these lines exactly as they ar in the source file. > this is the jsp page -
import="java.sql.*"%> Quote: > <jsp:useBean id="app" class="ceadwac.ceaApplication" scope="session"/> > <jsp:setProperty name="app" property="AppArea" value="test app area"/> > <html> > <head> > <title>Untitled Document</title> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> > </head> > <body bgcolor="#FFFFFF" text="#000000"> > <p>from here > <jsp:getProperty name="app" property="AppArea"/> > to here </p> > <p> </p> > </body> > </html> > This is the javabean class i.e > package ceadwac; > import java.io.Serializable; > public class ceaApplication implements java.io.Serializable > { > private String appArea; > public ceaApplication() > { > } > public void setAreaName(String buf) > { > areaName = buf; > } > public String getAreaName() > { > return areaName; > } > } > Surely this should be so simple? > Any ideas? > thanks > h
|
Thu, 04 Nov 2004 01:45:52 GMT |
|
 |
M Serie #8 / 15
|
 Why,Why,Why are javabeans completely ignored?
"Viewing the source code from the browser (IE 5.5) shows these lines exactly as they ar in the source file" The browser should receive the HTML *after* it has been processed by the JSP engine, i.e. it should not receive the jsp: tags, sounds like a configuration issue with the server and its not processing the JSPs. Do any JSPs work ? Did any samples come with the webserver/JSP engine ? Do they work ? What do the logs say ?
Quote: > Trying to get what should such a simple thing to work - why is it with
anything to do with Java Quote: > takes 10 times longer than any other language? > Anyway all I'm trying to do is get a JSP page to use a JavaBean. This page
is sent from a servlet Quote: > which DEFINETELY sets a session var called "app" with a valid filled
object of type ceaApplication Quote: > as part of a class called ceadwac. The JSP totally ignores this object &
even using the setProperty Quote: > (which I understand it should create a new object if it fails to find an
existing one) method it Quote: > still refuses to display anything n the getProperty method a few lines
down. Viewing the source code Quote: > from the browser (IE 5.5) shows these lines exactly as they ar in the source file. > this is the jsp page -
import="java.sql.*"%> Quote: > <jsp:useBean id="app" class="ceadwac.ceaApplication" scope="session"/> > <jsp:setProperty name="app" property="AppArea" value="test app area"/> > <html> > <head> > <title>Untitled Document</title> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> > </head> > <body bgcolor="#FFFFFF" text="#000000"> > <p>from here > <jsp:getProperty name="app" property="AppArea"/> > to here </p> > <p> </p> > </body> > </html> > This is the javabean class i.e > package ceadwac; > import java.io.Serializable; > public class ceaApplication implements java.io.Serializable > { > private String appArea; > public ceaApplication() > { > } > public void setAreaName(String buf) > { > areaName = buf; > } > public String getAreaName() > { > return areaName; > } > } > Surely this should be so simple? > Any ideas? > thanks > h
|
Thu, 04 Nov 2004 01:54:56 GMT |
|
 |
h #9 / 15
|
 Why,Why,Why are javabeans completely ignored?
Thanks for answering, I'm using Weblogic 5.1 (sp7). Even the simple code below doesn't produce anything - not even any errors! <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript"> </head> <body> <% out.println(" a test message"); %> </body> </html> Not too aufait with the intricacies of WL 5 - is there anything you can think of to point me in the right direction? thanks in advance h
|
Thu, 04 Nov 2004 02:35:19 GMT |
|
 |
h #10 / 15
|
 Why,Why,Why are javabeans completely ignored?
M Series, you are a god damm hero! Had a closer look at my weblogic.properties file (which I copied from another app & commented out all the bits I didn't need) - guess what I commented out that I shouldn't - a certain line - weblogic.httpd.register.*.jsp= weblogic.servlet.JSPServlet Thanks once again to everyone who answered - 6hrs I wasted on that, what a lesson learned - but yippeeee I'm off to the pub a very happy bunny! h Quote:
>"Viewing the source code >from the browser (IE 5.5) shows these lines exactly as they ar in the source >file" >The browser should receive the HTML *after* it has been processed by the JSP >engine, i.e. it should not receive the jsp: tags, sounds like a >configuration issue with the server and its not processing the JSPs. Do any >JSPs work ? Did any samples come with the webserver/JSP engine ? Do they >work ? What do the logs say ?
>> Trying to get what should such a simple thing to work - why is it with >anything to do with Java >> takes 10 times longer than any other language? >> Anyway all I'm trying to do is get a JSP page to use a JavaBean. This page >is sent from a servlet >> which DEFINETELY sets a session var called "app" with a valid filled >object of type ceaApplication >> as part of a class called ceadwac. The JSP totally ignores this object & >even using the setProperty >> (which I understand it should create a new object if it fails to find an >existing one) method it >> still refuses to display anything n the getProperty method a few lines >down. Viewing the source code >> from the browser (IE 5.5) shows these lines exactly as they ar in the >source file. >> this is the jsp page -
>import="java.sql.*"%> >> <jsp:useBean id="app" class="ceadwac.ceaApplication" scope="session"/> >> <jsp:setProperty name="app" property="AppArea" value="test app area"/> >> <html> >> <head> >> <title>Untitled Document</title> >> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> >> </head> >> <body bgcolor="#FFFFFF" text="#000000"> >> <p>from here >> <jsp:getProperty name="app" property="AppArea"/> >> to here </p> >> <p> </p> >> </body> >> </html> >> This is the javabean class i.e >> package ceadwac; >> import java.io.Serializable; >> public class ceaApplication implements java.io.Serializable >> { >> private String appArea; >> public ceaApplication() >> { >> } >> public void setAreaName(String buf) >> { >> areaName = buf; >> } >> public String getAreaName() >> { >> return areaName; >> } >> } >> Surely this should be so simple? >> Any ideas? >> thanks >> h
|
Thu, 04 Nov 2004 02:51:16 GMT |
|
 |
Kenny Chaffi #11 / 15
|
 Why,Why,Why are javabeans completely ignored?
says... Quote: > M Series, you are a god damm hero! > Had a closer look at my weblogic.properties file (which I copied from another app & commented out > all the bits I didn't need) - guess what I commented out that I shouldn't - a certain line - > weblogic.httpd.register.*.jsp= weblogic.servlet.JSPServlet > Thanks once again to everyone who answered - 6hrs I wasted on that, what a lesson learned - but > yippeeee I'm off to the pub a very happy bunny! > h
> >"Viewing the source code > >from the browser (IE 5.5) shows these lines exactly as they ar in the source > >file" > >The browser should receive the HTML *after* it has been processed by the JSP > >engine, i.e. it should not receive the jsp: tags, sounds like a > >configuration issue with the server and its not processing the JSPs. Do any > >JSPs work ? Did any samples come with the webserver/JSP engine ? Do they > >work ? What do the logs say ?
> >> Trying to get what should such a simple thing to work - why is it with > >anything to do with Java > >> takes 10 times longer than any other language? > >> Anyway all I'm trying to do is get a JSP page to use a JavaBean. This page > >is sent from a servlet > >> which DEFINETELY sets a session var called "app" with a valid filled > >object of type ceaApplication > >> as part of a class called ceadwac. The JSP totally ignores this object & > >even using the setProperty > >> (which I understand it should create a new object if it fails to find an > >existing one) method it > >> still refuses to display anything n the getProperty method a few lines > >down. Viewing the source code > >> from the browser (IE 5.5) shows these lines exactly as they ar in the > >source file. > >> this is the jsp page -
> >import="java.sql.*"%> > >> <jsp:useBean id="app" class="ceadwac.ceaApplication" scope="session"/> > >> <jsp:setProperty name="app" property="AppArea" value="test app area"/> > >> <html> > >> <head> > >> <title>Untitled Document</title> > >> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> > >> </head> > >> <body bgcolor="#FFFFFF" text="#000000"> > >> <p>from here > >> <jsp:getProperty name="app" property="AppArea"/> > >> to here </p> > >> <p> </p> > >> </body> > >> </html> > >> This is the javabean class i.e > >> package ceadwac; > >> import java.io.Serializable; > >> public class ceaApplication implements java.io.Serializable > >> { > >> private String appArea; > >> public ceaApplication() > >> { > >> } > >> public void setAreaName(String buf) > >> { > >> areaName = buf; > >> } > >> public String getAreaName() > >> { > >> return areaName; > >> } > >> } > >> Surely this should be so simple? > >> Any ideas? > >> thanks > >> h
Hmmmmm, java problem eh? <grin> KAC -- Kenny A. Chaffin KAC Website Design - http://www.kacweb.com Custom/Contract Programming, Graphics, Design Poetry Page: http://www.kacweb.com/poems/
|
Sat, 06 Nov 2004 18:38:54 GMT |
|
 |
Darryl L. Pierc #12 / 15
|
 Why,Why,Why are javabeans completely ignored?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Quote:
> Trying to get what should such a simple thing to work - why is it with anything to do with Java > takes 10 times longer than any other language?
Probably because you've not quite grasped the subject matter, yet. No offense, but it'll get easier as you get more familiar with it. Quote: > <jsp:getProperty name="app" property="AppArea"/>
The mistake you've made is thinking that AppArea is the property. Beans base their properties on the names of the get/set/is method. In your bean's case, the property name is AreaName. So, firstly, you'd want to do: <jsp:getProperty name="app" property="AreaName" /> Secondly, why not simplify the above and just use a scriptlet? <% app.getAreaName() %> This would be, for me at least, a bit more Java-ish. But, this piece is purely opinion. Your example is more HTML-ish. Probably ideal would be to, instead, create a custom tag so that it's completely HTML-style. - -- /**
*/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD4DBQE86t3t6LwNshk1tGERAsZOAJjCYef7yIu0eS8eqcdBU3wF0yjoAJ9STxyC WMpI8SXBSWFXmQ2Ueda6uw== =uSil -----END PGP SIGNATURE-----
|
Sun, 07 Nov 2004 07:53:22 GMT |
|
 |
Omar Rizwa #13 / 15
|
 Why,Why,Why are javabeans completely ignored?
Why is this in the VB controls newsgroup? -- Omar
Quote: > Trying to get what should such a simple thing to work - why is it with
anything to do with Java Quote: > takes 10 times longer than any other language? > Anyway all I'm trying to do is get a JSP page to use a JavaBean. This page
is sent from a servlet Quote: > which DEFINETELY sets a session var called "app" with a valid filled
object of type ceaApplication Quote: > as part of a class called ceadwac. The JSP totally ignores this object &
even using the setProperty Quote: > (which I understand it should create a new object if it fails to find an
existing one) method it Quote: > still refuses to display anything n the getProperty method a few lines
down. Viewing the source code Quote: > from the browser (IE 5.5) shows these lines exactly as they ar in the source file. > this is the jsp page -
import="java.sql.*"%> Quote: > <jsp:useBean id="app" class="ceadwac.ceaApplication" scope="session"/> > <jsp:setProperty name="app" property="AppArea" value="test app area"/> > <html> > <head> > <title>Untitled Document</title> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> > </head> > <body bgcolor="#FFFFFF" text="#000000"> > <p>from here > <jsp:getProperty name="app" property="AppArea"/> > to here </p> > <p> </p> > </body> > </html> > This is the javabean class i.e > package ceadwac; > import java.io.Serializable; > public class ceaApplication implements java.io.Serializable > { > private String appArea; > public ceaApplication() > { > } > public void setAreaName(String buf) > { > areaName = buf; > } > public String getAreaName() > { > return areaName; > } > } > Surely this should be so simple? > Any ideas? > thanks > h
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.363 / Virus Database: 201 - Release Date: 6/22/2002
|
Thu, 11 Nov 2004 03:58:23 GMT |
|
 |
Omar Rizwa #14 / 15
|
 Why,Why,Why are javabeans completely ignored?
Well, it isn't a control. -- Omar
Quote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1
> > Why is this in the VB controls newsgroup? > Probably to annoy you... ;) > - -- > /**
> */ > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.0.6 (GNU/Linux) > Comment: For info see http://www.gnupg.org > iD8DBQE88+FB6LwNshk1tGERAvueAJ92a93Fm9Qq1wtopJDF2kcCGzaUNgCfahWK > 7ZgFhobTu8ol8uEj3SXet0I= > =aw/y > -----END PGP SIGNATURE-----
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.363 / Virus Database: 201 - Release Date: 5/22/2002
|
Sun, 14 Nov 2004 04:47:32 GMT |
|
 |
Darryl L. Pierc #15 / 15
|
 Why,Why,Why are javabeans completely ignored?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Quote:
>> > Why is this in the VB controls newsgroup? >> Probably to annoy you... ;) > [quote moved to bottom of message where it belongs] > Well, it isn't a control.
It made you respond, so it's pretty controlling... - -- /**
*/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE89VgX6LwNshk1tGERAhT7AKCAKgO9mwh4rE3STyibIXBIlSdXFwCgyPIb KcOS6TYPSe2HW7TyisQbpUM= =CE31 -----END PGP SIGNATURE-----
|
Mon, 15 Nov 2004 06:37:11 GMT |
|
|