Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2008

Tip: Looking for answers? Try searching our database.

JSP BEAN RETRIEVAL

Thread view: 
Vittorix - 09 Mar 2008 23:37 GMT
Again, I try to explain in a simpler way:

in a JSP page:

<%
   String bookBeanBeg;
   bookBeanBeg = "bookBeanBeg1";
%>

<jsp:useBean id="<%=bookBeanBeg%>"
   type="p4Solution.BookBean" scope="session" />
<jsp:getProperty name="<%=bookBeanBeg%>"
   property="shortDescription"/>

it doesn't work.

please help to make it work. I'm going crazy with it!

Signature

ciao
Vittorix

Vittorix - 10 Mar 2008 17:30 GMT
> in a JSP page:
>
[quoted text clipped - 9 lines]
>
> it doesn't work.

this could be helpful for somebody in the future, then I post it here:

because I couldn't find a solution, I'm using a scriplet inside the JSP that
does the job:

   int numBooks = Integer.parseInt(request.getParameter("numBook"));
   for (int i=1; i<=numBooks; i++)
   {
       String bookBeanS = "bookBeanBeg" + i + "";
       p4Solution.BookBean bookBean = null;
       bookBean = (p4Solution.BookBean) session.getAttribute(bookBeanS);
       out.write(bookBean.getSeq_no());
   }

Signature

ciao
Vittorix

Arne Vajhøj - 11 Mar 2008 02:07 GMT
> this could be helpful for somebody in the future, then I post it here:
>
[quoted text clipped - 9 lines]
>         out.write(bookBean.getSeq_no());
>     }

JSP pages with scriptlets with out.print/write should not
be able to pass code review.

Arne
Vittorix - 11 Mar 2008 04:04 GMT
>> because I couldn't find a solution, I'm using a scriplet inside the
>> JSP that does the job:
[quoted text clipped - 10 lines]
> JSP pages with scriptlets with out.print/write should not
> be able to pass code review.

what do you mean? it works great

Signature

ciao
Vittorix

Lew - 11 Mar 2008 05:54 GMT
> Arne Vajh�j wrote:
>
[quoted text clipped - 13 lines]
>
> what do you mean? it works great

He means that the presence of scriptlet in a JSP is a "bad" mark in a code
review.  It presents maintenance difficulties, and obviates the natural
separation of view artifacts from logic artifacts.  It also represents that
you left a bug unfixed, in that the <c:forEach> idiom should work, so from an
organizational standpoint that remains an open issue.

I have known a few people who had Marty Hall as a teacher.  He took off ten
points from an assignment submission for each line of scriptlet in a JSP.
<http://www.apl.jhu.edu/~hall/>

Signature

Lew

Vittorix - 11 Mar 2008 16:09 GMT
>> what do you mean? it works great
>
> He means that the presence of scriptlet in a JSP is a "bad" mark in a
> code review.  It presents maintenance difficulties, and obviates the
> natural separation of view artifacts from logic artifacts.

right. but I didn't find a solution, what I gotta do?

>  It also
> represents that you left a bug unfixed, in that the <c:forEach> idiom
> should work, so from an organizational standpoint that remains an
> open issue.

I agree. what do you suggest?

> I have known a few people who had Marty Hall as a teacher.  He took
> off ten points from an assignment submission for each line of
> scriptlet in a JSP. http://www.apl.jhu.edu/~hall/

too bad that he wants us to buy the second volume of his book to tell us how
a <c:forEach>. works...

Signature

ciao
Vittorix

Lew - 12 Mar 2008 01:25 GMT
Lew wrote:
>> I have known a few people who had Marty Hall as a teacher.  He took
>> off ten points from an assignment submission for each line of
>> scriptlet in a JSP. http://www.apl.jhu.edu/~hall/

> too bad that he wants us to buy the second volume of his book to tell us how
> a <c:forEach>. works...

It is my observation that Professor Hall is mighty good at promoting himself
and his products.

You can get an overview of the JSTL tags for free in the Sun Java EE tutorial.
 <c:forEach> is covered in:
<http://java.sun.com/javaee/5/docs/tutorial/doc/bnakh.html#bnakm>

Signature

Lew

Vittorix - 12 Mar 2008 03:11 GMT
>>> I have known a few people who had Marty Hall as a teacher.  He took
>>> off ten points from an assignment submission for each line of
>>> scriptlet in a JSP. http://www.apl.jhu.edu/~hall/

>> too bad that he wants us to buy the second volume of his book to
>> tell us how a <c:forEach>. works...

> It is my observation that Professor Hall is mighty good at promoting
> himself and his products.

and I reinforced it :)
however, his book is decent and the first volume is online for free.

> You can get an overview of the JSTL tags for free in the Sun Java EE
>  tutorial. <c:forEach> is covered in:
> <http://java.sun.com/javaee/5/docs/tutorial/doc/bnakh.html#bnakm>

thanks, I don't know why I tried the approach and nothing is shown in the
page.
I posted the code on another thread, if you like to see it.

Signature

ciao
Vittorix



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.