NEWBIE SUPER EASY JSP / BEAN

With about half a dozen books sitting around my desk, I can't get a REAL basic jsp to work. I FINALLY got tomcat to NOT give run time errors, however the web page simply outputs "This is output:" I know I am an idiot, but this JSP / bean stuff is upsetting. Any help on the following code would be great.
basic.jsp is as follows:
<jsp:useBean id="myBean" class="basic.basicbean" scope="session"/>
<html>
<head>
<title>
A Simple JSP
</title>
</head>
<body>
<%
myBean.setBasicName("Michelle");
%>
This is output: <% myBean.getBasicName();%>
</body>
</html>
basicbean.java is as follows:
package basic;
import java.beans.*;
public class basicbean {
private String BasicName=null;
/** Creates new basicbean */
public basicbean() {}
public String getBasicName() {
return this.BasicName;
public void setBasicName(String value) {
this.BasicName = value;
Made the .java into the class put it in the basic directory under the classes/basic directory of the WEB-INF. The JSP page loads, but only output is: "This is output:" I am using Tomcat as the JSP server. "Core JSP" "Core Servlets and JavaServer Pages" "Advanced JavaServer Pages" "JSP, Servlets, and MySQL", and "Java Server Pages for Dummies" and I still can't get it. Thanks for helping out an idiot.
-Jim

You are very close; just a small error in the line:
This is output: <% myBean.getBasicName();%>
The problem is your just simply calling the method and tossing the return value. You have three ways of outputing the bean property:
This is output: <% out.print(myBean.getBasicName();%>
or
This is output: <%=myBean.getBasicName()%>
or
This is output: <jsp:getProperty name="myBean" property="BasicName" />
If you use the <jsp:getProperty> approach, then you must have a <jsp:useBean> somewhere above the getProperty tag.
- Chris

Similar Messages

  • Prob with running jsp Bean

    Hi,
    I am trying to run a bean through a jsp but its giving error at useBean tag of jsp:
    The error is :
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: /Quadratic.jsp(7,0) The value for the useBean class attribute com.brainysoftware.Quadratic is invalid.
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:150)
         org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1227)
         org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         org.apache.jasper.compiler.Generator.generate(Generator.java:3272)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:244)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    My jsp is:
    <HTML>
    <HEAD>
    <TITLE> JSP BEAN Quadratic Example </TITLE>
    </HEAD>
    <BODY>
    <%@ page language="java" %>
    <jsp:useBean id="quadratic" scope="session" class="com.brainysoftware.Quadratic" />
    <jsp:setProperty name="quadratic" property="ia" param="a" />
    <jsp:setProperty name="quadratic" property="ib" param="b" />
    <jsp:setProperty name="quadratic" property="ic" param="c" />
    X1= <%= quad.getDx1( ) %>
    X2= <%= quad.getDx2( ) %>
    End of program
    </BODY>
    </HTML>my bean is:
    package com.brainysoftware;
    import java.io.*;
    class Quadratic{
    int ia;
    int ib;
    int ic;
    String dx1;
    String dx2;
    public int getIa( ) {
    return ia;
    public void setIa( int ii) {
    ia=ii;
    public int getIb( ) {
    return ib;
    public void setIb(int ii) {
    ib=ii;
    public int getIc( ) {
    return ic;
    public void setIc(int ii) {
    ic=ii;
    public String getDx1( ) {
    double detA;
    double result;
    detA= ib*ib -4*ia*ic;
    if(detA<0.0)
    return "Real Roots not possible";
    else {
    result= -ib - Math.sqrt(detA/(2 * ia));
    Double Dresult=new Double (result);
    return Dresult.toString( );
    public String getDx2( ) {
    double detA;
    double result;
    detA= ib*ib -4*ia*ic;
    if(detA<0.0)
    return "Real Roots not possible";
    else {
    result= -ib + Math.sqrt(detA/(2 * ia));
    Double Dresult=new Double (result);
    return Dresult.toString( );
    my directory structure is given below:
    C:\tomcat-5.0.28\jakarta-tomcat-5.0.28\webapps\jsp-examples\WEB-INF\classes\com\
    brainysoftware>dir
    Volume in drive C has no label.
    Volume Serial Number is 4C50-9542
    Directory of C:\tomcat-5.0.28\jakarta-tomcat-5.0.28\webapps\jsp-examples\WEB-IN
    F\classes\com\brainysoftware
    05/22/2005 11:15 PM <DIR> .
    05/22/2005 11:15 PM <DIR> ..
    05/22/2005 11:18 PM 134 CalculatorBean.java
    05/23/2005 12:12 AM 216 Counter.java
    05/24/2005 10:48 PM 358 SimpleJavaBean.java
    06/14/2005 11:16 PM 1,205 Calculator.java
    06/14/2005 11:16 PM 1,323 Calculator.class
    06/16/2005 06:44 PM 534 CalculatorBean2.java
    06/17/2005 08:53 AM 703 CalculatorBean2.class
    06/16/2005 07:00 PM 352 CalculatorBean2.html
    06/17/2005 08:51 AM 588 CalculatorBean2.jsp
    06/17/2005 04:29 PM 97 UploadBean.java
    06/17/2005 04:43 PM 527 FileUploadBean.java
    06/17/2005 04:43 PM 834 FileUploadBean.class
    06/18/2005 12:21 PM 863 Quadratic.java
    06/18/2005 12:21 PM 1,093 Quadratic.class
    14 File(s) 8,827 bytes
    2 Dir(s) 8,615,821,312 bytes free
    C:\tomcat-5.0.28\jakarta-tomcat-5.0.28\webapps\jsp-examples\WEB-INF\classes\com\
    brainysoftware>
    The above clearly shows the presence of Bean in the reqd directory but still I am getting an error. Can somebody help me:
    Zulfi.

    class QuadraticThe class is not public. It is only visible to other classes in the same package as itself, so the servlet (JSP) trying to instantiate and reference it can't see it.
    Make it public.

  • Redundant information in JSP bean action

    Class Person:
    public class Person{
    private String name;
    public void setName(String p){
    name=p;
    public String getName(){
    return name;
    }Code in servlet:
    public void doPost(HTTPServletRequest request, HTTPServletResponse response) throws IOException,ServletException{
    foo.Person p= new foo.Person();
    p.setName("New Guy");
    request.setAttribute("person",p);
    RequestDispatcher view = request.getRequestDispatcher("result.jsp");
    view.forward(request,response);
    }Code in JSP:
    <jsp:useBean id="person" class="foo.Person" scope="request">This jsp:useBean tag really is confusing. Why does it need to declare the class="foo.Person"? Why does the JSP need to know that "person" instance is derived from class foo.Person ? (I wonder if I changed this to foo.person --> not Person will result in error). Doesn't the statement request.setAttribute("person",p) from the servlet give enough info already to the JSP? thanks

    The "person" in your servlet has nothing to do with your "person" in your JSP bean tag.

  • Create jsp/bean webapp deploy fine...  add JSTL library wont deploy!

    winxp
    SJSE8
    PROBLEM:
    Using the new project wizard, I create a simple jsp/bean webapp using the embedded tomcat 5.5.7 as server... It deploys and runs with now issue
    Then, I right-click on project name (in project tree)... click properties... add library... select "JSTL 1.1".... do clean/build.... do deploy - which fails!
    message is: "Failed to deploy application at context path /bcd" (where bcd is my project name)
    Why does this happen?
    --------------simple app---------------
    ***jsp1.jsp****
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
        </head>
        <body>
        <h1>JSP Page</h1>
        <h1>get stuff JSP Page</h1>
        <jsp:useBean id="a" class="bcdpkg.IndexBean" scope="request"/>
        <h3>after1...</h3>
        <!--jsp:setProperty name="a" property="stuff" value="xxx" /-->
        <jsp:getProperty name="a" property="stuff" />
        </body>
    </html>***IndexBean.java***
    package bcdpkg;
    public class IndexBean
        /** Creates a new instance of IndexBean */
        public IndexBean()
        private String stuff = "this is stuff";
        public String getStuff()
            return this.stuff;
        public void setStuff(String s)
            this.stuff = s;
    }

    well.... I restarted SJSE8 (and tomcat 5.5.7) and now I can right-click on the project and click deploy...successfully.
    (Apologies for the "hair trigger" posting)
    I'll reply once more if it happens again.
    thanx

  • Redirect from jsp bean to jsp or html page

    I am facing a problem in redirecting to a jsp page from jsp bean
    How do i redirect from jsp bean to any other page like jsp or html.
    [email protected]

    Hi
    The solution you suggested we tried it long before only but it is not feasible for us as we have to implement it in all web pages which are in thousands.
    My need is like this.
    We have given specific time to each of our registered user , as user logs to our portal we calculate session time in bean and as he logs out is new time gets updated. (its like dial up connection)
    Now what happens consider user has left only 10 minutes balance, I can calculate and keep track for his time in bean.Now as the time becomes zero I want to redirect him to home page.
    As u said i can get return value zero for bean and can do it ,but our webpages are near about thousands.

  • Javascript array / jsp Bean Collection

    How can you fill a javascript array with the values of the collection?
    <jsp:useBean id="programs" scope="request" class="java.util.Collection"/>
      How can I create this array?
    <script language="JavaScript" type="text/javascript">
    var programData =
    new Array ( new Array "${programs[1].programId}","${programs[1].programName}", "${programs[1].department}"),  
                 new Array "${programs[2].programId}","${programs[2].programName}", "${programs[2].department}"),
    </script>

    I answered myself. If anyone else would like to know how to fill a javascript array with the values of a jsp beans collection.
    function collectionToArray()
    Array[rows] = [4];  
    var cnt = 0;
    <c:forEach var="sp" items="${programs}">
      rows[cnt][0] = ${sp.programId};
      rows[cnt][1] = ${sp.programName};
      rows[cnt][2] = ${sp.department};
      rows[cnt][3] = ${sp.urlLink1};
      rows[cnt][4] = ${sp.urlLink2};
      cnt++;
    </c:forEach>  
    }

  • Newbie - JSP & bean shopping cart logic error?

    Hello,
    I am attempting to bulid a shopping cart facility on a JSP site that I am building.
    I am having difficulties adding an item to the basket.
    The page below (bookDetail.jsp) displays items for sale from a database. At the foot of the page, I have set up a hyperlink to add an item to a basket bean instance created in this page.
    What happens is the page will load correctly, when i hover the mouse over the hyperlink to add the item to the basket, the status bar shows the URL of the current page with the details of the book appended. This is what I want. But when I click the link, the page will only reload showing 20% of the content.
    Netbeans throws up no errors, neither does Tomcat, so I am assuming I have made a logical error somewhere.
    I have enclosed the Book class, and the ShoppingCart class for your reference.
    Any help would be really appreciated as I am at a loss here.
    Cheers.
    Edited highlights from bookDetail.jsp
    //page header importing 2 classes - Book and ShoppingCart
    <%@ page import="java.util.*, java.sql.*, com.shopengine.Book, com.shopengine.ShoppingCart" errorPage="errorpage.jsp" %>
    //declare variables to store data retrieved from database
    String rs_BookDetail_bookRef = null;
    String rs_BookDetail_bookTitle = null;
    String rs_BookDetail_author = null;
    String rs_BookDetail_price = null;
    //code that retrieves recordset data, displays it, and places it in variables shown above
    <%=(((rs_BookDetail_bookRef = rs_BookDetail.getString("book_ref"))==null || rs_BookDetail.wasNull())?"":rs_BookDetail_bookRef)%>
    <%=(((rs_BookDetail_author = rs_BookDetail.getString("author"))==null || rs_BookDetail.wasNull())?"":rs_BookDetail_author)%>
    <%=(((rs_BookDetail_bookTitle = rs_BookDetail.getString("book_title"))==null || rs_BookDetail.wasNull())?"":rs_BookDetail_bookTitle)%>
    <%=(((rs_BookDetail_price = rs_BookDetail.getString("price"))==null || rs_BookDetail.wasNull())?"":rs_BookDetail_price)%>
    //this link is to THIS PAGE to send data to server as request parameters in Key/Value pairs
    // this facilitates the add to basket function
    <a href="<%= response.encodeURL(bookDetail.jsp?title=
    "+rs_BookDetail_bookTitle+"
    &item_id=
    "+rs_BookDetail_bookRef +"
    &author="+rs_BookDetail_author +"
    &price=
    "+rs_BookDetail_price) %> ">
    <img src="images\addtobasket.gif" border="0" alt="Add To Basket"></a></td>
    // use a bean instance to store basket items
    <jsp:useBean id="basket" class="ShoppingCart" scope="session"/>
    <% String title = request.getParameter("title");
    if(title!=null)
    String item_id = request.getParameter("item_id");
    double price = Double.parseDouble(request.getParameter("price"));
    Book item = new Book(item_id, title, author, price);
    basket.addToBasket( item );
    %>
    ShoppingCart class that is used as a bean in bookDetail.jsp shown above
    package com.shopengine;
    //import packages
    import java.util.*;
    //does not declare explicit constructor which automatically creates a zero argument constructor
    //as this class will be instantiated as a bean
    public class ShoppingCart
    //using private instance variables as per JavaBean api
         private Vector basket;
         public ShoppingCart()
              basket = new Vector();
         }//close constructor
    //add object to vector
         public void addToBasket (Book book)
              basket.addElement(book);
         }//close addToBasket method
    //if strings are equal, delete object from vector
         public void deleteFromBasket (String foo)
    for(Enumeration enum = getBasketContents();
    enum.hasMoreElements();)
    //enumerate elements in vector
    Book item = (Book)enum.nextElement();
    //if BookRef is equal to Ref of item for deletion
    //then delete object from vector.
    if (item.getBookRef().equals(foo))
    basket.removeElement(item);
    break;
    }//close if statement
    }//close for loop
         }//close deleteFromBasket method
    //overwrite vector with new empty vector for next customer
         public void emptyBasket()
    basket = new Vector();
         }//close emptyBasket method
         //return size of vector to show how many items it contains
    public int getSizeOfBasket()
    return basket.size();
         }//close getSizeOfBasket method
    //return objects stored in Vector
         public Enumeration getBasketContents()
    return basket.elements();
         }//close getBasketContents method
         public double getTotalPrice()
    //collect book objects using getBasketContents method
    Enumeration enum = getBasketContents();
    //instantiate variable to accrue billng total for each enummeration
    double totalBillAmount;
    //instantiate object to store data for each enummeration
    Book item;
    //create a loop to add up the total cost of items in basket
    for (totalBillAmount=0.0D; enum.hasMoreElements(); totalBillAmount += item.getPrice())
    item = (Book)enum.nextElement();
    }//close for loop
    return totalBillAmount;
         }//close getTotalPrice method
    }//close shopping cart class
    Book Class that is used as an object model for items stored in basket
    package com.shopengine;
    import java.util.*;
    public class Book{
         //define variables
    private String bookRef, bookTitle, author;
         private double price;
    //define class
    public Book(String bookRef, String bookTitle, String author, double price)
    this.bookRef= bookRef;
    this.bookTitle=bookTitle;
    this.author=author;
    this.price=price;
    //create accessor methods
         public String getBookRef()
              return this.bookRef;
         public String getBookTitle()
              return this.bookTitle;
         public String getAuthor()
              return this.author;
         public double getPrice()
              return this.price;
    }//close class

    page will only reload showing 20% of the content.Im building some carts too and I had a similiar problem getting null values from the mysql database. Are you getting null values or are they just not showing up or what?
    On one of the carts I'm building I have a similiar class to yours called products that I cast onto a hashmap works alot better. Mine looks like this, maybe this is no help I don't know.......
    public class Product {
        /**An Item that is for sale.*/
          private String productID = "Missing";
          private String categoryID = "Missing";
          private String modelNumber = "Missing";
          private String modelName = "Missing";
          private String productImage = "Missing";
          private double unitCost;
          private String description = "Missing";
          public Product( 
                           String productID,
                           String categoryID,
                           String modelNumber,
                           String modelName,
                           String productImage,
                           double unitCost,
                           String description) {
                           setProductID(productID);
                           setCategoryID(categoryID);
                           setModelNumber(modelNumber);
                           setModelName(modelName);
                           setProductImage(productImage);
                           setUnitCost(unitCost);
                           setDescription(description);        
          public String getProductID(){
             return(productID);
          private void setProductID(String productID){
             this.productID = productID;
          public String getCategoryID(){
             return(categoryID);
          private void setCategoryID(String categoryID){
             this.categoryID = categoryID;
          public String getModelNumber(){
             return(modelNumber);
          private void setModelNumber(String modelNumber){
             this.modelNumber = modelNumber;
          public String getModelName(){
             return(modelName);
          private void setModelName(String modelName){
             this.modelName = modelName;
          public String getProductImage(){
             return(productImage);
          private void setProductImage(String productImage){
             this.productImage = productImage;
          public double getUnitCost(){
              return(unitCost);
          private void setUnitCost(double unitCost){
              this.unitCost = unitCost;
          public String getDescription(){
              return(description);
          private void setDescription(String description){
              this.description = description;

  • Jsp bean property method dilemma

    Hi all,
    I'm just starting using bean and trying to convert old jsp in MVC model using beans. I expose the problem:
    a simple internal search engine ask with a form to enter the some parameter. I want to use this parameter to compose my query to the db.
    Now I use this code in my jsp to make the query:
    boolean firstTime = true;
    Hashtable hshTable = new Hashtable(10);
    Enumeration enumParam = request.getParameterNames();
    while (enumParam.hasMoreElements())
      String name = (String)enumParam.nextElement();
       String sValore = request.getParameter(name);
       if (!sValore.equals(""))
        hshTable.put(name, new String(sValore));
    Enumeration enumHshTable = hshTable.keys();
    while (enumHshTable.hasMoreElements())
      String str_SelectStatement = "SELECT * FROM myTable";
      /*If isn't my first time don't add WHERE but AND*/
      if (firstTime)
       str_SelectStatement += " WHERE (";
       firstTime = false;
      else
       str_SelectStatement +=" AND (";
      String sKey = (String)enumHshTable.nextElement();
       str_SelectStatement += sKey + " LIKE '" + (String)hshTable.get(sKey) + "%')";
    }In this way I compose a smart query like this:
    SELECT * FROM myTable WHERE param1 LIKE 'param1Value' AND param2 LIKE 'param2Value' AND........
    How to convert it in a bean model?
    If I make n setXxxx() getXxxx() I loss in reuse of code.
    If I make personalized setXxxx() for the param1 how can I access to the name of the current method?
    I need this to compose my query. I can retrive the param1Value but not the current name (param1) of the parameter.
    import java.sql.*;
    import java.io.*;
    public class DbBean
    String Param1;
    ResultSet r = null;
    boolean firstTime = true;
    String str_SelectStatement = "SELECT * FROM myTable";
    public DbBean()
      super();
    public String getParam1() throws SQLException
      this.Param1 = r.getString("Param1")!=null?r.getString("Param1"):"";
      return this.Param1;
    public void setParam1(String param1Value)
      if (firstTime)
       str_SelectStatement += " WHERE (";
       firstTime = false;
      else
       str_SelectStatement +=" AND (";
    str_SelectStatement += NameOfTheMethod... + " LIKE '" + param1Value;
      this.Param1= newValue;
    }How can I take the NameOfTheMethod... Param1?
    I search around and I read that you can access to the Method name in the stack trace in an other method. But I can't belive this is THE way. It is no suitable.
    Any suggestion will be greatly appreciated.
    Thank you

    Hiya Ejmade,
    First of all: you're missing the concept of the MVC (Model - View - Controller) model. There are two (2) versions out there, with the currently pending (no. 2) going like this:
    from a resource, a JSP page acquires a java bean, encapsulating the data. Via set/get methods of the bean, you create content on the JSP page
    If you wanted to comprise your search engine like this, you would first have to create a file search.jsp (can be .html at this point) which would call a SearchServlet. This servlet would perform a query, encapsulate the data in some object (let's say java.sql.ResultSet) and then forward control to a JSP page, including the object. The page would acquire the object (through the session context, for instance), extract data, and make it available on the site.
    But that's not what's puzzleing you. You would like to know which method created the database query string so you could adapt that very string. This can be done with the class introspection API, reflection. It's quite complex, you'll need to read about it in a tutorial, try:
    http://java.sun.com/tutorial
    The reflection API has quite a lot of overhead and it, honestly speaking, does not have to be used here. Instead, try this:
    public class DBean {
    Hashtable queryParamters;
    public DBean(Hashtable queryParameters) {
      this.queryParameters = queryParameters;
    public String generateSQLCode() {
      StringBuffer call = new StringBuffer("SELECT * FROM myTable WHERE ");
      for (Enumeration e = queryParameters.keys(); e.hasMoreElements();) {
       String key = (String)e.nextElement();
       call.append(key + " LIKE " + (String)queryParameters.get(key));
      return(call.toString());
    }This code should generate the string for you (with minor adjusments). Btw, I noticed some basic mistakes in the code (calling the Object() constructor, for instance, which is not neccessary). Do pick up a good java book ..
    Hope this helps,
    -ike, .si

  • Calling JSP bean function on button OnClick

    Hi-
    A NewBie question....
    I have a .jsp page and supporting .java bean.
    I registed the bean in .jsp page using <jsp:useBean ...>
    I want to fire a function defined in that bean on the click of a button which is defined in the .jsp page
    So I am doing something like this... seems like not the correct way to do since it fires this script all the time, not just when the button is clicked.
    <input name='click1' type='Submit' value='Click1' onClick='<% testBean.click1Clicked (); %>'/>
    Thanks for your help.

    Hi Kishor-
    Thanks for the reply.
    I realize that might be the case, as u explained in your two points.
    so now I have created a hidden input field and use it's value as a way to communicate between javascript and jsp. and in bean's function I check the value of this hidden field, which will be set by the OnClick's javascript and then proceed accordingly.
    Is this the correct way to accomplish what I am trying to?
    Thanks again

  • JSP, BEANS AND DAO best practice... (and a little of STRUTS & JSTL)

    Hi,
    Want to get your opinion on how to really use bean and dao in jsp pages.
    Imagine that you wants to display a news list on the jsp index page for example.
    You've got a dao with method getLastNews(int size) which returns a Collection of News beans. Then with jstl or struts you iterate ove the collection to display the news in a formatted way.
    Easy to build collection with scriptlets & co but not very clean...
    What is the best way to call my dao and its method with a tag whithout using scriplets ?
    Thanks

    Yes this is the solution i use when the collection is displayed alone in a jsp page, but how do you do this when you include this collection in a page, and if you have other collections in other parts of the page ? Is there a clean solution of doing this in the jsp page? For example:
    <sometag:loadmycollection name="list"/>
    <logic:iterate id="myCollectionElement" name="list">
    Element Value: <bean:write name="myCollectionElement" />
    </logic:iterate>
    I know that i can write my own tag by if there is an existing solution...

  • Easy JSP deployment

    Hello,
    I have a kind of silly problem. I want a bunch of web interfaces for my processes. I have not however found a good way for developing these interfaces.
    If I just add a JSP-file to my BPEL-project in "JDeveloper BPEL Designer" I do not think the JSP is published in the webserver. If it is - where? http://localhost:9700/projectname/foo.jsp is not correct...
    My other approach was to create a Web Project (still using "JDeveloper BPEL Designer") just for the UI. The JSPs are correctly deployed and published in the webserver but when executing Locator locator = new Locator("default", "bpel" ); (just as the working examples do) I get:
    java.lang.Exception: Failed to create "ejb/collaxa/system/DomainManagerBean" bean; exception reported is: "javax.naming.NameNotFoundException: ejb/collaxa/system/DomainManagerBean not found
    Ofcource I could use the deployment files for the examples (these obviously works) but I guess the nice development environment should be able to do this for me. So, my question is. How am I supposed to develop JSPs to make them easy to deploy and easy to maintain? I use version 10.1.2B3.
    Best regards
    / Rasmus

    Hi Maneesh,
    Yes I confirm this:
    Invoked 2-way operation "initiateTask" on partner "TaskManagerService".
    <messages>
    <article xmlns="http://xmlns.oracle.com/MyOrderProcess">&#214; is a O with two dots</article>
    I belive &#214; is the correct encoding of a O with two dots and this is how the value is encoded when received from the client partner in process initiation:
    Received "inputVariable" call from partner "client"
    <article>&#214; is a O with two dots</article>
    Please let me know if any more details are of interest. I am glad to help.
    Best regards
    / Rasmus

  • Baked Jsp Beans

    Hi, I am trying to create a header , where you have a menu, then a sub menu. I want to create an object for each menu item. Example :- i have the following items in my menu.
    Overview, licensing, rates.
    So far , i have managed to create an object for the overview, but it gives me errors, all i am trying to do is to reference basic html code from the bean to jsp? here is my bean code
    package header;
    import java.io.*;
    import java.util.*;
    public class DynamicHeaderData implements Serializable {
    * Constructor
    public DynamicHeaderData() {
    super();
    public void DbOverview() {
    System.out.println("<td bgcolor=#0099CC valign=center align=center height=22>");
         System.out.println("  <a href=overview.jsp>");
         System.out.println("<font face=Verdana, Arial, Helvetica, sans-serif size=2 color=#FFFFFF>");
         System.out.println("<b>Overview</b></font></a>  </td>");
    so i call it into my jsp, using the following:
    <jsp:useBean id="dynamicHeader" class="header.DynamicHeaderData" />
    <table cellspacing="4">
    <tr> <%= dynamicHeader.DbOverview() %>
    I get the following error :-
    Can't convert void to java.lang.Object.
    out.print(( dynamicHeader.DbOverview() ));
    ^
    1 error
    Please help, i know this is something simple, i would be extremely grateful, if someone could provide me with a working example of my code, cheers
    sandbox sandra..

    A void method will return no value- your DynamicHeaderData class will print all that output to the output stream that it is currently part of, probably the system console. You could try just using<table cellspacing="4">
    <tr> <%dynamicHeader.DbOverview() %>so that it is not trying to use an out.println. If I was writing it however, I would write the bean method like this:public String DbOverview() {
    StringBuffer buff = new StringBuffer("");
    buff.append("<td bgcolor=#0099CC valign=center align=center height=22>");
    buff.append("  <a href=overview.jsp>");
    buff.append("<font face=Verdana, Arial, Helvetica, sans-serif size=2 color=#FFFFFF>");
    buff.append("<b>Overview</b></font></a>  </td>");
    return buff.toString();
    }Then you are returning a String from your DbOverview method which is output that out.println can handle.

  • Jsp Bean

    Hi all,
    I want to create a bean Array such that one set and get propertues can be used for repeated operations.
    That is i am creating Online Exam in that i am selecting Exam Question and options in that one question has 4 options and another question has 5 options i want to display that options in jsp page by using getProperty options in the Bean.How to i do it (at present i created option1 option2,option3,option4 in set and get Properties please helpme to solve this
    Regards
    Beval

    Return all the options from your bean as a Collection. This way you can retrieve the options with one get call, and then use an Iterator in your page to loop through the number of options you havea, without needing to know exactly how many were returned.
    If you are not familar with Collections then check our the Java Tutorial for more info.
    Kevin Hooke
    Kev's Development Toolbox
    http://www.kevinhooke.com

  • Using JSP-Beans in Apache

    Hi all!
    I'm trying to deploy a jsp page in Tomcat 4.1.19. This page uses Java Beans to set and get various properties. I've put the class file of Java Bean in WEB-INF/classes directory and jsp page in Dir root. But whenever I run the jsp page it shows error page saying the bean name as unresolved symbol.
    Please tell me the steps that are involved in setting up a Java Bean for jsp in tomcat and also if any special lines are needed to be added to Deployment Descriptor.
    Thanx
    Varun

    sorry for tha :) maybe my english sucks to much...
    here's what sun says:
    "Note: In the section JSP Scripting Elements we mentioned that you must import any classes and packages used by a JSP page. This rule is slightly altered if the class is only referenced by useBean elements. In these cases,
    ---***you must only import the class if the class is in the unnamed package***---.
    For example, in What Is a JSP Page? (page 246), the page index.jsp imports the MyLocales class. However, in the Duke's Bookstore example, all classes are contained in packages and thus are not explicitly imported."
    as mentioned here:
    http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPBeans4.html#64054

  • Error while using Jsp Beans

    Hi, i just have written my first bean but i'm getting this erro message:
    java.lang.ClassNotFoundException: Unable to load class userinfo.FormBean
    Can somebody pls help me out.
    Thanks in advance
    JBP
    Below are my codes for the bean and my jsp codes
    Bean:
    package userinfo;
    import java.io.*;
    public class FormBean implements Serializable
    private String name;
    private String email;
    public FormBean()
    name = "test";
    email = "test";
    public void setName(String name)
    this.name = name;
    public String getName()
    return name;
    public void setEmail(String email)
    this.email = email;
    public String getEmail()
    return email;
    Jsp Codes:
    <html>
    <head>
    <title>Login</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <jsp:useBean id="formbean" class="userinfo.FormBean"/>
    <jsp:setProperty name="formbean" property="*" />
    <body bgcolor="#FFFFFF" text="#000000">
    <% if (request.getParameter("name")==null
    && request.getParameter("email"==null)
    { %>
    <form name="form1" method="post" action="process.jsp">
    Name:
    <input type="text" name="textfield">
    <br>
    <br>
    Email:
    <input type="text" name="textfield2">
    <br>
    <br>
    <input type="submit" name="Submit" value="Process">
    </form>
    <% } else {%>
    <p>
    <b>you have provided the following info</b>
    <p>
    <b>Name</b>:<jsp:getProperty name="formbean" property="name"/>
    <p>
    <b>Email</b>:<jsp:getProperty name="formbean" property="email"/>
    <p>
    <%}%>
    </body>
    </html>

    Hi!
    I tried ur bean in my program on javawebserver.
    It didn't work.
    gave error:
    java.lang.ClassNotFoundException: Unable to load class userinfo.FormBean
    then I just added
    import java.io.Serializable;
    in ur bean and tried.
    It gave me error:
    D:\JavaWebServer2.0\tmpdir\default\pagecompile\jsp\_examples\_jsp\_samples\_Brand__new\_mail1.java:19: '}' expected.
    static char[][] jspxhtml_data = null;
    I think the problem with bean is solved.
    U check for the same.
    check the settings of server and classpath .
    write whether it works,
    bye,
    Samir

Maybe you are looking for

  • SQL MP not alerting

    Hi, On SCOM 2012R2 CU2, with the sql 6.4.1 MP, we cannot get alerts when we stop SQL Server Agent (it is set to Automatic Delayed Start). We can reboot the server, then stop the services start and stop etc and still no alert. However, I then wrote my

  • Enabling third party cookies on Flash Player 10 when I can't find it

    I can't seem to find the flash player on my laptop so I can enable third party cookies. I have a Dell Inspiron and Windows 7. Anyone have any clue?

  • Standard interface file format to create WBS elements

    Hi Gurus, Could you please let me know where I could find the SAP standard file entry format to create WBS elements master data? The goal is to interface WBS master data from an upstream system to ECC6. By the way, do you know an easy way to create a

  • Photoshop Elements 13 - Crashes Everytime

    Photoshop Elements 13 freezes EVERYTIME I try to start it directly. When I try to start it from within the organizer by selecting a photo and clicking on edit, it will sometimes open the photo but then immediately freezes, but more often it just free

  • Imovie 08 Where are the effects?

    In I movie 06 there where effects you could apply to your videos I was just wundering do they have that in I movie 08 so far I haven't been able to find them. All I could find was transitions.