Transfer Object (Value Object)

Hi Friends
I am want to Use TO in Swing. But i do not know how to.
If You have any knowledge about To in Swings please provide me.
Thanks
---SunnyJain

well that is not what i wanted ..
They have some thing link this usage in J2EE.
http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObject.html
I want to make swing client Table to use a Transfer Object to send data and receive data.

Similar Messages

  • Business Objects, Value Objects and more

    Hey,
    I've got a general question about business objects (aka entity objects or data transfer objects). The scenario I am using is not one of my own, but it might be a future one. Thus, I'd really appreciate all feedback.
    Let's say that i've got a desktop application which purpose is to manage personal DVD collections. Shortly explained, what i would do here is to create a class Dvd to represent a physical DVD. Then i would create the classes DvdServices and DvdDao. The DvdServices class is what my application will use to retrive and store Dvd instances, and takes care of all session and transaction handling. The DvdDao class is where all database communication takes place. This class will only be used by the DvdServices class.
    Now, say that i would want to keep things simple and use the same business object both in the front end and the back end (yes, i'm using Hibernate). That is, the Dvd instances returned by the DvdServices class is the ones i also would like to use in my GUI. This is where i start to get a little uncertain about best practice.
    Let us say that i use an instance of a Dvd to present some information about a dvd to the user. However, the user would not only like to see what's already stored about that dvd - but also edit some details related to it (such as the title, description or the like). What i would do here (to support editing), is to modify the Dvd class so that it holds a DvdAttributes object which contains all its editable values like title and description (in other words, the state - except for the id and a timestamp value). Thus, i also modify the DvdServices class and create a method called updateDvd(Dvd dvd, DvdAttributes attributes). The method updateDvd() in the DvdServices class, internally, makes a reference to the existing DvdAttributes, applies the new DvdAttributes to the Dvd instance, and tries to save it. If something goes wrong, transaction is rolled back, and the old DvdAttributes are applied to the Dvd class in order to reflect the state of the Dvd instance.I like to think of the Dvd instance as the business object, and the DvdAttributes instance as a related value object (the terminology is probably all wrong here?).
    My question regarding all this is wether it "adheres" to what one might consider as "best practices" (if something like that exists in relation to this)? Could i do things smarter in this case? Is there something which does not make sense (always good to hear a second opinion!).
    All feedback appreciated!

    sbrattla wrote:
    Hey,
    I've got a general question about business objects (aka entity objects or data transfer objects). The scenario I am using is not one of my own, but it might be a future one. Thus, I'd really appreciate all feedback.
    I don't believe a DTO would ever be considered a business object.
    Let's say that i've got a desktop application which purpose is to manage personal DVD collections. Shortly explained, what i would do here is to create a class Dvd to represent a physical DVD. Then i would create the classes DvdServices and DvdDao. The DvdServices class is what my application will use to retrive and store Dvd instances, and takes care of all session and transaction handling. The DvdDao class is where all database communication takes place. This class will only be used by the DvdServices class.
    Now, say that i would want to keep things simple and use the same business object both in the front end and the back end (yes, i'm using Hibernate). That is, the Dvd instances returned by the DvdServices class is the ones i also would like to use in my GUI. This is where i start to get a little uncertain about best practice.
    It appears that 'Dvd' is in fact a DTO. Probably best to name it as such - DvdDto.
    Let us say that i use an instance of a Dvd to present some information about a dvd to the user. However, the user would not only like to see what's already stored about that dvd - but also edit some details related to it (such as the title, description or the like). What i would do here (to support editing), is to modify the Dvd class so that it holds a DvdAttributes object which contains all its editable values like title and description (in other words, the state - except for the id and a timestamp value). Thus, i also modify the DvdServices class and create a method called updateDvd(Dvd dvd, DvdAttributes attributes). The method updateDvd() in the DvdServices class, internally, makes a reference to the existing DvdAttributes, applies the new DvdAttributes to the Dvd instance, and tries to save it. If something goes wrong, transaction is rolled back, and the old DvdAttributes are applied to the Dvd class in order to reflect the state of the Dvd instance.I like to think of the Dvd instance as the business object, and the DvdAttributes instance as a related value object (the terminology is probably all wrong here?).
    As stated no.
    Process flow would normally be like this.
    Happy path (it worked)
    1. Query - returns DvdDto
    2. GUI - display DvdDto
    3. Modify DvdDto
    4. Update (send to server/backend) DvdDto
    5. (Return - It worked.)
    Sad path (it failed)
    1. Query - returns DvdDto
    2. GUI - display DvdDto
    3. Modify DvdDto
    4. Update (send to server/backend) DvdDto
    5. Exception is thrown
    6. (Return - It failed)
    Step 6 is a bit ambigous because it depends on the user and the actual client/server relationship. It could be an exception, a message or just true/false (false is failed.)
    In the above there is no step that corrects or alters the DvdDto instance that was thrown. One reason for this is that it might be a minot mistake on the users part and if you destroy everything they alread typed in they are not going to be happy.

  • Diff between data objects & value objects

    what are the differences between Data and Value Objects?

    What exactly do you imply by "Data Objects"? If you mean Data Transfer Objects, they are the same as Value Objects. Just a new name!

  • 请教 采购申请 审批权限 的tocde,object和value?

    如题,我现在想在sap中获取 具有审批 采购申请 权限的人员名单,通过suim查询,但是不知道改权限与那个tcode,object和value相连,知道的请告诉下,谢谢了。

    非常感谢您的回复,祝您身体健康。
    其实我现在是帮一朋友问,但是我这边没有环境,而且时间紧迫,我需要一个肯定的答案,如果有明确的就好了,
    我上网搜索了下,这个object,的确和审批挂钩,但是我不能肯定。

  • Is there any way to activate the keep identity setting when using a Transfer SQL Server Object Task?

    Is there any way to add the "Keep Identity" option to the tables selected for transfer in a Transfer SQL Server Object Task?  It seems that would be very useful, yet I can't find an easily available setting for it.  I would prefer to
    accomplish this within the Transfer SQL Server Object Task since it can copy any new fields added to the source tables, as opposed to having to rebuild a custom Data Flow Task any time a table structure is altered.  I thought setting "CopyPrimaryKeys"
    to True would do the trick, but I found that only ensures that the column settings are transferred; when the transfer happens, the destination id column is populated based on the specified seed and increment value, not what's actually in the source table. 
    I'd like to point out that replication isn't really an option here. This is a package that runs a few times a day to keep some data on our website up to date with data in our protected corporate environment.

    IIRW there is FastLoadKeepIdentity specifies
    whether to keep an identity in OLEDB destination 
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Dynamic value objects in flex and coldfusion 9

    I'm writing a program for a company that does registrations for conventions and trade-shows.  The problem I'm having is that each different client wants to store different data for each show.  Most of the data is the same (attendee's name, address, etc...), but each show has some customizations that it wants to have...  So each database for each show is going to be different...
    Right now, the only way I know how to transfer data from Flex to ColdFusion is via a Value Object.  (Well, the only good way to do it, that is.)  My problem comes when a client wants a particular database customized.  I have MANY questions about this...
    1) How do I tell my Value Object what fields we've added to or changed in the database without re-writing the entire VO (in both the .AS and .CFC files) and re-compiling my program?  In other words, I need a dynamic VO that changes automatcially with the database.
    2) If there is a way to dynamically create a VO in Flex (and from a few blog posts I've seen, it seems there is a way), how do I tell CF9 what the structure of that dynamically-created VO is?  Without re-writing a bunch of .CFC files every time I add or change a field in the database, that is...
    3) How do I reference the dynamically-created fields in my Flex program?  Right now, for example, I can define a variable called attendeeInfo as type attendeeInfoVO, and then reference things like attendeeInfo.first_name, attendeeInfo.last_name, etc...  How do I reference a field programmatcially when I don't know what it's going to be called beforehand?
    4) How do I make my program display/modify those dynamically-created fields?  Right now, using the attendeeInfo example above, I can create a TextInput with an id="firstNameInput" and just say firstNameInput.text = "{attendeeInfo.first_name}".  That won't work when I have no clue how many dynamically-created fields there are, or even what kind of data they're going to store...  How do I deal with this?
    5) Is there something other than VOs that would fit this situation better?  Am I limiting myself by using VOs in the first place?  Is it just plain impossible to do this with VOs?  And if so, what are my alternatives?  I need a structured object that can be passed around with a single reference -- I absolutely DO NOT want to pass a bunch of references to a bunch of different variables -- that's why I used VOs from the very beginning.
    6) Can I simply PAY someone at Adobe for one-on-one help here?  Do they have experts that you can "buy" for a few hours?  What's the charge for that, if such a thing is available?  Or, is this problem well-explained somewhere on the Web, and I just haven't found it yet?
    I'm very confused here, and it seems like I might have to re-write a ton of code, which I'm not looking forward to...  Ugh...  I appreciate any help you can give me...
    Thanks,
    Laurence MacNeill
    Mableton, Georgia, USA

    This blog post is pretty close to what I want:
    http://justinjmoses.wordpress.com/2008/10/10/flex-dynamic-bindable-value-objects/
    So there are the dynamic value objects I was looking for.  But the blog-poster is using LINQ and .Net 3.5.  I'm using ColdFusion9.
    So, how do I get ColdFusion9 to deal with that?  How do you get CF9 to recognize the fact that you've changed the VO, and deal with it appropriately?
    Thanks,
    L.

  • Are there any shortcuts for creating Value Object Classes?

    Hi,
    I'm using a Remote Object to connect to my server
    (pyAMF/Django). I'm getting stuck with the creation of Value Object
    Classes. It doesn't seem very DRY to have a class on my server
    representing the data model and then have to recreate that class
    and all its properties in my Flex app.
    Are there any shortcuts for creating client side VOs from
    server side data?
    I was thinking about declaring an empty VO class in Flex, and
    then dynamically assigning/casting my Proxy object to that class.
    It seems like that approach may cause problems for the Flex
    compiler though.
    Any hints?
    Thanks!

    quote:
    Originally posted by:
    tptackab
    Oh man, do I feel your pain. I'm not sure what middle-tier
    technology you're using, but I'm using Java (w/Spring) and I
    absolutely hate having to create and maintain two sets of VO (aka
    data transfer - DTO) object for Java and Flex.
    One thing that has helped me in that area is a free tool from
    Farata Systems called
    DTO2Fx. If you're using Java and Eclipse, it's a great time saver.
    You simply install a (very lightweight) Eclipse plugin, add a
    single annotation to your Java VO classes, and it automatically
    generates your Flex VOs. It even creates a base and extended
    version of each VO on the AS3 side so you can add code to the
    extended VO without fear of having your changes overwritten when it
    regenerates your Flex VOs.
    Here's a like to thier
    PDF that
    gives instructions and a download link. I had it up and running in
    my application in less than 30 minutes!
    I'm using Python/Django serverside (PYAMF is my AMF
    serializer).

  • Value Objects still  relevant in EJB 2.0?

    I came across the concept of using Value Objects to get better performance from EJBs as they reduce the number of remote calls to invoke to retrieve object property values.
    However, with the introduction of LocalHome and Local interfaces for EJB 2.0, is it still useful to have value objects to pass data around, typically between EJBs and the Controller (typically servlets/JSPs or session beans that implement business logic)?

    Not so fast.
    I wouldn't be so quick to get rid of VOs simply because local interfaces exist now. Keep in mind that using local interfaces is not always the right answer to your problem (since there are still situations where the client and server are not co-located within a given VM).
    Also, there are times when the brittleness of your API should be considered. If a method takes many parameters, it is often benificial to pass a single VO as a paramater rather than multiple individual parameters. This really comes into play when methods are modified to take different arguments (e.g. adding a new argument).
    Consider a method on a bean used to update a student's records for example.public StudentVO update(String firstName, String middleInitial, String lastName, int age, String ssn, String status) throws UpdateException; is much more brittle than public StudentVO update(StudentVO student) throws UpdateException;Consider what would happen if a design change makes GPA and gradeLevel part of a student's profile.
    The second method's signature would remain the same. The signature of the first method however would now read public StudentVO update(String firstName, String middleInitial, String lastName, int age, String ssn, String status, float gpa, int gradeLevel) throws UpdateException; This change would "break" the calls made by any callers of this method. While there are pros and cons to this (as well as other ways to solve this issue, such as method overloading, etc.), it is something to consider when deciding whether a value object should be used in certain situations.
    Hope this adds another point of view to the discussion.
    Note: I'm using Value Object (VO), Data Transfer Object (DTO) and Transfer Object (TO) to me the same thing here.

  • Value Object Pattern - Does EJB 2.0 Deprecate?

    In the EJB 1.1 specification, there were no such things as Local Interfaces and Local Home Interfaces. In the Core J2EE Patterns book, they cite the main reason for using the Value Object Pattern as being a way to avoid much of the network overhead associated with using EJB; any call to an EJB potentially involves a remote call to the object even if it lives in the same JVM. But with EJB 2.0 you can have a Local Interface which seems to eliminate all this network overhead already.
    Anyone care to register an opinion on whether or not there are still valid reasons for implementing the Value Object Pattern when using EJB 2.0?
    Any input would be greatly appreciated!

    Yes - the fact that it's generally a bad idea to "tie" stateful information (e.g. EntityBeans) to a stateless front-end.
    In other words, it's better functionality to transfer "static" sets of data (Value Objects) in chunks from a business-layer (SLSBs, fronting the EntityBeans) than to have the front-end directly query the persistence tier. Also, using the Facade (and related) patterns as the go-between the view (front-end) layer and the persistence layer, you gain the flexibility of the persistence (and the business) layer changing without having to re-engineer the view at all.

  • Exposing Methods of Value Object

    I have the need for a value (transfer) object that contains only getters and setters, as well as a full "business object" that has the same getters and setters as well as business logic (like insert()).
    I hate the idea of maintaining two separate objects, and making sure that when I add a new attribute to the BO I remember to add it to the VO.
    I would love to have the BO hold a private instance of the VO inside it, and automatically "expose" all the VO's methods to the outside world as if they were its own. I could do this with inheritence, but then I have the problem of creating a VO from a BO (lots of error-prone repetitive code).
    Any ideas on how I could expose these methods, together with the BO's logic?
    Thanks, Gary

    If I've understood your question, you may use a Proxy
    object to achieve the desired behaviour.
    What you'll need to do is create a "super" interface
    that contains the methods from your business object
    and value object. You will then create a Proxy that
    implements the "super" interface. When you invoke a
    method on the proxy, the invocation handler will try
    to first invoke the method on the business object. If
    the business object does not implement the requested
    method (i.e. one of the value methods), the handler
    tries to invoke the method on the value object member
    of the business object.
    The only maintainence overhead implied by this
    solution is that methods must be added to the "super"
    interface to correspond to each method added to the
    business or value objects.
    Have a look at this example to see what I mean
    public class Test {
    public static void main(String[] args) {
    try {
    ProxyHandler d = new ProxyHandler(new
    Handler(new BusinessObject());
    Object o =
    Object o =
    Proxy.newProxyInstance(Thread.currentThread().getConte
    tClassLoader(),
    new Class[]
    new Class[] {BusinessValueInterface.class},
    class}, d);
    BusinessValueInterface bvi =
    rface bvi = (BusinessValueInterface)o;
    bvi.businessMethod();
    System.out.println(bvi.getVal());
    catch (Exception ex) {
    ex.printStackTrace();
    static class ProxyHandler implements
    nts InvocationHandler {
    BusinessObject b;
    public ProxyHandler(BusinessObject bo) {
    b = bo;
    public Object invoke(Object proxy, Method m,
    thod m, Object[] params)
    throws Throwable
    Class[] paramClasses = null;
    if (params != null) {
    paramClasses = new
    amClasses = new Class[params.length];
    for (int x = 0; x < params.length;
    params.length; x++)
    paramClasses[x] =
    paramClasses[x] = params[x].getClass();
    Method m1 = null;
    try {
    m1 =
    m1 = b.getClass().getMethod(m.getName(),
    getName(), paramClasses);
    catch (Exception ex) {
    if (m1 != null) {
    return m1.invoke(b, params);
    else {
    Method m2 =
    Method m2 =
    2 = b.val.getClass().getMethod(m.getName(),
    paramClasses);
    if (m2 != null) {
    return m2.invoke(b.val, params);
    else {
    return null;
    interface BusinessValueInterface {
    public String getVal();
    public void businessMethod();
    static class BusinessObject {
    ValueObject val = new ValueObject();
    public void businessMethod() {
    System.out.println("businessMethod
    inessMethod invoked");
    static class ValueObject {
    public String getVal() {
    return "value";
    Good luck,
    MikeI would definetly like to know more about what performance characteristics is needed in the system before recommending a dynamic proxy. Value objects accessors and mutators tend to be the most called methods in a system, and there is a fairly large overhead for dynamic proxies (about 5*(normal method call) on a windows 2000 box running IBM jre 1.3.1). Dynamix proxies are great and I use them for a lot of things, but NOT for value object setter and getters...
    I�d recommend either wrapping the VO in the BO and exposing it as:
    MyBO myBo = getBO();
    myBo.getValue().setName( ... ); or make the BO stateless and pass the value in the method calls:
    myBO.performSomeNiceBusinessLogic( valueObject, someOtherArgument );The latter is probably the way I would go for most cases, but the former has its advantages to.
    Br - johan

  • Shall I use Value Objects???

    Hi,
    I am creating a web app with approx 25 web pages with not much business logic.
    I plan to use struts framework.
    What I wanted to know was, shall I use value object pattern for my web page?
    Is there some kind of questionaire which I can take to decide whether I should use VO or not?
    Thanks,
    KS

    What's the difference between DTO and VO? Both are
    little more than C structs for ferrying data between
    layers. No functionality whatsoever.Value Object was the name used in the first editions of the Applied Java Patterns & Core J2ee Pattern books from Sun. These are called Data Transfer Objects in the later issues of these books.
    The Value Object name also caused some confusion because the term has previously been used to refer to language specific ideoms of wrapping primative types in Object.

  • Difference Between Maps and Value Objects

    Hi Guys
    Can you please help me differentiate between HashMap and Value Object Design patterns. The trade offs of each and how to choose between the two patterns.

    It really depends upon what you really want to do:
    - If you want to transfer simple objects using their inherent structure, use your DomainObject itself or if you really need to, use a ValueObject
    - If you want to transfer a lot of similar or even different objects with unique keys, use some Map.
    Using a HashMap, you might need to consider:
    - The hashing can significantly increase your CPU load, if you are doing too much. For example you can define your hashValue() to return just the PrimaryKey, or it's hashValue() if it's an Object. And equals() needs only to compare the PrimaryKey as well. This semantic results in two objects being equal, if they have the same PrimaryKey. You may define an additional deepEquals() method, to see if an updated version contains changes to the stored version, if this is needed.
    - If you keep around references in a Map without clearing them, when you don't need them any more, the Map will increase in size. If you want to keep them, but only as memory alows, you might even consider using WeakReference<T>.
    Together with the rules provided by krunals, I hope this helped a bit...

  • Data Migration - SSIS Transfer SQL Server Objects Task or something else

    Can someone please kindly help me with this.
    Scenario
    I have a requirement to transfer selected tables and views (with a specific schema) between two databases which reside in two different servers. In the interest of clarity I will call my databases DB_A and DB_B respectively. Please note that these databases
    are NOT on the same server.
    Transfer of these objects (tables & views) happens once a month. 99% of the objects in question will be of the same name and schema between the two databases as the ones migrated from the previous month. However, metadata definitions may change on DB_A
    and those changes are supposed to be reflected on DB_B along with the associated data. This therefore means that each time a transfer/migration happens; objects in DB_B are dropped first and completely replaced by objects from DB_A.
    Problem
    What is the best way to achieve this?
    My first attempt has been a go on the Transfer SQL Server Objects Task
    in SSIS. The problem that I have is that when using Transfer SQL Server Objects Task
    I don’t know how to filter objects in DB_A so that only objects with a specified schema can be migrated.
    Transfer SQL Server Objects Task appears to be the best solution to me to accomplish my requirement but I can’t filter the desired objects by schema. Someone suggested using C# but my C# skills are not that eloquent.
    May someone kindly help please, or possibly suggest any other way which can be handy to fulfil my requirements.
    Many thanks,
    Mpumelelo

    Hi Prashanth
    Thanks for your response. There is one problem though in my case. I’m sorry I forgot to mention this in the original question. When the objects are moved from BD_A to DB_B the schema in DB_B changes. That is, schemas are not the same between the source and
    the destination database. How do I handle that with the solution that you have suggested?
    Many thanks,
    Mpumelelo

  • Passing "Value Objects" from one JSP to next  (2)

              Someone posted a response from BEA which has since disappeared, it was no different
              from what I was doing and it I still can't get it to store the information in
              the Value Object.
              I get values (true/false) from a Radio button on a FORM in a JSP, press a "Next
              Step" Button.
              I have a "Value Object" in JSP_1, which I use the setters to store various information
              obtained from the <FORM>. I then "jsp:forward" to JSP_2, set different information
              and then I "jsp:forward" to JSP_3 & so on. At the end of the JSP chain only the
              last setter is has the value "true", all the other values are false, despite all
              being "set" to "true".
              The "Value Object" is not storing the information set in previous JSPs. When I
              initially create the "value object" I use;
              <jsp:useBean id="myVO" class="uk.co.notify.valueobjects.MyVO" scope="request"
              />
              <jsp:setProperty name="myVO" property="*"/>
              In JSP_2 JSP999 I don't use <jsp:setProperty> I let the setter in the VO do
              it.
              I am using WebLogic 6.1 sp2 under Windows 2K Pro.
              Any pointers. Thanks.
              [att1.html]
              

    Ok. here's the difference.
              Hitting submit is altogether a different "new" http request. It will send a
              new request from your browser to the server. Whereas, the jsp:forward is
              within the server itself.
              So the VO object whose scope is set to "request" will not retain its values
              between 2 http request.
              For such kind of parameter passing, you could very well store the info. in
              user's session object.
              I hope this helps.
              Best Regards,
              Narayan Anand
              Developer Relations Engineer
              BEA Systems, Inc.
              "Roger Lee" <[email protected]> wrote in message
              news:[email protected]...
              >
              > If I put the jsp:forward statement in all my JSPs before I test for my
              request;
              >
              > <%
              > if ( request.getParameter("SubmitStep2") != null ) {
              > String sParameter2 = request.getParameter("SubmitStep2");
              > if (sParameter2.equals("Next Step")) {
              > // CODE ETC
              > }
              > }
              >
              > The jsp will chain right to the last JSP and all the values set in my
              ValueObject
              > will remain set.
              >
              > Why does hitting a submitt button;
              >
              > <input type="submit" name="SubmitStep2" value="Next Step">
              >
              > cause the VO to lose previous stored values.
              >
              > Any information would be appreciated.
              >
              > Roger Lee
              >
              >
              > "Roger Lee" <[email protected]> wrote:
              > >
              > >Narayan,
              > >
              > >I got your example working fine.
              > >
              > >I added a few more debug statements and it appears that as I enter JSP
              > >2 the value
              > >"set" in JSP 1 is stored okay (boolean true).
              > >
              > >However after the "submit" of the button in JSP which forwards us to
              > >JSP 3 is
              > >pressed all the values are reset to their default value (false).
              > >
              > >
              > >"Narayan Anand" <[email protected]> wrote:
              > >>Hi Roger,
              > >>
              > >>I will look into your code.
              > >>In the meantime, pls try my test case in your system and see if you
              > >can
              > >>run
              > >>that without any problem.
              > >>
              > >>Best Regards,
              > >>Narayan Anand
              > >>Developer Relations Engineer
              > >>BEA Systems, Inc.
              > >>
              > >>"Roger Lee" <[email protected]> wrote in message
              > >>news:[email protected]...
              > >>>
              > >>> Narayan,
              > >>>
              > >>> Thanks for your reply. My code seems to be the same as yours! I still
              > >>can't get
              > >>> the JSPs to "set" the VO and pass it down the chain of JSPs. When
              > >I
              > >>get
              > >>the last
              > >>> JSP the first three have the boolean value set to false, whilst the
              > >>last
              > >>one is
              > >>> set to the value chosen (true).
              > >>>
              > >>> I have attached the JSPs and VO in the attached ZIP file. It must
              > >be
              > >>something
              > >>> obvious, which I can't see!
              > >>>
              > >>> Regards,
              > >>>
              > >>> Roger Lee
              > >>>
              > >>>
              > >>> "Narayan Anand" <[email protected]> wrote:
              > >>> >
              > >>> >
              > >>> >
              > >>> >------=_NextPart_001_02EB_01C257F2.2EC54EA0
              > >>> >
              > >>> >Hi Roger,
              > >>> >
              > >>> >I can still view my previous reply to your post.
              > >>>
              >
              >>>http://216.148.48.100/cgi-bin/dnewsweb?cmd=3Darticle&group=3Dweblogic.dev
              =
              > >>> >eloper.interest.jsp&item=3D10138&utag=3D
              > >>> >
              > >>> >Just now I tested this again.
              > >>> >WLS6.1SP2 on Win2k.
              > >>> >
              > >>> >JSP1 - sets one value using setProperty tag.
              > >>> >JSP2 - sets second property using the VO's setter.
              > >>> >JSP3 - retrieve and prints the values using the VO's getters and
              > >also
              > >>> >=
              > >>> >using the getProperty tag.
              > >>> >
              > >>> >attached are all the jsp's and value object.
              > >>> >Please test it in your environment. It should work.
              > >>> >Then compare it with your code to see the difference.
              > >>> >
              > >>> >I hope this will help to resolve the issue.
              > >>> >
              > >>> >Regards,
              > >>> >Narayan Anand
              > >>> >Developer Relations Engineer
              > >>> >BEA WebLogic Support
              > >>> >
              > >>> >
              > >>> >
              > >>> >
              > >>> >
              > >>> > "Roger Lee" <[email protected]> wrote in message =
              > >>> >news:[email protected]...
              > >>> >
              > >>> > Someone posted a response from BEA which has since disappeared,
              > >>it
              > >>> >was =
              > >>> >no different
              > >>> > from what I was doing and it I still can't get it to store the
              > >=
              > >>> >information in
              > >>> > the Value Object.
              > >>> >
              > >>> > I get values (true/false) from a Radio button on a FORM in a JSP,
              > >>=
              > >>> >press a "Next
              > >>> > Step" Button.
              > >>> >
              > >>> > I have a "Value Object" in JSP_1, which I use the setters to store
              > >>> >=
              > >>> >various information
              > >>> > obtained from the <FORM>. I then "jsp:forward" to JSP_2, set
              different
              > >>> >=
              > >>> >information
              > >>> > and then I "jsp:forward" to JSP_3 & so on. At the end of the JSP
              > >>chain
              > >>> >=
              > >>> >only the
              > >>> > last setter is has the value "true", all the other values are
              false,
              > >>> >=
              > >>> >despite all
              > >>> > being "set" to "true".
              > >>> >
              > >>> > The "Value Object" is not storing the information set in previous
              > >>=
              > >>> >JSPs. When I
              > >>> > initially create the "value object" I use;=20
              > >>> >
              > >>> > <jsp:useBean id=3D"myVO" class=3D"uk.co.notify.valueobjects.MyVO"
              > >>=
              > >>> >scope=3D"request"
              > >>> > />=20
              > >>> > <jsp:setProperty name=3D"myVO" property=3D"*"/>=20
              > >>> >
              > >>> > In JSP_2 JSP999 I don't use <jsp:setProperty> I let the setter
              > >>in
              > >>> >=
              > >>> >the VO do
              > >>> > it.
              > >>> >
              > >>> > I am using WebLogic 6.1 sp2 under Windows 2K Pro.=20
              > >>> >
              > >>> > Any pointers. Thanks.=20
              > >>> >
              > >>> >
              > >>> >------=_NextPart_001_02EB_01C257F2.2EC54EA0
              > >>> >
              > >>> ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
              > >>> ><HTML><HEAD>
              > >>> ><META http-equiv=3DContent-Type content=3D"text/html; =
              > >>> >charset=3Diso-8859-1">
              > >>> ><META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
              > >>> ><STYLE></STYLE>
              > >>> ></HEAD>
              > >>> ><BODY bgColor=3D#ffffff>
              > >>> ><DIV><FONT face=3DArial size=3D2>Hi Roger,</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>I can still view my previous reply
              > >>to
              > >>> >=
              > >>> >your=20
              > >>> >post.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2><A=20
              > >>>
              >href=3D"http://216.148.48.100/cgi-bin/dnewsweb?cmd=3Darticle&group=3D=
              > >>> >weblogic.developer.interest.jsp&item=3D10138&utag">http://216.148=
              > >>>
              >..48.100/cgi-bin/dnewsweb?cmd=3Darticle&group=3Dweblogic.developer.int=
              > >>> >erest.jsp&item=3D10138&utag</A>=3D</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>Just now I tested this =
              > >>> >again.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>WLS6.1SP2 on Win2k.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>JSP1 - sets one value using
              setProperty
              > >>> >=
              > >>> >
              > >>> >tag.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>JSP2 - sets second property using
              > >>the
              > >>> >=
              > >>> >VO's=20
              > >>> >setter.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>JSP3 - retrieve and prints the
              values
              > >>> >=
              > >>> >using the=20
              > >>> >VO's getters and also using the getProperty tag.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>attached are all the jsp's and
              value=20
              > >>> >object.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>Please test it in your environment.
              > >>> >It =
              > >>> >should=20
              > >>> >work.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>Then compare it with your code to
              > >>see
              > >>> >=
              > >>> >the=20
              > >>> >difference.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>I hope this will help to resolve
              > >>the=20
              > >>> >issue.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>Regards,<BR>Narayan
              Anand<BR>Developer
              > >>> >=
              > >>> >Relations=20
              > >>> >Engineer<BR>BEA WebLogic Support</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><BLOCKQUOTE=20
              > >>> >style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px;
              > >>=
              > >>> >BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
              > >>> > <DIV>"Roger Lee" <<A=20
              > >>> > href=3D"mailto:[email protected]">[email protected]</A>> wrote
              > >in
              > >>> >=
              > >>> >message <A=20
              > >>> > =
              > >>>
              >
              >>>href=3D"news:[email protected]">news:[email protected]
              =
              > >>> >a.com</A>...</DIV><BR>Someone=20
              > >>> > posted a response from BEA which has since disappeared, it was
              > >no=20
              > >>> > different<BR>from what I was doing and it I still can't get it
              > >to
              > >>=
              > >>> >store the=20
              > >>> > information in<BR>the Value Object.<BR><BR>I get values
              (true/false)
              > >>> >=
              > >>> >from a=20
              > >>> > Radio button on a FORM in a JSP, press a "Next<BR>Step" =
              > >>> >Button.<BR><BR>I have=20
              > >>> > a "Value Object" in JSP_1, which I use the setters to store
              various=20
              > >>> > information<BR>obtained from the <FORM>. I then "jsp:forward"
              > >>> >to =
              > >>> >JSP_2,=20
              > >>> > set different information<BR>and then I "jsp:forward" to JSP_3
              > >&
              > >>> >=
              > >>> >so on. At=20
              > >>> > the end of the JSP chain only the<BR>last setter is has the value
              > >>=
              > >>> >"true", all=20
              > >>> > the other values are false, despite all<BR>being "set" to =
              > >>> >"true".<BR><BR>The=20
              > >>> > "Value Object" is not storing the information set in previous JSPs.
              > >>> >=
              > >>> >When=20
              > >>> > I<BR>initially create the "value object" I use; =
              > >>> ><BR><BR><jsp:useBean=20
              > >>> > id=3D"myVO" class=3D"uk.co.notify.valueobjects.MyVO" =
              > >>> >scope=3D"request"<BR>/>=20
              > >>> > <BR><jsp:setProperty name=3D"myVO" property=3D"*"/> <BR><BR>In
              > >>> >=
              > >>> >JSP_2=20
              > >>> > JSP999 I don't use <jsp:setProperty> I let the setter in the
              > >>> >=
              > >>> >VO=20
              > >>> > do<BR>it.<BR><BR>I am using WebLogic 6.1 sp2 under Windows 2K Pro.
              > >>> >=
              > >>> ><BR><BR>Any=20
              > >>> > pointers. Thanks. <BR></BLOCKQUOTE></BODY></HTML>
              > >>> >
              > >>> >------=_NextPart_001_02EB_01C257F2.2EC54EA0--
              > >>> >
              > >>> >
              > >>> ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
              > >>> ><HTML>
              > >>> ><HEAD>
              > >>> ><TITLE>Reusing JavaBeans in JSP</TITLE>
              > >>> ><LINK REL=STYLESHEET
              > >>> > HREF="My-Style-Sheet.css"
              > >>> > TYPE="text/css">
              > >>> ></HEAD>
              > >>> >
              > >>> ><BODY>
              > >>> >
              > >>> ><CENTER>
              > >>> ><TABLE BORDER=5>
              > >>> > <TR><TH CLASS="TITLE">
              > >>> > Reusing JavaBeans in JSP</TABLE>
              > >>> ></CENTER>
              > >>> ><P>
              > >>> >
              > >>> ><jsp:useBean id="test" scope="request" class="hall.SimpleBean" />
              > >>> ><jsp:setProperty name="test"
              > >>> > property="message"
              > >>> > value="Hello forward WWW" />
              > >>> >
              > >>> ><jsp:forward page="/myjsp2.jsp" />
              > >>> >
              > >>> ></BODY>
              > >>> ></HTML>
              > >>> >
              > >>> >
              > >>> >
              > >>> ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
              > >>> ><HTML>
              > >>> ><HEAD>
              > >>> ><TITLE>Reusing JavaBeans in JSP</TITLE>
              > >>> ><LINK REL=STYLESHEET
              > >>> > HREF="My-Style-Sheet.css"
              > >>> > TYPE="text/css">
              > >>> ></HEAD>
              > >>> >
              > >>> ><BODY>
              > >>> >
              > >>> ><CENTER>
              > >>> ><TABLE BORDER=5>
              > >>> > <TR><TH CLASS="TITLE">
              > >>> > Reusing JavaBeans in 2 JSP</TABLE>
              > >>> ></CENTER>
              > >>> ><P>
              > >>> >
              > >>> ><jsp:useBean id="test" scope="request" class="hall.SimpleBean" />
              > >>> >
              > >>> > <% test.setMessage1("Second message1 using setters"); %>
              > >>> >
              > >>> >
              > >>> ><jsp:forward page="/myjsp3.jsp" />
              > >>> >
              > >>> >
              > >>> ></BODY>
              > >>> ></HTML>
              > >>> >
              > >>> >
              > >>> >
              > >>> ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
              > >>> ><HTML>
              > >>> ><HEAD>
              > >>> ><TITLE>Reusing JavaBeans in JSP</TITLE>
              > >>> ><LINK REL=STYLESHEET
              > >>> > HREF="My-Style-Sheet.css"
              > >>> > TYPE="text/css">
              > >>> ></HEAD>
              > >>> >
              > >>> ><BODY>
              > >>> >
              > >>> ><CENTER>
              > >>> ><TABLE BORDER=5>
              > >>> > <TR><TH CLASS="TITLE">
              > >>> > Reusing JavaBeans in 2 JSP</TABLE>
              > >>> ></CENTER>
              > >>> ><P>
              > >>> >
              > >>> ><jsp:useBean id="test" scope="request" class="hall.SimpleBean" />
              > >>> >
              > >>> ><%
              > >>> >System.out.println("\nMessage is :"+test.getMessage());
              > >>> >System.out.println("\nMessage1 is :"+test.getMessage1());
              > >>> >%>
              > >>> >
              > >>> ><H1>Message: <I>
              > >>> ><jsp:getProperty name="test" property="message" />
              > >>> ></I></H1>
              > >>> >
              > >>> ><H1>Message1: <I>
              > >>> ><jsp:getProperty name="test" property="message1" />
              > >>> ></I></H1>
              > >>> >
              > >>> >
              > >>> ></BODY>
              > >>> ></HTML>
              > >>> >
              > >>> >
              > >>> >
              > >>> >package hall;
              > >>> >
              > >>> >public class SimpleBean {
              > >>> > private String message = "No message specified";
              > >>> > private String message1 = "No message1 specified";
              > >>> >
              > >>> > public String getMessage() {
              > >>> > return(message);
              > >>> > }
              > >>> >
              > >>> > public void setMessage(String message) {
              > >>> > this.message = message;
              > >>> > }
              > >>> >
              > >>> > public String getMessage1() {
              > >>> > return(message1);
              > >>> > }
              > >>> >
              > >>> > public void setMessage1(String message1) {
              > >>> > this.message1 = message1;
              > >>> > }
              > >>> >}
              > >>> >
              > >>> >
              > >>>
              > >>
              > >>
              > >
              >
              

  • How to set a object value bound to a session to JavaScript variable

    In a JSP, I store an object value in a HttpSession and I also write a Javascript function to display something on the screen. I need to use the Javascript function to display the object value which is stored in the session. How to set the object value to variable of the JavaScript function. Thanks.

    I write a class JavaScriptHelper to convert the object value to variable of the JavaScript;
    1.get the data to a javabean from database;
    2.convert the data to variable of the JavaScript as a String ;
    3.store the object in a HttpSession or Httprequest ;
    4.use in Jsp get the String (variable of the JavaScript )
    YourBean bean = (YourBean) request.getAttribute("model");
         if (bean != null) out.println(bean .getJsCode())
    convert function,(this is only for the matrix):
    public static String formatJsCode(Vector vector) {
    String sJsCode = "";
    //get js head
    sJsCode = getJsHeader();
    //define js array;
    sJsCode += "var data=new Array();\n";
    Vector v = null;
    String sTemp = "", sLine = "";
    for (int i = 0; i < vector.size(); i++) {
    v = (Vector) vector.get(i);
    sLine = "";
    for (int j = 0; j < v.size(); j++) {
    sTemp = (String) v.get(j);
    //replace " to \"
    sTemp = sTemp.replaceAll("\"", "\\\\\\\"");
    //escape Html Tag
    //sTemp = StringUtil.escapeHTMLTags(sTemp);
    //replace \r\n to <br>
    sTemp = sTemp.replaceAll("\r\n", "<br>");
    if (j != 0)
    sLine += ",";
    sLine += "\"" + sTemp + "\"";
    sJsCode += "data[" + i + "]=new Array(" + sLine + ");\n";
    //get js foot
    sJsCode += getJsFooter();
    return sJsCode;
    public static String getJsHeader(){
    return "<script language=\"JavaScript\">";
    public static String getJsFooter(){
    return "</script>";
    }

Maybe you are looking for