• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

How can I have a TAB inside my JSP

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My application is developed using struts. Can I have a TAB format inside my JSP?
 
Prasanth Pillai
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
any idea about this?
 
Prasanth Pillai
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Prasanth:

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
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Prasanth

YOu can use this link for tab pages with CSS
 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Allow me:

Javascript:


CSS:


Of course you will have to change the CSS up for your look and feel.

A code snippet of how you would go about using this:
 
Prasanth Pillai
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for all the inputs. I got it done. The following link gives the simplest way to achieve the same.

http://phrogz.net/JS/Tabtastic/index.html#overview
 
Prasanth Pillai
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why reinvent the wheel?

Try Struts-Layout tag library, which has a built-in tab control and many others:

http://struts.application-servers.com/
 
Prasanth Pillai
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

There is a Yahoo group for struts-layout: http://tech.groups.yahoo.com/group/struts-layout/

Also, if you still want to use <head> <body> tags, you have to include <layout:skin/> in the head part.
 
Prasanth Pillai
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh yeah, thats true, that part is missing. let me try with that also. But as per the instruction I need to do only few steps.

To start a new web projet with Struts-Layout, the following steps must be followed:
Configure Struts


Configure Struts-Layout actions

Configure the Struts-Layout treeview and sort action in your struts-config.xml

<action path="/sort"
type="fr.improve.struts.taglib.layout.sort.SortAction"
scope="request"
validate="false">
</action>

<action path="/treeview"
type="fr.improve.struts.taglib.layout.treeview.TreeviewAction"
scope="request"
validate="false">
</action>


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 :

<controller processorClass = "fr.improve.struts.taglib.layout.workflow.LayoutRequestProcessor"/>


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
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone tell me the difference between accessing a jsp file through the server directory listing & same page through application.

when I access the jsp page from server directory list, it works fine.
for example, http://localhost:8080/location/folder1/NewService.jsp ( this works fine). I can see the desired tabs in the screen.

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 !!!

please let me know if you have any idea.
 
Create symphonies in seed and soil. For this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic