Announcement Announcement Module
Collapse
No announcement yet.
possible?<set name="viewScope.myModelClass" value="myModelClass" type="xyz.MyModel.." Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • possible?<set name="viewScope.myModelClass" value="myModelClass" type="xyz.MyModel.."

    it is possible to create a new instance every time you enter the view-state via set tag?

    Code:
    	<view-state id="enterModelForm" view="view-modelForm" model="modelClass" >
    		<on-entry>
    			<set name="viewScope.modelClass" value="modelClass" type="xyz.ModelClass"></set>
    		</on-entry>
    	</view-state>
    my goal is to create a new instance upon view-state starts.
    or any better approach is highly appreciated.

    thanks
    Last edited by eros; Apr 24th, 2010, 01:57 AM. Reason: tag as SOLVED

  • #2
    i found the solution by trial and error..

    Code:
    		<on-entry>
    			<evaluate expression="new xyz.ModelClass()"
    				result="viewScope.modelClass"></evaluate>
    		</on-entry>

    Comment


    • #3
      Wow...using new works like that in an evaluate action? Didn't realize that. My solution is typically to define a prototype-scoped bean (with ID such as newModelClass) and reference it that way, putting the new prototypical instance into whatever scope necessary.

      Comment


      • #4
        Yes Sir,, me too... i was really amazed...

        it helps me a lot.. because all of my default values are set already in my ModelClass so that.. my initial display of my page is simply creating the new instance of ModelClass..

        maybe this is not the best practice... if any,, please post it here too..so that we may see all the options...

        thanks a lot guys..

        yoroshiku onegaishimasu..

        Comment

        Working...
        X