Prob with jsp setProperty

Dear fouramites,
I am using jsp SetProperty standadr action tag to set from values to beans. In update when I am changing any form field value it is working fine but when I am deleting the form field value the previous value is being set to bean.
What is the solution to this problem?
Thanks & Regards
Kavyaanjali Jena

Dear Ram,
I am using the following code for both save and update functionality.
<html>
<%@ page session="true"%>
<%@ page language="java" %>
<%@ page import="models.*"%>
<%@ page import="beans.*"%>
<%@ page import="java.util.*"%>
<%
<jsp:useBean id="DATA_MODEL" scope="session" type="models.BeanInterface" />
<jsp:setProperty name="DATA_MODEL" property="*"/>
<jsp:forward page="/servlet/FrontController" />
</html>
When I change the value This code could set value to bean but when I totally delete the value it could not set null to bean but old value is retained.
I am using FrontController architecture.
Thanks & Regards
Kavyaanjali Jena

Similar Messages

  • Modify Collection with jsp:setproperty

    Hello:
    I have a problem with jsp and struts.
    I have a collection of items (List) and view the elments in jsp page. This It works fine.
    But the problem happens when i like modify the collection.
    The code to view the collection in jsp is:
    <jsp:useBean id="ItemListForm" class="com.myapp.struts.ItemListForm" scope="session" />
    <html:form action="/ItemEditAction" >
    <logic:iterate name="ItemListForm" property="listaItems" id="item" >
    <P>
    <BASEFONT SIZE="3">
    <jsp:getProperty name="item" property="etiqueta" />
    </BASEFONT>
    <P>
    <jsp:getProperty name="item" property="grafico"/>
    <P>
    </logic:iterate>
    <P>
    <html:submit>Save File</html:submit>
    <html:hidden property="do" value="saveXML"/>
    </html:form>
    The question is:
    How to modify the element "grafico" with jsp:setproperty.
    Thanks for all.

    Thank you, I had forgotten the set part, but then the next problem occurs:
    <jsp:setProperty name="date" property="locale" value="${locales.locale}"/>
    generates:
    org.apache.jasper.JasperException: Unable to convert string '${locales.locale}' to class java.util.Locale for attribute locale: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager
    could I only use Strings as input?

  • Need Help:  Problem with JSP setProperty to Bean

    Hi,
    This is my first time posting to this forum so I am not completely aware how Duke dollars work but if anybody can help me I will be happy to give some... whats normal for solving a problem?? 10??
    Anyway... the problem...
    I have a simple JSP with a simple HTML <form> that has a text field and a Submit button. Submit takes the user to the next JSP page however the setter method for property 'user' is never called. I can verify this through an attached debugger.
    I am using Tomcat 5.5, and I never had a problem like this in previous versions of Tomcat.
    I have tried changing the scope of the bean to request however nothing changed. I excluded all my business logic and tested this one more time just to make sure I wasn't inadvertadely screwing with something however this still does not work.
    I am sure I am missing something small but for the life of me I can't figure out what.
    Here is my code:
    index.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>
            <jsp:useBean id="something" scope="session" class="com.db.servlet.UserBean">
                <jsp:setProperty name="something" property="*"/>
            </jsp:useBean>
            <p>Select</p>
            <form id="Form1" method="post" action="multi.jsp">
                <p>User: </p>
                <input type="text" name="user" size="20"><br>
                <input type="submit" value="Submit">
            </form>
        <br><p>Or select Single mode.</P><br>
        <a href="tris.html">tris</a>
        </body>
    </html>UserBean:
    package com.db.servlet;
    public class UserBean {
        private String user = null;
        public UserBean() {
        public void setUser(String user) {
            this.user = user;
        public String getUser() {
            return user;
    }

    Oops!
    I not only realized my mistake, I also accidentally posted this in the wrong forum. I meant to post in the JSP Forum.
    For reference, what I did wrong was I placed my setProperty tag in index.jsp rather than placing it in multi.jsp (the file specified in the form action).
    Everything works now.

  • How to deal empty field with jsp:setProperty ...

    Ive come across a bug in what I've done so far, not sure if its because of my approach...
    I sucessfully store a value entered in a text field in a bean without any problems, and navigate back to the page where the value re-appears (via html, not relying on the browser). The problem is, if I edit that field to be blank, resubmit, then navigate back, the old value returns.
    As far as I can tell, this is due to my jsp interpreting the input as null (ie. no input) and not changing the tag. IE sends the parameter as myPage.jsp?para1=&para2=some+value as it should (where para1 is the input in question).
    I use the 'parameter="*"' usage of jsp:setProperty - is that a problem? Does this usage of setProperty not allow for setting values back to "" ? If so, how can i overcome this problem without losing the benefits of using <jsp:setProperty name="myBean" property="*">, that is, you can store all property values in javaBean in one go, instead of repeatly using <jsp:setProperty name="myBean" property="myProperty" value="myValue"> for each property.

    hi,
    first clearly tell u' r problem and then only any one can help u.
    we are not unable to understand u'r query. it's like a Composition.
    Bala
    Message was edited by:
    art84

  • Prob in  working with jsp 2.0 tags fil

    hi all
    i am facing a prob working with jsp 2.0 tags files and hope to receive a possitive responce from your good self:-
    <p>
    how could i create a instance of a user defined class in a tags files .
    <p>eg.
    <tb:firsttag tableName="customer" className="createtable" packagename="package1">
    <BR>
    </tb:firsttag>
    what code i have to write in tag file to create a object of class createtable </br>
    thanks in advance, waiting for ur cooperation

    I'm not sure I understand your question, but...
    If you want to create a custom tag that will contain a body (data between the start and end tags) you will extend BodyTagSupport.
    HTH.

  • jsp:setProperty doesn't work with short properties

    Hi,
              Setting bean properties doesn't work with properties that are of type short.
              Any ideas what's going on? I'm using WLS 6.1SP1 on W2K.
              --John
              <jsp:useBean id="test" scope="session" class="test.Test" />
              <jsp:setProperty name="test" property="*" />
              -- Test.java
              package test;
              * @author john
              public class Test {
              /** Creates new Test */
              public Test() {
              public short getShort() {
              return 0;
              public void setShort(short val) {
              Produces the following error while attempting to compile the jsp:
              Compilation of
              'C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp
              warCleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java'
              failed:
              C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp_
              war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java:104:
              setShort(short) in test.Test cannot be applied to ()
              probably occurred due to an error in /test.jsp line 7:
              <jsp:setProperty name="test" property="*" />
              C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp_
              war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java uses or
              overrides a deprecated API.
              Full compiler error(s):
              C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp_
              war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java:104:
              setShort(short) in test.Test cannot be applied to (<null>)
              test.setShort(null); //[ /test.jsp; Line: 7]
              ^
              Note:
              C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp_
              war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java uses or
              overrides a deprecated API.
              Note: Recompile with -deprecation for details.
              1 error
              Fri Nov 09 00:24:58 PST 2001
              [test.war]
              

    It looks like a bug in JSP generator. If you look and the .java
              created by 6.1 it doesn't make any sence:
              String _propertyValue = request.getParameter("short");
              if (_propertyValue != null && !_propertyValue.equals(""))
              test.setShort(null);
              (needless to say that this works correctly in Resin).
              John Hampton <[email protected]> wrote:
              > Thanks for reply,
              > Changing getShort and setShort to getId and setId makes no difference. I
              > still get the error described below:
              > C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp_
              > war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java:104:
              > setId(short) in test.Test cannot be applied to (<null>)
              > test.setId(null); //[ /test.jsp; Line: 7]
              > John
              > "Jignesh" <[email protected]> wrote in message
              > news:[email protected]...
              >>
              >> hi,
              >> i think you have not given the property name properly.
              >> give some other name than short becuase short is the keyword (data-type)in
              > java.
              >> bye,
              >> Jignesh
              >>
              >>
              >> "John Hampton" <[email protected]> wrote:
              >> >Hi,
              >> >
              >> >Setting bean properties doesn't work with properties that are of type
              >> >short.
              >> >Any ideas what's going on? I'm using WLS 6.1SP1 on W2K.
              >> >
              >> >--John
              >> >
              >> ><jsp:useBean id="test" scope="session" class="test.Test" />
              >> ><jsp:setProperty name="test" property="*" />
              >> >
              >> >-- Test.java
              >> >package test;
              >> >
              >> >/**
              >> > *
              >> > * @author john
              >> > */
              >> >public class Test {
              >> >
              >> > /** Creates new Test */
              >> > public Test() {
              >> > }
              >> >
              >> > public short getShort() {
              >> > return 0;
              >> > }
              >> >
              >> > public void setShort(short val) {
              >> > }
              >> >}
              >> >
              >> >Produces the following error while attempting to compile the jsp:
              >> >
              >> >Compilation of
              >>
              >>'C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tm
              > p
              >> >warCleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java'
              >> >failed:
              >>
              >>---------------------------------------------------------------------------
              > -
              >> >----
              >>
              >>C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp
              > _
              >> >war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java:104:
              >> >setShort(short) in test.Test cannot be applied to ()
              >> >probably occurred due to an error in /test.jsp line 7:
              >> ><jsp:setProperty name="test" property="*" />
              >> >
              >>
              >>C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp
              > _
              >> >war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java
              >> >uses or
              >> >overrides a deprecated API.
              >> >
              >>
              >>---------------------------------------------------------------------------
              > -
              >> >----
              >> >Full compiler error(s):
              >>
              >>C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp
              > _
              >> >war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java:104:
              >> >setShort(short) in test.Test cannot be applied to (<null>)
              >> > test.setShort(null); //[ /test.jsp; Line: 7]
              >> > ^
              >> >Note:
              >>
              >>C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp
              > _
              >> >war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java
              >> >uses or
              >> >overrides a deprecated API.
              >> >Note: Recompile with -deprecation for details.
              >> >1 error
              >> >
              >> >
              >>
              >>---------------------------------------------------------------------------
              > -
              >> >----
              >> >Fri Nov 09 00:24:58 PST 2001
              >> >
              >> >
              >> >
              >> >
              >> >begin 666 test.war
              >> >M4$L#!!0`" `(`,@`:2L````````````````4``0`345402U)3D8O34%.249%
              >> >M4U0N34;^R@``X^4"`%!+!PBLA:(4! ````(```!02P,$% `(``@`R !I*P``
              >> >M``````````````\```!714(M24Y&+W=E8BYX;6RE4DMOVS ,/L^ _P/GTP9,
              >> >M4NH=M@YIBC3I@ )M&G3IAIX*1V9B!;)D6'0>WY2GDT6# /FD&1WX,4V]?+
              >> >M4L,<:Z>LN4HN>"L!--+FRDRODN?1=_8UN>[$4?L]8W$$)]^/QL"P&6LEX5Y)
              >> >M- YA8,G_Q5$<C0H$:0VA(0=V`E0H!Q.E$;(:P37C&4H"LKZ 9Y3BZ.<F%?A0
              >> >M\"$T)=M2\I'#BVV@S%9@+$'C?0_JN)18$2@31]*6E5:9D0@+1<7:::O!H>O3
              >> >M5:M-LCT,7B6;9TIGXQ"4XJ@@JKX)L5@LN&L,]Y)B-]UCK:;*9!IZ-E\S!T@W
              >> >MF!G'(93OC"+EJWV<H[85UCNO'2^.=L0P_H.2M74K1UBZ3YXL.0QM37X#SAM4
              >> >M*T\J""XN+[^PM-5J!4X<G2%UM8:GT.O@"1W6<\QY'#'6";'#2_8?>Z.7X2TL
              >> >M<,RRJMH\Z_#YYOZN!PD3XGP8(?JC/OS",70KOU29A620\E2(VT&R$4FVRYKY
              >> >M%>ZW-4L114ZY$UO#U_0UY1Y(UHG:6[2SD6@[=.'5F3^=B9IV#D>WKY JT3;4
              >> >M.;['SZTWK>)\[P$_4O<1M$^*+-P/T\J%_G='Z(F9,CDN^<Q5;SU/^O]!H*!2
              >> >M_[?"7P3^!'?3M<5A[;\!4$L'"/]33>'A`0``! 0``%!+`P04``@`" #(`&DK
              >> >M````````````````" ```'1E<W0N:G-P-4X[#L(P#-US"A.I"P/>D1LAQ,14
              >> >MB5X@M!84M4E4&XG>GJ:!R<_OIT?5*?D'0Q>#<M!V25Q;Y8_B4Z?15LY0!OFP
              >> >M[QWIH".[ZZV!9HT1EI]P4PW=8[\X8^@EZ?@6/K,/,/2Y4=2"=#'7"XL,,5CH
              >> >M1B]2Q$.[.="5K+ V\VJ>=8'@)_XW0/JQM=T7=W+F$@/O=H9PQ81E`F&9_050
              >> >M2P<(E)0WZYL```#@````4$L#!!0`" `(`,@`:2L````````````````?````
              >> >M5T5"+4E.1B]C;&%S<V5S+W1E<W0O5&5S="YC;&%S<TV/OT[#,!#&OTO2IDT+
              >> >M_4.I6-D*`C(@)A +$E,$0ZKN3K!:5R&1$K=/Q<*$Q, #\%"(LQ-%]7!W_MU]
              >> >MW]F_?]\_<'&-><#IQ,?,QRFA^Z!RI1\)[N)B1?">BC=)&$4JER^[]T262Y%D
              >> >M3*91D8IL)4IE[@WT]$95A$&D9:7#)8=[0F\M=;PI2FT]8P95"[Q%;+:X>Y$1
              >> >MB'M!7.S*5#XK8]<W#C=;L1=#>.@P:'T)8\/#3.3K\#79RE3C' [_Q!P79 0<
              >> >MNWR[Y4R<.Y=?H$\N'/@<`\[ F <GZ'$UK(?0YPZX'EAB#*X:`\?]:-5=2V8'
              >> >M2J=5'N&X4=Y9CL.UM?#,"N=ULQ&::L0/,LLF=G[Z#U!+!PA>>AD-#@$``*4!
              >> >M``!02P$"% `4``@`" #(`&DKK(6B% 0````"````% `$````````````````
              >> >M````345402U)3D8O34%.249%4U0N34;^R@``4$L!`A0`% `(``@`R !I*_]3
              >> >M3>'A`0``! 0```\`````````````````2@```%=%0BU)3D8O=V5B+GAM;%!+
              >> >M`0(4`!0`" `(`,@`:2N4E#?KFP```. ````(`````````````````&@"``!T
              >> >M97-T+FIS<%!+`0(4`!0`" `(`,@`:2M>>AD-#@$``*4!```?````````````
              >> >M`````#D#``!714(M24Y&+V-L87-S97,O=&5S="]497-T+F-L87-S4$L%!@``
              >> >0```$``0`!@$``)0$````````
              >> >`
              >> >end
              >> >
              >>
              Dimitri
              

  • 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.

  • Need help in connecting to JNDI with JSP

    Hi all
    I am working on LDAP with JNDI, i need to use JSP for front end screens.
    My problem is like this..
    I am not finding a way to pass a user name and password from my jsp file, through JNDI and check for authentication in an LDAP server.
    I am using iPlanet Directory Server as my LDAP server, i have added some users using a JNDI class, and a default password is set for them.
    All I need to do is to authenticate the user for LDAP and return a boolean value to the jsp page and then proceed for further operations.
    I would be thankful if anyone could help me solve this problem, urgent...........
    Thanks
    Swaraj

    Hi
    One way to do this would be:
    1. Write a sample program which will read the username & password as command line parameters. This will authenticate this data against the LDAP server that you have setup. Once you have this working proceed to step2.
    2. Write a Java Bean with two attributes that will hold the username and password. Add a method authenticate user which will contain the code you have written in step 1.
    3. Create a JSP with username & password fields. Let the form post to the same JSP or a different JSP/Servlet.
    4. In the JSP use the <jsp:useBean> tag to create a bean coded in Step 2. The scope bean should be "request". Set the username and password fields using the <jsp:setProperty> tag. Once you have this , just use the beanId from the <jsp:useBean> tag to call the validation method.
    Keep me posted on your progress.
    Good Luck!
    Eshwar Rao
    Developer Technical Support
    Sun microsystems inc.
    http://www.sun.com/developers/support

  • Problem in using java bean with jsp

    Hi,
    This is my code and i get this error. Not able to trace the mistake.
    bean.html
    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Fname</title>
    </head>
    <body>
    <form method="POST" action="http://localhost:8080/beanjsp.jsp">
         <p>Fname: <input type="text" name="T1" size="20"></p>
         <p>Lname: <input type="text" name="T2" size="20"></p>
         <p> </p>
         <p> </p>
         <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
    </form>
    </body>
    </html>
    beanjsp.jsp
    <jsp:useBean id="bean" class="beans.FirstBean" scope="application" />
    <jsp:setProperty name="bean" property="fname" param="T1" />
    <jsp:setProperty name="bean" property="lname" param="T2" />
    THE FIRST NAME IS <%=bean.getFname() %>
    THE LAST NAME IS <%=bean.getLname() %>
    FirstBean.java
    //CREATING A BEAN
    package beans;
    import java.io.*;
    public class FirstBean
         private String fname;
         private String lname;
         FirstBean()
              fname="";
              lname="";
         public void setFname(String fn)
              fname=fn;
         public void setLname(String ln)
              lname=ln;
         public String getFname()
              return fname;
    public String getLname()
              return lname;
    error report
    org.apache.jasper.JasperException: /beanjsp.jsp(2,0) The value for the useBean class attribute beans.FirstBean is invalid.
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
         org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1223)
         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:3270)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:189)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)I have placed the beans package folder containing FirstBean.class inside classes folder of ROOT directory.
    I don't know what s wrong with my code :( ... Plz help asap.
    Thanks,
    Akshatha

    I have placed the beans package folder containing FirstBean.class >inside classes folder of ROOT directory.Place it in the WEB-INF/classes folder
    ram.

  • Possible to use jsp:setProp with jsp:getProp in it?

    Background info:
    I have a bean that contains a variable dbid(with set and get methods). I can get the value of it by using the ordinary <jsp:getProperty.../>
    But I would like to set the value like this:
    <jsp:setProperty name=".." property ="dbid" value="<jsp:getProperty name=".." property="dbid"/>+1"/>
    That is to set the value of dbid to dbid++
    Is it possible to make this sort off call in a JSP file?
    I have tried, but cannot make it work. But my logic tells me it must be possible!!
    Hope you can help me!! I will not be cheap with the duke dollars! ;-)
    In advance, thanx!!

    Try this:
    <jsp:setProperty name="bean_name" property="property_name" param="request_param_name" />
    I think this will work...

  • Unable to run beans  with jsp using myeclipse

    I have create jsp application with in myeclipse using following process
    From the menu i create a J2EE ->WebProject
    The default folder name is src which is create automatically in editor
    when we create a package it will create under src folder
    as i create dbconnection in src folder
    The index.jsp file is in WebRoot folder .
    I have use the bean dbconnection in index.jsp as described below
              <jsp:useBean id="con" scope="session" class="dbconnection.ConnectionManager"></jsp:useBean>
         <jsp:useBean id="app" scope="sesion" class="dbconnection.JspApp"></jsp:useBean>
         <jsp:setProperty name="con" property="driverClass"
              value="com.mysql.jdbc.Driver" />
         <jsp:setProperty name="con" property="connectionURL"
              value="jdbc:mysql://localhost:3306/guestbook" />
    But it generate error and do not show any output There is no errors or warnings in dbconnection folder but i am unable to use it in my index.jsp page
    Please help me
    Thanks in advance

    use cactus jar files

  • Jsp:setProperty in WebLogic 6.0

    Hi,
              We are using the WebLogic Web container with the Apache server and we
              have encountered a problem with the <jsp:setProperty> and
              <jsp:getProperty> tags. We are using WebLogic 6.0sp1.
              Reading the newsgroups, I noticed that this tag did not work in the
              previous versions of WebLogic and I was wondering if it has been fixed
              in 6.0sp1. Here's the snippet of JSP page that I use:
              <jsp:useBean id="beanName" scope="session"
              class="com.imoney.aplications.BeanClass">
              <jsp:setProperty name="beanName" property="userId" value='<%=
              request.getParameter("userId") %>' />
              </jsp:useBean>
              The problem is that the property userId of the bean with name beanName
              is not set by this tag. The JSP page compiles properly. The bean
              instance beanName is unique in the user session context.
              Thank you for any help,
              Brenda.
              [att1.html]
              

    Hi,
              We are using the WebLogic Web container with the Apache server and we
              have encountered a problem with the <jsp:setProperty> and
              <jsp:getProperty> tags. We are using WebLogic 6.0sp1.
              Reading the newsgroups, I noticed that this tag did not work in the
              previous versions of WebLogic and I was wondering if it has been fixed
              in 6.0sp1. Here's the snippet of JSP page that I use:
              <jsp:useBean id="beanName" scope="session"
              class="com.imoney.aplications.BeanClass">
              <jsp:setProperty name="beanName" property="userId" value='<%=
              request.getParameter("userId") %>' />
              </jsp:useBean>
              The problem is that the property userId of the bean with name beanName
              is not set by this tag. The JSP page compiles properly. The bean
              instance beanName is unique in the user session context.
              Thank you for any help,
              Brenda.
              [att1.html]
              

  • JSP 1.2 and jsp:setProperty

    Has anyone got an idea why they decided to change the way the tag jsp:setProperty is handled?
    In the JSP 1.1 specification, the condition to be checked before calling a single property set method was that the request contained the corresponding parameter, no matter what its value was, and the generated code would look something like this
    String s1 = request.getParameter("example");
    if (s1 != null) setExample(s1);
    In the JSP 1.2 specification, it says the property is set only if the corresponding parameter' s value is not an empty string, as in
    String s1 = request.getParameter("example");
    if (s1 != null && s1.length() > 0) setExample(s1);
    Which is what it would do with the setProperty with property="*", according to the JSP 1.1 specification.
    This will cause me some trouble, because I will have to change my JSPs code in order to have bean variables set to empty string when the user doesn't input any value in the form (with beans having scope "session", of course).

    I have not found any reasonable explaination for this.
    The easiest fix that I could think of was on my JSP
    pages before I submit I check to see if the value of
    the field is "", if it is I set the value to
    "emptyString". On the bean side I check the value of
    the field property passed to see if it is
    "emptyString" if it is I set it to "".
    But this all seems an annoying nuisance when an empty
    string is a perfectly valid value.I think I will fix it by having a reset method called in every JSP containing a form after the form itself has been "written" on the output stream with its fields' values. The thing is that I can't really find a good reason for this change they made: I can't believe there's a developer out there who would find this an improvement. The only thing I can think of is that they wanted to make the setProperty for a single property and the setProperty with property="*" have the same behaviour (the one I don't like).

  • Using java bean with jsp

    hello friends,
    i'm new to jsp. i want to create an html form that accepts username and a value from four radio buttons and display back the entered name and checked radio button's value using java bean.
    i use the <jsp:setProperty id="" property="*"> method. i don't know how to access the radio buttons value from the html.
    also when i use an additional field other than username the jsp page is showing error.
    Please give me the correct method to use java bean with jsp in this circumstance.
    thank you.

    thank you, but i have a problem left. the case is like this.
    i got the jsp and bean worked fine when i have a sinle input text field.
    but when i added a second text field i recieved the following error.
    javax.servlet.ServletException: basket.newbean.getUserPass()Ljava/lang/String;
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
         org.apache.jsp.newform.process_jsp._jspService(process_jsp.java:69)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         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)
    where userPass is the new form element. I have made the subsequent chanes in my bean program and jsp file.
    pls hlp.

  • Can any one tell me how param is used in Jsp:setProperty ?

    Hi Can anyone please explain me with example how param attribute is used in <jsp:setProperty>?
    I have gone through the java doc but it still not clear to me....

    Try the [JSP syntax reference|http://java.sun.com/products/jsp/syntax/2.0/syntaxref2025.html#8856]
    It is very rare that you would use the param attribute, as most times you have your incoming parameter and bean property having the same name.
    Example:
    Say you navigate to http://localhost:8080/myApp/myPage.jsp?username=Bob
    That sends a request parameter "username" with the value "Bob"
    If we have a bean which also has a property username (getUsername(), setUsername()) (ie the property and the parameter have the same name) you can use the following jsp code:
    <jsp:useBean id="user" class="com.mypackage.User"/>
    <jsp:setProperty name="user" property="username">Translates approximately into
    User user = new User();
    user.setUsername(request.getParameter("username"));If instead the bean had a property "username" but the parameter was "userId"
    <jsp:useBean id="user" class="com.mypackage.User"/>
    <jsp:setProperty name="user" property="username" param="userId">
    User user = new User();
    user.setUsername(request.getParameter("userId"));Cheers,
    evnafets

Maybe you are looking for

  • Foreign Currency valuation reverse

    Hi All, Foreign currency revaluation we do every month end to reverse posting of all open items i.e vendor, customer and G/L accounts and Reversal is usually done for the next day which falls into next posting period. when do this steps I made a mist

  • Configuring output type

    Dear experts, We have attached using NACE smartform for deliveryNote. I select the output type which is ZD00. Form preview opens as i have defined preview option only in my code.User goes to Text->Print. Print is fired .But i get message "output cann

  • REJECTION INDICATOR IN PO

    Dear Gurus, Rejection Indicator in PO in a  Confirmation Tab what is the actual meaning of that and how it can be used. Regards Amey

  • ScreenSharingProducer and LCCS SDK

    Hi everyone, Im facing some troubles with lccs, specifically with Screensharing. I have an app running and doing screensharing, it's working well and fine. In this app i can have users (with presenter+ roles) sharing their screen (one at a time) and

  • Import our apply RAW settings (like VRD files) from other programs in Lightroom

    I worked with the Canon Photo Professional program to convert my RAW's. But now I shifted to Lightroom and want to copy some RAW settings from Canon digital professional (CPP) into Lightroom if possible. I know you can save RAW setting/handeling info