File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Highlight corresponding row after Return button press Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Highlight corresponding row after Return button press" Watch "Highlight corresponding row after Return button press" New topic
Author

Highlight corresponding row after Return button press

Rachel Kumar
Ranch Hand

Joined: Oct 21, 2008
Posts: 51
Please help me!!!

I want to highlight a row in the table, after i return from the page that it lead to.
How do i do it?
Rachel Kumar
Ranch Hand

Joined: Oct 21, 2008
Posts: 51
Some one please help me!!!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

"RK RK", you have previously been warned on multiple occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional, and this is your final warning. Adjust your display name to comply with the required standards prior to your next post.

Your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Failure to comply will result in the removal of your account.

bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rachel Kumar
Ranch Hand

Joined: Oct 21, 2008
Posts: 51
I hope its fine now
Rachel Kumar
Ranch Hand

Joined: Oct 21, 2008
Posts: 51
Please help!!!
asdf lkjh
Greenhorn

Joined: Oct 17, 2008
Posts: 12
Please make sure you put a little more description for the question. Make the guesswork less for the people who read the questions.

Please provide more information about the scenario, to increase your chances of getting it resolved.
Rachel Kumar
Ranch Hand

Joined: Oct 21, 2008
Posts: 51
I have a table with links in it on page1.
when i click on a link in a row it leads me to a new page2.
I have a return button there, onclicking it leads to the parent page1.
I need to highlight the respective row in the table after clicking return button.
How do i do this.
I think i need to capture the url history using http, but i am not sure how to do it...please help
Rachel Kumar
Ranch Hand

Joined: Oct 21, 2008
Posts: 51
please can someone help!!!1
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

This isn't a Struts question.

Use CSS to highlight the row in question.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8707
    
    6

As sushant pointed out, you are really light on the details of your situation.
In really general terms, I would presume that you have some sort of id which identifies the record you are selecting on page1 and displaying on page2. I would add a parameter to the URL on the return button to indicate which record to highlight.
You will have to change however you are displaying records on page1 to check for a highlight parameter and, if it exists, highlight that one row by means of a CSS class or inline style declaration.
If you take a look at the iterator tag documentation, you will see an example which highlights odd numbered rows. Perhaps that will point you in the right direction.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Rachel Kumar
Ranch Hand

Joined: Oct 21, 2008
Posts: 51
here is the code snippet:

I have 2 jsps:

---------Table.jsp------------
<s:url id="orgURL" action="Vieworg" namespace="/orgs" includeParams="none" escapeAmp="true">
<s aram name="org.id" value="#attr.row.id" />
</s:url>

<display:column sortable="true" sortProperty="id" titleKey="org.orgNumber">
<a name="org.id" ></a>
<s:a href="%{orgURL}">${row.id}</s:a>
</display:column>
<display:column sortable="false" titleKey="org.description">


----------- Return.jsp-----------

<table id='Return'>
<tr><td valign="top" align="right">
<s:url anchor = "org.id" includeParams="true" action="ListOrg" namespace="/org" id="ReturnURL" >
<s aram name="org.id" value="#attr.org.id" />
<s aram name="p" value="#attr.p" />
</s:url>
<s:a href="%{ReturnURL}" >Return URL Org</s:a>
</td>
</tr>
</table>

---------------
1.in table.jsp i have the table being displayed with rows having links in them(paged display of the rows)
2.wen klik on the link it leads to Return.jsp
3.now wen i klik the return button in Return.jsp it has to lead me to Table.jsp and it has to find the correct page where the record is and highlight the correct row.

Hope this would give a clear picture:

Please help!!!
[ November 14, 2008: Message edited by: Rachel Kumar ]
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8707
    
    6

Yea, you should have mentioned display tag earlier. I've never used it. Perhaps this example will give you some ideas?
Rachel Kumar
Ranch Hand

Joined: Oct 21, 2008
Posts: 51
Ok anyways thanks for your effort.

Is there anyone who could please help with this, who knows display tag?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Have you considered the DisplayTag documentation or the DisplayTag mailing lists?
Rachel Kumar
Ranch Hand

Joined: Oct 21, 2008
Posts: 51
i am very new to the display tag so i am not sure of the options lease can you let me know how to go about this?

Is there any options that i can use in the s:url or s:a tag of the return.jsp so that it could lead me to the correct page.

Please help!!!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

i am very new to the display tag so i am not sure of the options lease can you let me know how to go about this?

Is there any options that i can use in the s:url or s:a tag of the return.jsp so that it could lead me to the correct page.

For DisplayTag questions please ask on a DisplayTag-related list or forum; I provided the URLs for both the DisplayTag project and mailing lists.
Rachel Kumar
Ranch Hand

Joined: Oct 21, 2008
Posts: 51
I feel it does not matter how the table is displayed i mean using the display tag.

Its is just that we need to capture that which row was kliked and on which page and then when returned back, need to be directed to the correct page and highlight the corresponding row.

I tried using the s:url / s:a tags , is there any other option that i can capture that exact page number and the row that was kliked?

I have this idea but i am not sure how to implement it.

Please can i get help to implement this logic?
I need some help!!!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Can't you just generate a link with the row ID (or whatever you're using) in it?!

Rachel Kumar
Ranch Hand

Joined: Oct 21, 2008
Posts: 51
if you dont mind please can you take a look at the jsp code snippet that i have posted previously, so that i can get a better idea?

Please!!!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I don't really understand what issue you're having. You asked how to highlight a row, I said look at the DisplayTag docs or ask on a DisplayTag list. You asked how to generate a URL with variables in it, I showed you--just substitute whatever variables you need.

Your method may also work--you'd have to look at the generated HTML to see if it is working or not. Is it?

As the <s:a...> docs state it's really designed for use with the Ajax theme, although I suppose it could work.

Dave
Rachel Kumar
Ranch Hand

Joined: Oct 21, 2008
Posts: 51
i dont still know how well to explain to you.

ok let me give another try...

i have a jsp called table.jsp, that displays a table with more than 500 rows in it in a paged manner(pagelinks) so there are more than 10 pages.

the second cell of each row has links in it.
When i klik on the link it leads me to another page2 that is handled by the return.jsp.

In the return.jsp i have a return button that leads me just back to the tables page(table.jsp).

Now my issue here is that if i have kliked some row on the 10th page of the tables then how do i capture the row number that was kliked and that exact page number, so that i am returned back and highlight the correct row on the correct page.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You put the page number and row number into the URL, either how you're already doing it, or how I showed you.
Rachel Kumar
Ranch Hand

Joined: Oct 21, 2008
Posts: 51
still i am not able to solve this:

the issue is that:
i need to capture the history as to which row and on which page number it was clicked, for this i need to cache the query string. my query string looks like this ?org.id=433&d-16544-p=4

where org.id is the org.id nnumber that i click on the row of the table and p=4 is the page number.
How do i capture this and it should be remembered when i return and highlighted accordingly.

Please give me some kind of sample atleast, using struts/javascript/jsp/html...so that i can implement it...

i hope the problem is well described in my previous posts..
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

In Struts 2 URL parameters are mapped to action properties. If you have action properties with publicly accessible setters the URL parameters will be type-converted and set on the action by the framework.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Highlight corresponding row after Return button press
 
Similar Threads
JTable question
change bgcolor of rows
AbstractTableModel - how to highlight a particular row
Row highlight in a JTable
table row selected issue