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?

Similar Messages

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

  • 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

  • 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

  • Best way to create, modify, XML with JSP ?  HELP

    Hi friends,
    As i am new to XML,
    I know there are two APIs used for XML processing, i want to know as a begineer level, which API
    is easy and good to implement XML with JSP.
    1) SAX
    2) DOM
    i want to make a log file in XML, so on web page it will be displayed on HTML form through XSL.
    Since there is good tutorial on http://www.w3schools.com/dom
    but i think its HTML dom
    I want XML procession through JAVA CODE , what should i use ? and give some good tutorials on XML DOM
    that is used with JAVA / JSP.
    HELP.
    Edited by: Ghanshyam on Sep 19, 2007 3:24 PM

    Well what i think is you gonna checkout with your requirements before implementing any of the popular XML parsing mechnisms.
    If you are intrested in faster processing @sacrifising a gud amount of your Memory,DOM is the one which you are looking for.
    If you are instrested in Managing your memory and but if you are ok with sacrifising speed SAX is the best solution.it works on what is called a push technology.
    and if you think either way you might have to look towards a pull parser which is StAX (Streaming API for XML Parsing)
    it'd be a gr8 idea if you can go through the below article which explians about each of the parsing mechanisms
    http://www.stylusstudio.com/xml/parser.html#*
    coming back to helpful resources as far java is concern checkout the below link which might be of some help.
    and the main thing is that all of these parser there is a defined specification you might find implementations of different vendors on this.
    eg:Sun Provides one with JDK itself,same as IBM provides one,oracle does the same & so on...
    your first task would be to focus on one such implementation which can cater your requirements.
    DOM:*
    Basic Parsing Objects / Interfaces Involved while DOM parsing:
    http://www.w3.org/TR/DOM-Level-2-Core/java-binding.html
    Breif Overview & few important API details:
    http://www.developerlife.com/domintro/default.htm
    Simple Example:
    http://www.brics.dk/~amoeller/XML/programming/domexample.html
    Others:
    http://www.roseindia.net/xml/dom/
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPDOM.html#wp79994
    http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/dom/1_read.html
    SAX:*
    http://www.javacommerce.com/displaypage.jsp?name=saxparser1.sql&id=18232
    http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/sax/index.htm
    http://java.sun.com/developer/Books/xmljava/ch03.pdf
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPSAX.html#wp69937
    http://www.onjava.com/pub/a/onjava/excerpt/java_xslt_ch5/index.html?page=6
    StAX:*
    http://java.sun.com/webservices/docs/1.6/tutorial/doc/SJSXP2.html
    http://javaboutique.internet.com/tutorials/stax/
    http://today.java.net/pub/a/today/2006/07/20/introduction-to-stax.html
    Hope this might be of some help :)
    REGARDS,
    RaHuL
    http://weblogs.java.net/blog/spericas/archive/2006/04/sun_stax_parser.html

  • Modify javascript with jsp

    Hi.
    Is there any way to modify a text within a javascript script using jsp?
    I have all the javascript in a separated file.
    Thanks.

    Only if you make that separate file a JSP of course.

  • 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
              

  • Database, Dataset, Table Adaptors Error "Unable to load, Update requires a valid DeleteCommand when passed DataRow collection with deleted row"

    Microsoft Visual Basic 2010 Express.
    I am new to Visual Basic programing and i am trying to understand the relationships between Datasets, database, table Adaptors. I have to following code that is is giving me the following error" Unable to load, Update requires a valid DeleteCommand
    when passed DataRow collection with deleted rows". 
    I can track the error and its located in "OffsetTableTableAdapter.Update(MaterionOffsetDataSet.OffsetTable)" code. What am i missing?
    It seems that i can delete the data on the DataGridView Table and it only displays the correct data. but my database is not updating, even though the data grid displays differently.I can determine this because, when i save the offset database, i have all
    the previous uploads and all the rows that i wanted to delete are still there.
    My final goal is to be able to import offset data from a CSV file, save this data on the pc, send a copy of this data to a NuermicUpDown so the customer can modify certain numbers. From here they download all the date to a controller.  IF the customer
    needs to modify the imported data, they can go to a tab with a data grid view and modify the table. They will also have to option to save the modified data into a csv file.  
    Im not sure if i am making this overcomplicated or if there is a easier way to program this.
    CODE:
    Private Function LoadOffSetData()
            Dim LoadOffsetDialog As New OpenFileDialog 'create a new open file dialog and setup its parameters
            LoadOffsetDialog.DefaultExt = "csv"
            LoadOffsetDialog.Filter = "csv|*.csv"
            LoadOffsetDialog.Title = "Load Offset Data"
            LoadOffsetDialog.FileName = "RollCoaterOffset.csv"
            If LoadOffsetDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then  'show the dialog and if the result is ok then
                Try
                    Dim myStream As New System.IO.StreamReader(LoadOffsetDialog.OpenFile) 'try to open the file with a stream reader
                    If (myStream IsNot Nothing) Then 'if the file is valid
                        For Each oldRow As MaterionOffsetDataSet.OffsetTableRow In MaterionOffsetDataSet.OffsetTable.Rows
                            oldRow.Delete()                       
    'delete all of the existing rows
                        Next
                        'OffsetTableTableAdapter.Update(MaterionOffsetDataSet.OffsetTable)
                        Dim rowvalue As String
                        Dim cellvalue(25) As String
                        'Reading CSV file content
                        While myStream.Peek() <> -1
                            Dim NRow As MaterionOffsetDataSet.OffsetTableRow
                            rowvalue = myStream.ReadLine()
                            cellvalue = rowvalue.Split(","c) 'check what is ur separator
                            NRow = MaterionOffsetDataSet.OffsetTable.Rows.Add(cellvalue)
                            Me.OffsetTableTableAdapter.Update(NRow)
                        End While
                        Me.OffsetTableTableAdapter.Update(MaterionOffsetDataSet.OffsetTable)
                        MainOffset.Value = OffsetTableTableAdapter.MainOffsetValue          'saves all the table offsets
    to the offset numericUpDown registers in the main window
                        StationOffset01.Value = OffsetTableTableAdapter.Station01Value
                        StationOffset02.Value = OffsetTableTableAdapter.Station02Value
                       myStream.Close() 'close the stream
                        Return True
                    Else 'if we were not able to open the file then
                        MsgBox("Unable to load, check file name and location") 'let the operator know that the file wasn't able to open
                        Return False
                    End If
                Catch ex As Exception
                    MsgBox("Unable to load, " + ex.Message)
                    Return False
                End Try
            Else
                Return False
            End If
        End Function

    Hello SaulMTZ,
    >>I can track the error and its located in "OffsetTableTableAdapter.Update(MaterionOffsetDataSet.OffsetTable)" code. What am i missing?
    This error usually shows that you do not initialize the
    DeleteCommand object, you could check this
    article to see if you get a workaround.
    >> Im not sure if i am making this overcomplicated or if there is a easier way to program this.
    If you are working CSV file, you could use OleDB to read it which would treat the CSV file as a Table:
    http://www.codeproject.com/Articles/27802/Using-OleDb-to-Import-Text-Files-tab-CSV-custom
    which seems to be easier (in my opinion).
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

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

  • How can I create a Login-page with jsp???

    Hello,
    I have to create a page with JSP code on the Netweaver Developer Studio.
    But I do not know how I do it.
    Can anyone tell me what to write in the portalapp.xml?
    An example would be very helpful.
    Thank you
    Greetings

    As you can see in the example:
    The portalapp.xml file (deployment descriptor) provides configuration information for your application, and defines the components and services in your application. For each component and service, you specify the implementing Java class and configuration information.
    For more information on the format of the portalapp.xml, see Deployment Descriptor (portalapp.xml).
    <application>
        <application-config>
            <property name="SharingReference" value="com.sap.portal.navigation.service, com.sap.portal.navigation.api_mimeservice, com.sap.portal.navigation.helperservice"/>
            <property name="Vendor" value="MY_COMPANY"/>
            <property name="SecurityArea" value="PERMISSION"/>
        </application-config>
        <components>
            <component name="SimpleNavigationExample">
                <component-config>
                    <property name="ClassName" value="MY_CLASS"/>
                    <property name="SecurityZone" value="no_safety"/>
                </component-config>
                <component-profile/>
            </component>
        </components>
        <services/>
    </application>
    You can only update in this example, your class name and other details:
    <property name="Vendor" value="sap.com"/>
    <property name="SecurityArea" value="MyCompany"/>
    <property name="ClassName" value="LOGINCLASS"/>
    <property name="SecurityZone" value="no_safety"/>
    Modify this portalapp.xml file as follows:
           1.      NAVIGATION SERVICE, so you must add references to the following portal applications that define these services:
            com.sap.portal.navigation.service
            com.sap.portal.navigation.api_mimeservice
            com.sap.portal.navigation.helperservice
           2.      In the <application-config> section, create the following properties that help to define the security zone for all components and services in this application:
    ○     Vendor: String identifying the company or organization that provided the application, for example, sap.com.
    ○     SecurityArea: String identifying the security area for the application, for example, NetWeaver.portal.
           3.      In the <component-config> section for the mySiteMap component, create the property SecurityZone to define the specific security zone for the component.
    For Permission, check this document:
    http://help.sap.com/saphelp_nw04s/helpdata/en/44/489e2df5ee4e35e10000000a1553f6/frameset.htm

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

Maybe you are looking for