Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    Inserire css in pagine jsp

    ciao a tutti,
    avrei necessità di far adattare dei css ad una pagina jsp.
    il mio path è cosi composto:
    codice:
    cartella root
       -->cartella css(all'interno c'è il mio file .css)
       -->(cartella)images
       -->(cartella)pagine
                 -->(cartella)JSP(all'interno c'è la mia pagina jsp)
    Inserisco qui di seguito il codice della jsp:

    codice:
    <%@ page import = "com.sapportals.portal.navigation.*" %>
    <%@ page import = "com.sapportals.portal.prt.resource.IResource" %>
    <%@ page import = "com.sapportals.portal.prt.runtime.PortalRuntime" %>
    <%@ page import = "com.sapportals.portal.navigation.INavigationGenerator" %>
    <%@ page import = "com.sapportals.portal.prt.component.IPortalComponentRequest" %>
    <%@ page import = "com.sapportals.portal.prt.resource.IResource" %>
    
    <%@ page import = "com.sapportals.wcm.*" %>
    <%@ page import = "com.sapportals.wcm.service.*" %>
    <%@ page import = "com.sapportals.wcm.repository.*" %>
    <%@ page import = "com.sapportals.wcm.service.urlgenerator.*" %>
    <%@ page import = "com.sapportals.wcm.util.uri.*" %>
    
    
    
    <%@ taglib uri="NavigationTagLibrary" prefix="nav" %>
    <%@ taglib uri="tagLib" prefix="hbj" %>
    
    <% 
    	IPortalComponentRequest currentRequest; 
    	IPortalComponentContext componentContext; 
    	IPortalComponentProfile profile; 
    
    	currentRequest 		=(IPortalComponentRequest)pageContext.getAttribute(javax.servlet.jsp.PageContext.REQUEST ); 
    	componentContext 	= currentRequest.getComponentContext(); 
    	profile 			= componentContext.getProfile(); 
    	
    	String introductionText 	= profile.getProperty("IntroductionText") + " "; 
    	String iconRID 				= profile.getProperty("IconRID"); 
    	String depthLevel 			= profile.getProperty("DepthLevel"); 
    	String isTextBeneathIcon	= profile.getProperty("IsTextBeneathIcon"); 
    	String indentationSpace		= profile.getProperty("IndentationSpace"); 
    	String verticalCellHeight	= profile.getProperty("VerticalCellHeight"); 
    	String bodyClass			= profile.getProperty("BodyClass"); 
    	
    	RID rid = RID.getRID(iconRID);					
    	
    	String uriString = "";
    
    	
    	try {	
    						
    		IURLGeneratorService ug = (IURLGeneratorService)ResourceFactory.getInstance().getServiceFactory().getService(IServiceTypesConst.URLGENERATOR_SERVICE);
    			
    		IUriReference uriRef = ug.getResourcePageUri(PathKey.CONTENT_ACCESS_PATH, rid, null);
    		IHierarchicalUri uri = ug.createAbsoluteUri(uriRef);
    		uriString = uri.getPath();
    		
    	} catch (ResourceException ex) {
    		// nothing
    	} catch (WcmException e) {
    		// nothing
    	}		
    	
    %>
    
    <hbj:content id="myContext" >
    
    	<hbj:page title="ENI Site Map JSP">
    
    		<hbj:gridLayout
    			id="firstGridLayout"
    			width="100%"
    			cellSpacing="0">
    
    <% 
    			if ( !iconRID.equalsIgnoreCase("") ) {
    %> 
    
    				<hbj:gridLayoutCell
    					id="gridLayoutCell_1_1"
    					rowIndex="1"
    					columnIndex="1"
    					width="32"
    					horizontalAlignment="LEFT"
    					verticalAlignment="TOP">
    	
    					<hbj:image
    						id="chooseYourRouteImg"
    						src="<%=uriString %>"
    						alt="ChooseYourRouteImg"
    						height="23"
    						width="27">
    					</hbj:image>			
    	
    				</hbj:gridLayoutCell>
    
    <% 
    
    			}
     
    			if ( !introductionText.equalsIgnoreCase("") ) {
    				
    				if ( isTextBeneathIcon.equalsIgnoreCase("false") ) {
    
    %>
    
    					<hbj:gridLayoutCell
    						id="gridLayoutCell_1_2"
    						rowIndex="1"
    						columnIndex="2"
    						horizontalAlignment="LEFT"
    						verticalAlignment="TOP">
    					
    						<hbj:textView 
    							text="<%=introductionText%>"
    							id="chooseYourRouteText"
    							encode="false"
    							wrapping="TRUE">
    						</hbj:textView>		
    		
    					</hbj:gridLayoutCell>
    
    <% 
    
    				} else {
    					
    %>
    
    					<hbj:gridLayoutCell
    						id="gridLayoutCell_2_1"
    						rowIndex="2"
    						columnIndex="1"
    						horizontalAlignment="LEFT"
    						verticalAlignment="TOP">
    					
    						<hbj:textView 
    							text="<%=introductionText%>"
    							id="chooseYourRouteText"
    							encode="false"
    							wrapping="TRUE">
    						</hbj:textView>		
    		
    					</hbj:gridLayoutCell>
    
    <%					
    				}	
    				
    			}
    %>
    			
    		</hbj:gridLayout>
    
    		
    	<TABLE border="0" cellpadding="0" cellspacing="0" id="<%=strPath%>">
    	
    	<nav:iterateSelectedNavNodesLevel level="<%=depthLevel%>" currentNavNode="currentRootNode"> 
    		
    		<nav:ifNotNavNodeInSelectedPath>
    
    			<nav:recurseNavNodeChildren currentNavNode="currentNavNode" currentDepth="currentDepth"> 
    
    
    			<% 
    			int currentdepthInt = currentDepth.intValue(); 
    			String url = currentNavNode.getName();
    			String title = currentNavNode.getTitle(currentRequest.getLocale());
    			String onClientClickAction = "return EPCM.doNavigate('" + url + "');";
    			%>
    							
    			<TR>
    				<TD>
    					<TABLE border="0" cellpadding="0" cellspacing="0">
    						<TR height="<%=verticalCellHeight%>">
    	
    							<% 
    							for( int i = 2; i <= currentdepthInt; i++ ) { 
    							%> 
    							<TD width="<%=indentationSpace%>"/> 
    							<% 
    							} 
    							%> 
    
    							<TD>				        
    		
    								<nav:ifNavNodeIsFolder>
    						
    									<span class="urTxtEmph">
    										<nav:navNodeTitle/>
    									</span>					
    					
    								</nav:ifNavNodeIsFolder>
    	                
    								<nav:ifNotNavNodeIsFolder>
    	                
    									<span class="urTxtStd">
    
    										<A HREF="<%=title%>" onclick="<%=onClientClickAction%>" class="urLnk"> 
    											<%=title%>
    										</A> 
    	                
    									</span>	                
    	                                
    								</nav:ifNotNavNodeIsFolder>
    	
    							</TD>
    
    						</TR>
    					</TABLE>
    				</TD>	
    			</TR>		
    	
    			</nav:recurseNavNodeChildren>
    
    		</nav:ifNotNavNodeInSelectedPath>
    		
    	</nav:iterateSelectedNavNodesLevel>
    	
    	</TABLE>
    
    	<SCRIPT language="JavaScript">
    	<!--		
    			
    		if ("<%=bodyClass%>" != "") {
    
    			// Modify the iView Body class
    			var tables = document.all("myENITable");
    			if(tables!=null){
    				for(i=0; i<tables.length;i++){
    					tables[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.className = "<%=bodyClass%>";
    				}				
    			}
    			if(typeof(tables.length)=="undefined"){
    				tables.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.className = "<%=bodyClass%>";
    			}		
    		}
    
    	-->
    	</SCRIPT>
    
    	</hbj:page>
    </hbj:content>
    Avrei la necessità di adattare i css in questo codice.

    Spero essere stato chiaro nella spiegazione

    Grazie
    ciao

  2. #2
    Moderatore di Programmazione L'avatar di LeleFT
    Registrato dal
    Jun 2003
    Messaggi
    17,328

    Moderazione

    Java (da cui JSP) ha un forum dedicato.
    Ti invito, inoltre, a prendere visione del regolamento interno, in quanto l'apertura delle discussioni è soggetta ad alcune regole (ad esempio, la formattazione del codice).

    Sistemo io il tuo post e sposto la discussione nel forum Java.


    Ciao.
    "Perchè spendere anche solo 5 dollari per un S.O., quando posso averne uno gratis e spendere quei 5 dollari per 5 bottiglie di birra?" [Jon "maddog" Hall]
    Fatti non foste a viver come bruti, ma per seguir virtute e canoscenza

  3. #3
    Utente di HTML.it L'avatar di desa
    Registrato dal
    Oct 2008
    Messaggi
    569
    Non mi sembra molto un problema da Java, visto che stiamo parlando (nel contesto specifico) di un linguaggio server e di un linguaggio client... ma prova a spiegare meglio che tipo di adattamento vuoi realizzare e poi vediamo...

  4. #4
    Utente di HTML.it
    Registrato dal
    Feb 2007
    Messaggi
    4,157
    io di solito metto sotto il tag html

    <link rel="stylesheet" type="text/css" href="../css/tableStyle.css"></link>

    stabilendo quindi un path relativo.
    All'interno della pagina JSP mi riferisco alle robe del file semplicemente chiamando il nome dello stile

    Nel tuo caso dovrebbe essere proprio uguale a quello che ho fatto io (ma in generale un ../ sale di un livello nel folder)

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.