Sitemap

Amicuk Programming Answers

Which one better to use - jsp:useBean or import statement

2015-10-11   Views:0

Advertisement

Hi, I just want to know that which one is better to use jsp:useBean or import statement . I can instantiate and call method of myclass - 1) by importing the class through import tag in jsp as <%@page import="myclass"%. or 2). by using <jsp

Hi,
I just want to know that which one is better to use jsp:useBean or import statement .
I can instantiate and call method of myclass -
1) by importing the class through import tag in jsp as <%@page import="myclass"%. or
2). by using <jsp:useBean tag....
i have these two option to do the same thing. i know that basically useBean is used to call setter and getter method of bean class and but it can be used to call a normal java file that have some logic .
so what should i used , which one is better and why?
useBean provides scope and object instance so no need to create object by new operator. and with import you have to create an instance .
but which tag should i use in my jsp?
i am confused???

The replay answer
Advertisement
ok, means i can use jsp:useBean tag for all my
classes that are not actually bean. so it will be
instantiated at run time and provide efficiency .No. Jsp:useBean is used for java bean components.
>
but when should i use import statement in my jsp and
it happen at translation time so will it create any
type of burden for my code if i import multiple
classes.For non-java beans, you need to import the classes, period.
It's not a burden, it's a necessity.

Go to See the other 4 answers

Which one better to use - jsp:useBean or import statement

Category:DefaultRelease time:2015-10-11Views:130

Hi, I just want to know that which one is better to use jsp:useBean or import statement . I can instantiate and call method of myclass - 1) by importing the class through import tag in jsp as <%@page import="myclass"%. or 2). by using <jsp[More]

Jsp:usebean, @page import & CLASSPATH

Category:DefaultRelease time:2015-10-11Views:130

I hav given jsp:usebean for using the classes and then used import package mypack.* in my jsp file. But this is not recognised. I tried putting mypack (which has the class files) in webapps/ROOT/WEB-INF/classes. Still it is not working. My jsp workin[More]

How to assign the class value dynamically  in jsp:useBean ?its urgent

Category:DefaultRelease time:2015-10-11Views:130

Hi I want to set the class value of <jsp:useBean> dynamically when i am trying to this way <jsp:useBean id="<%=id %>" class="<%=beanclass %>" scope="request"> <jsp:setProperty name="<%=id %&[More]

Jsp:useBean and assigning a value to that bean

Category:DefaultRelease time:2015-10-11Views:130

Hello, I have a type called Country and I have declared a bean using the "jsp:useBean" syntax. I then try to assign a value to that bean in a scriptlet. Eventually I try to retrieve the values using "jsp:getProperty". The problem is th[More]

Jsp:useBean giving error while compiling JSP's in JDeveloper

Category:DefaultRelease time:2015-10-11Views:130

Hello, I am having another problem with JSP's in JDeveloper 10.1.3. jsp:useBean and jsp:setProperty are all giving problems. I am not sure what I need to do to get rid of this error Thanks, LakshmisriYour original post mentions issues with jsp:useBea[More]

Jsp:usebean How to get value of an object from a bean

Category:DefaultRelease time:2015-10-11Views:130

I am new to JSP and am struggling from past few days to solve a problem. Consider the below scenario Class Book{ private String author; public void setAuthor(String author) public String getAuthor(){ return author; } Class Rack{ private Book []books;[More]

Why do we need jsp:useBean???

Category:DefaultRelease time:2015-10-11Views:130

Hi All, I am going over both the J2EE tutorial and JSP1.2 spec. As far as I read, it seems to me that "jsp:useBean" is a way of creating a bean object. <jsp:useBean id="local" scope="application" class="Mylocales"[More]

jsp: useBean.. and c: coding

Category:DefaultRelease time:2015-10-11Views:130

I am trying to understand this coding. 1. What does the <jsp: useBean .. class="coreservlets.ShoppingCart"> mean? Are we bringing in the content of the ShoppingCart class? If we use <% import="coreserlets.*"> at the top of[More]

Jsp:useBean

Category:DefaultRelease time:2015-10-11Views:130

I really shouldn't be trying to use JSP any more ... I have been having problems using JavaBeans in JSP pages now - every time a problem is solved, that other little thing that always wanted a go at annoying me arrives ... The code is: <jsp:useBean i[More]

HELP: jsp:useBean not "working"

Category:DefaultRelease time:2015-10-11Views:130

I have written a JSP that utilizes some JavaBeans. With one, I do something similar to the following: <jsp:useBean id="BeanA" class="mypackage.myFirstBean" /> That statement executes just fine, as the debug HTML statement that fo[More]

Jsp:useBean gives cannot be resolved to a type in Tomcat

Category:DefaultRelease time:2015-10-11Views:130

Hi, I am using Tomcat 5.5 I have a simple JavaBean for test purposes : import java.io.Serializable;     public class testBean implements Serializable {         int number;         public testBean() {         public int getNumber() {             retur[More]

Hot
Adobe Bridge CS3 has been working fine for quite a while. I have been having some problems with my System (C) drive, where it and Photoshop CS3 are installed. I swapped out the C drive, and restored an image of the drive, and most items are working O [More]
I am connecting my new AX however, it does not read when Airport Utility scans for the station. I attempted to set up the new AX and was able to establish the connection but not connect to the internet. I unplugged the station, and restarted my compu [More]
I am concerned about installing the +10.5.8 Update Mac OS X Leopard+ from +10.5.7 (Power PC G5)+. It does not say anything about users who aren't on the intel chip systems so I'm worried if I really need to upgrade, any advice? This also comes to min [More]
Hello there. Absolute beginner here - DW CS4 on iMac OS10.5.8 I am linking 2 pages via the Properties bar with that folder icon (both pages 'index.html' & 'page1.html' are saved in a site folder, inside a Dreamweaver project folder, inside a folder o [More]
I have created a field {@years} with the value -10 which was used as part of a formula. This part has worked fine. I also wanted to use {@years} as part of the report heading where -10 represented a time period. However, the number came up as -10.00. [More]
I have a file with a construction: Serializable[] serializable = new int[n]; It was generated with jad.exe decompiler from .class file. When I use javac compiler (java version v1.2.2) it reports an error that the types java.io.Serializable and int is [More]
Hey all. I've been having a problem with my RAID setup in Arch.  At first Arch wasn't picking up a partition on one of my arrays, (a single large NTFS partition on a 2TB array between two 1TB drives) but after re-creating the RAID array in the Intel [More]
Hello, I am facing an issue in view configuration. I have added value attributes to an existing context node in component BT116IT_SRVO, GenricItem view, BTADMINI context node. Now after adding the atrribute an exception is triggering as "Cannot displ [More]
Hi all I am working on an assignment for college, trying to learn Java etc, Basically I need one object to react to events in another Code is as follows // Extra Panel package myPackage1; import java.awt.GridLayout; import java.beans.PropertyChangeEv [More]
Hello, I have solaris 10 installed on an Virtual Machine and suddenly partition /var was not accessible. A reboot solved the problem but after about 12 hours the problem reappeared. Also with fdisk I have done: umount /var fsck /var ** /dev/rdsk/c1t0 [More]