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

    Compilazione JSP sotto JBoss

    Ciao a tutti, vi espongo brevemente un problema che mi sta mandando al manicomio da un paio di giorni. Sul mio pc di casa ho sviluppato un piccolo progettino fatto di 2 JSP e di una classe java, una semplice interrogazione a un DB con qualche operazioncina CRUD. Come server utilizzo Tomcat e tutto funziona perfettamente.
    In ufficio ho creato lo stesso progetto, ma per motivi lavorativi ho JBoss (che funziona perfettamente) e il mio progettino non va. Il fatto è che mi da questo errore

    org.apache.jasper.JasperException: Unable to compile class for JSP

    seguito da

    An error occurred at line: 41 in the jsp file: /pagine/delete.jsp
    Generated servlet error:
    Syntax error on token "<", invalid AssignmentOperator

    An error occurred at line: 41 in the jsp file: /pagine/delete.jsp
    Generated servlet error:
    Syntax error on token "=", != expected

    e non capisco proprio da cosa possa dipendere. Ovviamente sono alle prime armi in java, e non mi stupirei se si trattasse di una fesseria.

  2. #2
    Postare il codice della jsp in oggetto dell'errore aiuterebbe ad aiutarti.
    ...

  3. #3
    Ecco la pagina che mi da l'errore sotto JBoss:

    codice:
    <%@ page contentType="text/html" pageEncoding="UTF-8" %>
    <%@ page import="booksworker.BooksWorker" %>
    <%@ page import="java.util.*" %>
    
    <html>
    <head>
    	<title>Delete</title>
    	<link rel="stylesheet" href="style.css" type="text/css">      
    </head>
    <body>
    
    <%
      	Enumeration names = request.getParameterNames();
    	while(names.hasMoreElements()){
        	String name = (String)names.nextElement();
          	StringBuffer sb = new StringBuffer(name);
          	sb.deleteCharAt(0);
          	BooksWorker.delete(sb.toString());
      	}
    %>
    
    
    
    
    <div class="navigator">
    	Add
    	Delete
    </div>
    
    <div id="box_contenuti">
    
    
    
    
    <form action="delete.jsp" method="post">
    	<table>
    		<tr>
    			<th>Author</th>
    			<th>Title</th>
    			<th>Year</th>
    			<th>Remark</th>
    			<th></th>
    		</tr> 
    		
    		<%
    			//CREO LA LISTA DI TUTTI I LIBRI
    			List<String> list = BooksWorker.getBooks();
    	  		//INIZIALIZZO A 0 L'ELEMENTO ID (CHE EQUIVALE A POSIZIONARE IL CURSORE DELL'ITERATORE
    	  		//PRIMA DELL'ID STESSO, CHE E' IL PRIMO ELEMENTO)
    			int id = 0;
    	  		//CREO L'ITERATORE
    	  		Iterator<String> it = list.iterator();
    	
    	  		while(it.hasNext()){
    	  			//ASSEGNO ALL'ID IL PRIMO ELEMENTO
    	      		id = Integer.parseInt(it.next());
    	      		out.print("<tr>");
    	      		for(int i = 0; i < 4; i++){
    	          		out.print("<td>");
    	          		out.print(it.next());
    	          		out.print("</td>");
    	  			}
    	  			out.print("<td>");
    	  			String box = "<input name=r" + id + " type='checkbox'>";
    	  			out.print(box);
    	  			out.print("</td>");
    	  			out.print("</tr>");
    	 		}
    		%>
    	</table>
    	 
    	
    
    	<input type="submit" value="Delete" class="bottone">
    </form>
     </div>
     
    </body>
    </html>
    Grazie x l'aiuto!

  4. #4
    Che versione di JBoss è? Perché dall'errore sembrerebbe un problema di compatibilità di versione di JDK.
    ...

  5. #5
    La versione di JBoss è la 4.0, ma non credo in realtà che il problema sia di compatibilità del JDK. Infatti io ho ricreato esattamente la stessa applicazione e non ho inserito nessuna classe già compilata. La prima jsp, quella di inserimento dati, infatti viene eseguita correttamente ed esegue l'aggiornamento nel DB correttamente. Per sicurezza posto anche il codice della prima jsp, quella che funziona:

    codice:
    <%@ page contentType="text/html" pageEncoding="UTF-8" %>
    <%@ page import="booksworker.BooksWorker" %>
    
    <html>
    <head>
    	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    	<title>Books database</title>
    	<link rel="stylesheet" href="style.css" type="text/css">
    </head>
    <body>
    
    
    
    
    <div class="navigator">
    	Add
    	Delete
    </div>
    
    <div id="box_contenuti">
    <%
    	//RICEVO I DATI DAL FORM ED EFFETTUO L'INSERIMENTO
      	String author = request.getParameter("author");
      	String title = request.getParameter("title");
      	String year = request.getParameter("year");
      	String remark = request.getParameter("remark");
      	if(author != null && author != "" && title != null && title != ""){
        	BooksWorker.insert(author, title, year, remark);
      	}
    %>
    
    
    
    
    
    
    <form method="get" action="index.jsp">
    	<table>
    		<tr>    
    			<td class="label_inserimento">Author</td>
    			<td><input type="text" name="author" class="campo_inserimento"></td>
    		</tr>
    		<tr>
    			<td class="label_inserimento">Title</td>
    			<td><input type="text" name="title" class="campo_inserimento"></td>
    		</tr>
    		<tr>
    			<td class="label_inserimento">Year</td>
    			<td><input type="text" name="year" class="campo_inserimento"></td>
    		</tr>
    		<tr>
    			<td class="label_inserimento">Remark</td>
    			<td><input type="text" name="remark" class="campo_inserimento"></td>
    		</tr>
    	</table>
    
    	
    
    	<input type="submit" value="Submit" class="bottone">
    </form>
    </div>
    
    </body>
    </html>

  6. #6
    JBoss 4 usa JDK versione 1.4 quando i generics ancora non esistevano, ragion per cui la dichiarazione della lista ti dà errore.
    ...

  7. #7
    come potrei risolvere la cosa?

  8. #8
    Credo che scaricherò una versione più aggiornata di JBoss (o magari Tomcat stesso).
    Grazie per avermi fatto capire il problema.

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.