You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Shoaib Gauhar <sh...@hotmail.com> on 2008/04/02 13:29:45 UTC

Struts 2.1 TabbedPanel scenario

Hello,

Here is the scenrio. I have two action classes. ClassA and ClassB. There is
no relationship among these classes. You might say that if there is no
relationship then why i have to put them in one single jsp. Well its a
client's requirement.

In a single jsp there are two tabs. Tab1ForClassA and Tab2ForClassB.

Each tab has fields concerned to their classes as defined above. Tab1 ->
ClassA and Tab2 -> ClassB.

Can we do it? I have tried this but what happens is that when i submit the
data on Tab1, Tab2's data becomes empty.

So, any ideas will be highly appreciated. Furthermore, i am quite new to
tabbed panel and would require clear tips and ideas.

Thanks in advance,

Shoaib Ahmad Gauhar

-- 
View this message in context: http://www.nabble.com/Struts-2.1-TabbedPanel-scenario-tp16446729p16446729.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2.1 TabbedPanel scenario

Posted by Shoaib Gauhar <sh...@hotmail.com>.
It has definitely solved a big problem. Now, i can show the correct data of
two tabs, submit them and have correct results. Actually, my case is very
simple, as i told you that the two tabs will not be related, so, each tab
will be submitted independently without needing each others data because
there is no common data. So, everything is fine. EXCEPT.....

If i submit one tab the page submits and as a result of this the other tabs'
data is lost. By lost i mean that the changes i made in other tabs are reset
because the page is submitted. I am still unable to find out how to make
each tab ajax based. Here is my jsp code. 


<s:url var="test1" value="demo/DefaultAllowanceDetailsAction.action"/>
<s:url var="test2" value="demo/LibraryFormDefaultAction.action"/>

<sx:tabbedpanel id="tabbedPanel" useSelectedTabCookie="true">
  <sx:div id="div1" label="Allowance Details" href="%{test1}"
refreshOnShow="false" preload="true">
    <s:action name="demo/DefaultAllowanceDetailsAction.action"
executeResult="true" />
  </sx:div>

  <sx:div id="div2" label="Library Form" href="%{test2}"
refreshOnShow="false" preload="true">
    <s:action name="demo/LibraryFormDefaultAction.action"
executeResult="true" />
  </sx:div >
</sx:tabbedpanel>

I have put false in refreshOnShow attribute so the tab is not refreshed once
it gets selected. What i want is to maintain the history of the changes made
to other tabs which were not submitted.

Thanks,

Shoaib Ahmad Gauhar


Shoaib Gauhar wrote:
> 
> Hello,
> 
> Here is the scenrio. I have two action classes. ClassA and ClassB. There
> is no relationship among these classes. You might say that if there is no
> relationship then why i have to put them in one single jsp. Well its a
> client's requirement.
> 
> In a single jsp there are two tabs. Tab1ForClassA and Tab2ForClassB.
> 
> Each tab has fields concerned to their classes as defined above. Tab1 ->
> ClassA and Tab2 -> ClassB.
> 
> Can we do it? I have tried this but what happens is that when i submit the
> data on Tab1, Tab2's data becomes empty.
> 
> So, any ideas will be highly appreciated. Furthermore, i am quite new to
> tabbed panel and would require clear tips and ideas.
> 
> Thanks in advance,
> 
> Shoaib Ahmad Gauhar
> 
> 

-- 
View this message in context: http://www.nabble.com/Struts-2.1-TabbedPanel-scenario-tp16446729p16491420.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2.1 TabbedPanel scenario

Posted by Laurie Harper <la...@holoweb.net>.
Have you looked at the s:action tag? It sounds like that could solve at 
least part of your problem. I'm still not clear how you expect two 
actions designed in isolation to suddenly be able to work in tandem 
without modification. As I say, you can't submit a request to more than 
one action at once -- at least, not without creating a third action to 
delegate to the other two...

L.

