I have a web project with jsf, xhtml.. When I log in, i send username and password to Prijava.java.
Submit button<h:commandButton value="Potrdi" action="#{Prijava.prijava}" />
Prijava method:
public String prijava() throws SQLException{
Baza baza = new Baza();
//Gets connection with database
Connection conn = baza.povezi();
java.sql.Statement stmt = conn.createStatement();
ResultSet set = stmt.executeQuery("SELECT up_ime, geslo FROM uporabnik WHERE up_ime ='" +upIme +"'");
while(set.next()){
//String baza_up_ime = set.getString("up_ime");
//String geslo = set.getString("geslo");
//String uspesno = "";
}
return "Profil";
}
the method returns string "Profil", so the page should be redirected to Profil.xhtml where i want to redirect the user. I get this error when i click on submit button:
org.apache.el.parser.ParseException: Encountered " "}" "} "" at line 1, column 3.
Was expecting one of:
<INTEGER_LITERAL> ...
<FLOATING_POINT_LITERAL> ...
<STRING_LITERAL> ...
"true" ...
"false" ...
"null" ...
"(" ...
"!" ...
"not" ...
"empty" ...
"-" ...
<IDENTIFIER> ...
I have no idea what that is and how to solve it... before, it worked :/
EDIT:
Profil.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:x_rt="http://java.sun.com/jstl/xml_rt"
xmlns:scriptfree="http://jakarta.apache.org/taglibs/standard/scriptfree"
xmlns:permittedTaglibs="http://jakarta.apache.org/taglibs/standard/permittedTaglibs"
xmlns:sql="http://java.sun.com/jsp/jstl/sql"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
xmlns:x="http://java.sun.com/jsp/jstl/xml"
xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:fmt_rt="http://java.sun.com/jstl/fmt_rt"
xmlns:c_rt="http://java.sun.com/jstl/core_rt">
<h:head></h:head>
<head>
<title>: : Environmental Brand : :</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="dvmaincontainer">
<!--main div container starts here-->
<div id="dvtopcontainer">
<!-- top container starts here-->
<div id="dvlogocontainer">
<!-- logo container starts here-->
<h1>Najdi obrtnika</h1>
<h4>Kjer koli in kadarkoli</h4>
<!-- logo container ends here-->
</div>
<div id="dvnavicontainer">
<!-- navogation div starts here-->
<img src="images/navi_left.jpg" alt="" />
<div id="tabs1" >
<ul>
<!-- CSS Tabs -->
<li ><a href="Index.xhtml"><span>Domača stran</span></a></li>
<li id="current"><a href="Profil.xhtml"><span>Profil</span></a></li>
<li><a href="Zahtevki.xhtml"><span>Zahtevki</span></a></li>
<li><a href="Iskanje.xhtml"><span>Iskanje</span></a></li>
</ul>
</div>
<img src="images/navi_right.jpg" alt="" />
<!-- navogation div ends here-->
</div>
<!-- top container ends here-->
</div>
<div id="dvbodycontainer">
<!-- body DIV1 starts here-->
<div id="dvbannerbgcontainer">
<!-- banner bg div starts here-->
<p>Profil:</p>
<f:view>
Hello <h:outputText value="#{Prijava.upIme}"/>!
</f:view>
<table border="1px">
<tr>
<td>Ime:
</td>
<td>
<h:inputText value="#{Uporabnik.ime}" />
<!-- Za change text -->
<!-- <h:commandButton value="Change text" actionListener="#{}" /> -->
</td>
</tr>
<tr>
<td>Priimek
</td>
<td>
<h:inputText value="" />
</td>
</tr>
</table>
<!-- banner bg div ends here-->
</div>
<!-- body DIV2 starts here-->
<div id="dvbannerbgcontainer">
<!-- banner bg div starts here-->
<!-- banner bg div ends here-->
</div>
<!-- body div ends here-->
</div>
<div id="dvfootercontainer">
<!-- footer div starts here-->
<div id="foottop">
<p><span>Copyright 2013 Žiga Sternad, Gašper Sevčnikar, Jurij Valent, Primož Pavlin</span> </p>
<div class="design"> <a href="#"><img src="images/studio.jpg" alt="Studio7designs" border="0" title="Studio7designs" /></a> </div>
</div>
<!-- footer div ends here-->
</div>
<!--main div container ends here-->
</div>
</body>
</html>
enter code here
This is an EL syntax error. It says that it encountered a } while it was expecting one of the listed identifiers or keywords.
This is most likely caused by the following line:
<!-- <h:commandButton value="Change text" actionListener="#{}" /> -->
The #{} is indeed an invalid EL expression.
Note that JSF/EL runs on webserver and produces HTML code and that they are insensitive to HTML comments (they are namely part of the produced HTML and not of JSF/EL code). The webbrowser as being HTML code interpreter is the only who's sensitive to HTML comments. In other words, the HTML comment does not prevent the enclosed JSF tags and EL expressions from being executed, in contrary to what you seemed to expect.
Unrelated to the concrete problem, your JSTL setup is a complete mess. I'm seeing XML namespace declarations of the ancient 1.0 version and the prototype. I strongly recommend to cleanup everything you did in a careless attempt to install JSTL and re-do it after carefully reading our JSTL wiki page. You should end up having only one JSTL 1.2 JAR file in /WEB-INF/lib and absolutely no loose TLD files or additional declarations in web.xml.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With