我有一个带有 jsf、xhtml 的 web 项目。当我登录时,我将用户名和密码发送到 Prijava.java。
提交按钮<h:commandButton value="Potrdi" action="#{Prijava.prijava}" />
普里瓦方法:
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";
}
该方法返回字符串“Profil”,因此页面应重定向到我要重定向用户的 Profil.xhtml。单击提交按钮时出现此错误:
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> ...
我不知道那是什么以及如何解决它......之前,它有效:/
编辑:
配置文件.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