Shoaib Gauhar wrote:
> First of all, thanks for replying. I really appreciate it. Making a single
> action class will make the classes very bulky and complex. I dont want to
> have that. I used the remote tabs functionality in tabbed panel but all it
> does is that it goes into a infinite recursive loop. It adds infinite number
> of tabs and the page hangs. Maybe its an implementation error.
> 
> I dont know how to make the dataset common other than make one action class
> which in my case is certainly achievable but not acceptable.
> 
> Let me make the scenario a bit more understandable.
> 
> I am working on a product which generates jsp pages and action classes in
> struts 2. Lets suppose that the user has built two different jsps and action
> classes. They work separately perfectly. Now, we are giving him the option
> to make a tabbed pane by using those two sets of jsps and action classes.
> One way would be to merge them and make one jsp and one action class. Which
> in my case is again achievable but very complex and the code will not be
> readable. The next idea which came to my mind (i dont know if it is
> achievable or not) is to make one jsp but have two separate action classes.
> Each tab remotely accessing the dataset of each action class.
> 
> There is no other idea which is coming to my mind at the moment. So, any
> other idea will be highly appreciated. The worst thing is that the solution
> must be generic. :,(
> 
> Thanks again,
> 
> Shoaib Ahmad Gauhar
> 
> 
> 
> Laurie Harper wrote:
>> Shoaib Gauhar wrote:
>>> Hello,
>>>
>>> Here is the scenrio. I have two action classes. ClassA and ClassB. There
>>> is
>>> no relationship among these classes. You might say that if there is no
>>> relationship then why i have to put them in one single jsp. Well its a
>>> client's requirement.
>> That's an implementation detail, not a functional requirement. Why does 
>> the client care how you structure your actions?
>>
>>> In a single jsp there are two tabs. Tab1ForClassA and Tab2ForClassB.
>>>
>>> Each tab has fields concerned to their classes as defined above. Tab1 ->
>>> ClassA and Tab2 -> ClassB.
>>>
>>> Can we do it? I have tried this but what happens is that when i submit
>>> the
>>> data on Tab1, Tab2's data becomes empty.
>> A request is only processed by one action. If you need both actions to 
>> be able to process all the input from both tabs, you'll have to have 
>> them both aware of the full dataset. There are a number of ways you 
>> might achieve that, depending on what you're trying to achieve.
>>
>>> So, any ideas will be highly appreciated. Furthermore, i am quite new to
>>> tabbed panel and would require clear tips and ideas.
>> I haven't used that widget in Struts 2 so can't offer specific tips. 
>> However, if you start by defining the functional requirements (rather 
>> than the implementation details), it'll be easier to offer advice.
>>
>> L.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2.1 TabbedPanel scenario

Posted by Shoaib Gauhar <sh...@hotmail.com>.
First of all, thanks for replying. I really appreciate it. Making a single
action class will make the classes very bulky and complex. I dont want to
have that. I used the remote tabs functionality in tabbed panel but all it
does is that it goes into a infinite recursive loop. It adds infinite number
of tabs and the page hangs. Maybe its an implementation error.

I dont know how to make the dataset common other than make one action class
which in my case is certainly achievable but not acceptable.

Let me make the scenario a bit more understandable.

I am working on a product which generates jsp pages and action classes in
struts 2. Lets suppose that the user has built two different jsps and action
classes. They work separately perfectly. Now, we are giving him the option
to make a tabbed pane by using those two sets of jsps and action classes.
One way would be to merge them and make one jsp and one action class. Which
in my case is again achievable but very complex and the code will not be
readable. The next idea which came to my mind (i dont know if it is
achievable or not) is to make one jsp but have two separate action classes.
Each tab remotely accessing the dataset of each action class.

There is no other idea which is coming to my mind at the moment. So, any
other idea will be highly appreciated. The worst thing is that the solution
must be generic. :,(

Thanks again,

Shoaib Ahmad Gauhar



Laurie Harper wrote:
> 
> Shoaib Gauhar wrote:
>> Hello,
>> 
>> Here is the scenrio. I have two action classes. ClassA and ClassB. There
>> is
>> no relationship among these classes. You might say that if there is no
>> relationship then why i have to put them in one single jsp. Well its a
>> client's requirement.
> 
> That's an implementation detail, not a functional requirement. Why does 
> the client care how you structure your actions?
> 
>> In a single jsp there are two tabs. Tab1ForClassA and Tab2ForClassB.
>> 
>> Each tab has fields concerned to their classes as defined above. Tab1 ->
>> ClassA and Tab2 -> ClassB.
>> 
>> Can we do it? I have tried this but what happens is that when i submit
>> the
>> data on Tab1, Tab2's data becomes empty.
> 
> A request is only processed by one action. If you need both actions to 
> be able to process all the input from both tabs, you'll have to have 
> them both aware of the full dataset. There are a number of ways you 
> might achieve that, depending on what you're trying to achieve.
> 
>> So, any ideas will be highly appreciated. Furthermore, i am quite new to
>> tabbed panel and would require clear tips and ideas.
> 
> I haven't used that widget in Struts 2 so can't offer specific tips. 
> However, if you start by defining the functional requirements (rather 
> than the implementation details), it'll be easier to offer advice.
> 
> L.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Struts-2.1-TabbedPanel-scenario-tp16446729p16465807.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2.1 TabbedPanel scenario

Posted by Laurie Harper <la...@holoweb.net>.
Shoaib Gauhar wrote:
> Hello,
> 
> Here is the scenrio. I have two action classes. ClassA and ClassB. There is
> no relationship among these classes. You might say that if there is no
> relationship then why i have to put them in one single jsp. Well its a
> client's requirement.

That's an implementation detail, not a functional requirement. Why does 
the client care how you structure your actions?

> In a single jsp there are two tabs. Tab1ForClassA and Tab2ForClassB.
> 
> Each tab has fields concerned to their classes as defined above. Tab1 ->
> ClassA and Tab2 -> ClassB.
> 
> Can we do it? I have tried this but what happens is that when i submit the
> data on Tab1, Tab2's data becomes empty.

A request is only processed by one action. If you need both actions to 
be able to process all the input from both tabs, you'll have to have 
them both aware of the full dataset. There are a number of ways you 
might achieve that, depending on what you're trying to achieve.

> So, any ideas will be highly appreciated. Furthermore, i am quite new to
> tabbed panel and would require clear tips and ideas.

I haven't used that widget in Struts 2 so can't offer specific tips. 
However, if you start by defining the functional requirements (rather 
than the implementation details), it'll be easier to offer advice.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org