My application is developed using struts. Can I have a TAB format inside my JSP?
Prasanth Pillai
Ranch Hand
Joined: Oct 16, 2006
Posts: 52
posted
0
any idea about this?
Prasanth Pillai
Ranch Hand
Joined: Oct 16, 2006
Posts: 52
posted
0
this is my requirement. I wanted to have tab in my screen.Currently my application is having around 120 fields in the screen, to see all those field, the user has to scroll down. I wanted to have a more user friendly look for the page. Is there is any other option than TAB, please let me know.
regards, prasanth
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
posted
0
Originally posted by Prasanth Pillai: My application is developed using struts. Can I have a TAB format inside my JSP?
Yes, you can have a tabbed format whether you're using Struts or not.
It's important to understand something, though: In an HTML page, tabs are nothing more than an optical illusion. When users click on a tab, they are in reality clicking on a link that goes to another HTML page. The graphics designer just designs graphic images that look like tabs at the top of the page, with the currently selected tab showing up in a brighter color than the non-selected tabs. In reality, each tab is a separate HTML page.
If you've got too much data on a single page, then yes, using this tabbed or what is sometimes called a "wizard" approach might be a good idea.
A tabbed display does not require a call back to the server, i.e., it does not have to be an "illusion". All tabs can indeed be loaded up front, i.e., you might divide the 120 fields into separate tabbed <DIV>'s - grouping by some meaningful to your application. You then control the display with "dynamic HTML" calls - suce as style="display:none" and style="display:inline".
I have built several well received apps this way - it does require some fairly heavy javaScript. I too was wondering peripherally how it would be accomplished with STRUTS/Tiles.
Prasanth Pillai
Ranch Hand
Joined: Oct 16, 2006
Posts: 52
posted
0
thanks Tom and Merrill for the tip. Now how will I implement the same in my application? I mean currently I have a JSP page with 120 number of fields. I am not sure whether the application will work, if I use the simple DHTML scripts.
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
posted
0
Since Struts has no pre-fabricated "tabbed panel" control, if you want tabs in Struts, you will have to build everything yourself. You will have to create some graphics that look like tabs with labels on them. If you decide to use the method Tom describes, you will have to divide your page into different <div> elements and use JavaScript and CSS to display or hide them as the user clicks on tabs. If you use the method I described earlier, you will have to create several pages, all with the same graphics on top, except that the one tab that applies to the current page will show in a brighter color. You must then create links for each tab that will submit the current form and navigate to the page associated with the tab clicked.
oh, I was wrong. It is working only for HTML pages. For some reason when I place the same code in side a JSP & after deploying it in server (using .war file )trying to access from brower, I am not getting the desired TAB format. I have placed all the required files in the correct location. If anyone know the reason please let me know.
Tong Wang
Ranch Hand
Joined: Jun 20, 2005
Posts: 44
posted
0
Why reinvent the wheel?
Try Struts-Layout tag library, which has a built-in tab control and many others:
thank you for the useful link. But at this point of time I can not change the whole code with the new set of jars. I am not sure I have done it correctly or not. I just need to implement the TAB feature only for 2 jsps. After downloading the Struts-Layout-1.2.jar and making the changes, I am getting many errors while accessing the pages.
Can I do the changes only for 2 JSP's without affecting rest of the code?
Tong Wang
Ranch Hand
Joined: Jun 20, 2005
Posts: 44
posted
0
I haven't used their tags control myself, but I've used the date (calendar), select, form, row, column controls, etc. And actually, in the web app I am working on, I only use struts-layout for the new features, the remaining app still runs old style JSPs. So, just include layout tags in those two JSPs and leave other JSPs untouched.
Also, make sure to put struts-layout.properties under WEB-INF/classes and enter directory information there for both images and config (depending on where you put them). This step is missing from their installation instructions.
If forward to Tiles definition are to be used with sorting or paging on the server, the Struts-Layout request processor must be used and declared in struts-config.xml :
the Tiles definitions must also have a dot in their names. Copy the static resources
Copy the the "config" and "images" directory from the "resources" folder of the Struts-Layout archive to your webapp root folder Copy the Struts-Layout jar
Copy the struts-layout.jar file into the WEB-INF/lib directory. This file is located into the "src/library" of the Struts-Layout distribution archive.
and now the steps which you told. Is that all?
Prasanth Pillai
Ranch Hand
Joined: Oct 16, 2006
Posts: 52
posted
0
Can anyone tell me the difference between accessing a jsp file through the server directory listing & same page through application.
If I access the same JSP file through my application, that means when I invoke the jsp from other JSP or through any other file, I am not able to see any TAB format.
I have placed all the related files in the same directory as the JSP file & put some alert messages to make sure that nothing went wrong with the file location. I see all the alert messages in both cases. Only TAB is not coming. looks weird !!!