aspose file tools*
The moose likes Struts and the fly likes using OGNL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "using OGNL" Watch "using OGNL" New topic
Author

using OGNL

Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336
I have 2 jsp's...

Jsp1 needs a value to be calculated and fetched from jsp2...

so control comes from login--->jsp1--->jsp2--->jsp1


I know scriptlets should be avoided as much as possible...

so use of OGNL in jsp1 would suffice,like say storing the value in jsp2 in a session and access in jsp1??

My app is in struts-2 and I am not sure what would happen to the OGNL statement I write in jsp1,i.e when control comes from login-jsp1(before the value is calclulated)

I would give important piece of related code...

In jsp1:-->

A row is selected and button is clicked to go to jsp2...



IN Jsp2 I do AJax call and sending the 2 values that should be set to the selected row of jsp1...





I think the above style of getting jsp1 table and doing it is incorrect...what should be done ? how to use OGNL here?

Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9305
    
  17

I personally cannot understand anything in your code even after going through it 3 times. Your JSPs are talking to each other without using any action, I cannot understand that design in the first place. Now if control transfers from JSP1 to JSP2, then making an ajax request to JSP1 doesn't makes sense as JSP1 is not displayed anywhere or any window or tab in the browser. You made an AJAX request to JSP1 from JSP2 and did nothing with the response. And how is JSP1 using the request parameters that you are sending to it?? Also if you want to set session or other scoped attributes in a JSP, you can use c:set JSTL tag...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336
Ok! I'll make it clear about my issue...

jsp1:-->
--------------

Table with 'n' rows and 6 columns in UI...Only 4 columns are filled for all rows an rest 2 are empty.The user needs to select a row and click on button to go to jsp2

Jsp2:--->
-----------

I prepared the values and have them in javascript ! Now on click of Add button the control goes back to jsp1 but the 2 cells of the row which was selected before should be updated with the 2 javascript values that are there in jsp2





Issue:-->
--------------

How should I transfer them to the appropriate cells of selected row?

1)I made an Ajax call as shown above but it looks fruitless as they come into action class and went nowhere...

If this is the right way then I would post the Action class for jsp 2 that responds to Ajax call !



Need expert advice and no hesitations if suggested a revamp on how to set those values present in jsp2 in the empty cells of selected row of jsp1!







 
Don't get me started about those stupid light bulbs.
 
subject: using OGNL