James Skehan wrote:

> Hi,
>
> I'm new to JSP and I'm having difficulty with the following:
> First of all, I can't compile the jsp page because my use of the 'class'
> parameter in the useBean tag is incorrect and the getProperty use is also
> incorrect.
> Could someone point me in the right direction?
>
> Html Login ->
>  servlet validation ->
>   Jsp page(containing various servlet hyperlink options) ->
>    more jsp pages(depending on hyperlink clicked)
>
> Rightly or wrongly I'm putting the id (which comes from the initial login
> page) into a session. (through the validation servlet)
> <% String l_id = (String)session.getValue("f_id");%>
>
> (As you can guess, I'm new to JSP!)
> I want to create a bean something like this, the java class takes the id as
> a parameter.
>
> This code is on one of the pages after I click on one of the hyperlink
> options.
> <%@ page import="Package.className(l_id)" %>
> <jsp:useBean id="CFBean" scope="request" class="Package.className(l_id)" />
> <jsp:setProperty name="CFBean" property="*" />
>
> The jsp page will contain numerous input boxes which I want to 'fill' by
> reading their values from a file as the page is compiled.
>
> if(request.getParameter("f_number1") != null)
> {
>  <input type="text" name="f_number1" value=<%=<jsp:getProperty name="CFBean"
> property="f_number1" />%;>>
> }
>
> Thanks
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html

Hi,
    I don't know about you but I've never seen a classname/package name that
looked like a function before ;-)
 put

<%@ page import="Package.className" %>
<jsp:useBean id="CFBean" scope="request" class="Package.className" />
<jsp:setProperty name="CFBean" property="*" />
</jsp:useBean>

at the top of your JSP page
then you could do a

  <% String l_id = (String)session.getValue("f_id");
      CFBean.setSession(l_id);
  %>

This is prividing that your bean has a setSession(String id) method.
remember that beans should not have a constructor that takes parameters.

Karl

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to