facebook

What is the proper way do name form beans?

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #239653 Reply

    Bruce Petro
    Member

    I KNOW this is just a newbie question but it’ll help greatly!

    I did a simple form like your sample login …
    then I did a simple “New user” form and bean … and the login uses that “user”…
    But then I went to do an edit user and I realized – I need a new form (jsp), and a new action but the form-bean itself can work for either new or modify, or for anything else regarding a user.

    SO – what’s the proper way of doing this? The first form (newUser.jsp) currently leads to a NewUserForm and of course a NewUserAction but this layout could be changed to a UserInfoForm and a NewUserAction, then a ModUser.jsp could also point to a UserInfoForm, then a ModUserAction. SO – is this sort of thinking (reuse of various classes) kosher in the Struts process you guys are supporting here or is the best practices thinking that you should have a separate form bean for each form action (as in add, modify, delete)?

    If it is kosher to reuse the formbean class, is it hard to rename it? Since EVERYTHING is currently named “NewUser” its kinda hard in the URL view to tell what name goes with what – I think the source view of the struts-config.xml is probably the easiest way to tell what I’m wanting to rename to what. Is that an acceptable way of changing a formbean name after already connecting everything up?

    Thanks!

    #239658 Reply

    Bruce Petro
    Member

    PS: I just tried using the option to create “new form, action, jsp”, to create this new “Edit User” use case and it works fine till I specifiy the name of the form class that already exists. Then your wizard disables all buttons and says that form class already exists. So obviously, this sort of scenario isn’t what you were thinking about with this wizard. Actually, what I want is create “new jsp, action” – but not the form. Is that option around somewhere that I’m missing it? Or again, perhaps this sort of thinking just isn’t meant to happen in the Struts development design? What’s the correct thinking here?

    #239661 Reply

    Bruce Petro
    Member

    Ahah! Radio button for Existing FormBean! – what answers that part of the question. Still let me know if this entire method of “thinking” is considered best practices and how to rename the old one, I guess.

    Thanks guys!

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: What is the proper way do name form beans?

You must be logged in to post in the forum log in