Netbeans web.xml Servet

时间:2017-04-22 11:55:26

标签: java netbeans weblogic

  

您好,我在这里做错了什么?   我使用weblogic作为应用程序服务器。我将Weblogic连接到另一台计算机并作为本地网络连接

     

的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee           http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <servlet>
        <servlet-name>login-servlet</servlet-name>
        <servlet-class>com.mrkcn.servlet.LoginServlet</servlet-class>
    </servlet>
<servlet-mapping>
        <servlet-name>login-servlet</servlet-name>
        <url-pattern>/login</url-pattern>
    </servlet-mapping>
<session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
</web-app>
  

weblogic.xml中

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.8/weblogic-web-app.xsd">
  <jsp-descriptor>
    <keepgenerated>true</keepgenerated>
    <debug>true</debug>
  </jsp-descriptor>
  <context-root>/IndirimiKovala</context-root>
</weblogic-web-app>
  

LoginServlet.java

Netbeans Screen Shoot

package com.mrkcn.servlet;


import com.mrkcn.servlet.Classlar.Users;
import com.mrkcn.servlet.Classlar.ConnectInfo;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.json.JSONException;
import org.json.JSONObject;


public class LoginServlet extends HttpServlet{
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
            req.setCharacterEncoding("UTF-8");
            resp.setCharacterEncoding("UTF-8");
            try {
                String filtre = req.getParameter("filtre");
                JSONObject j = new JSONObject();
                ArrayList<String> userList = new ArrayList<>(100);
                Users userDetay = new Users();
                ConnectInfo connect = new ConnectInfo();
                Connection con;
                PreparedStatement pstmt;
                ResultSet rs;
                try (PrintWriter out = resp.getWriter()) {
                    con=connect.baglanti();
                    String Sorgu = "select * from uye "+filtre;
                    pstmt=con.prepareStatement(Sorgu);
                    rs=pstmt.executeQuery();
                    while(rs.next())
                    {
                        userDetay.setId(rs.getInt("id"));
                        userDetay.setKullaniciadi(rs.getString("kullaniciadi"));
                        userDetay.setSifre(rs.getString("sifre"));
                        userDetay.setMail(rs.getString("mail"));
                        userDetay.setAd(rs.getString("ad"));
                        userDetay.setSoyad(rs.getString("soyad"));
                        userDetay.setYas(rs.getInt("yas"));
                        userDetay.setCinsiyet(rs.getString("cinsiyet"));
                        userDetay.setUyetarih(rs.getString("uyetarih"));
                        userDetay.setEngeltarih(rs.getString("engeltarih"));
                        userDetay.setAktif(rs.getInt("aktif"));
                        userDetay.setEngel(rs.getString("engel"));



                        j.put("id", userDetay.getId());
                        j.put("kullaniciadi", userDetay.getKullaniciadi());
                        j.put("sifre", userDetay.getSifre());
                        j.put("mail", userDetay.getMail());
                        j.put("ad", userDetay.getAd());
                        j.put("soyad", userDetay.getSoyad());
                        j.put("yas", userDetay.getYas());
                        j.put("cinsiyet", userDetay.getCinsiyet());
                        j.put("uyetarih", userDetay.getUyetarih());
                        j.put("engeltarih", userDetay.getEngeltarih());
                        j.put("aktif", userDetay.getAktif());
                        j.put("engel", userDetay.getEngel());
                        userList.add(j.toString());
                    }
                    if(userList.size()<1)
                    {
                        j.put("mesaj","Kullanıcı Bulunamadı");
                        userList.add(j.toString());
                    }
                    out.write(userList.toString());
                }

            } catch (SQLException | JSONException ex) {
                Logger.getLogger(LoginServlet.class.getName()).log(Level.SEVERE, null, ex);
            }
    }
    public static void main(String[] args) {

    }
}
  

运行项目时出现此错误

Netbeans Run Error

ant -f "/Users/emrekacan/Desktop/PROJELER/PROJELER/Java Dosyaları/NetBeansProjects/IndirimiKovala" -Dnb.internal.action.name=run -Ddirectory.deployment.supported=false -DforceRedeploy=false -Dnb.wait.for.caches=true "-Dbrowser.context=/Users/emrekacan/Desktop/PROJELER/PROJELER/Java Dosyaları/NetBeansProjects/IndirimiKovala" run
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
Building jar: /Users/emrekacan/Desktop/PROJELER/PROJELER/Java Dosyaları/NetBeansProjects/IndirimiKovala/dist/IndirimiKovala.war
Distributing /Users/emrekacan/Desktop/PROJELER/PROJELER/Java Dosyaları/NetBeansProjects/IndirimiKovala/dist/IndirimiKovala.war
Deploying /Users/emrekacan/Desktop/PROJELER/PROJELER/Java Dosyaları/NetBeansProjects/IndirimiKovala/dist/IndirimiKovala.war
Deployment failed. The message was: java.lang.UnsupportedClassVersionError: com/mrkcn/servlet/LoginServlet : Unsupported major.minor version 52.0
/Users/emrekacan/Desktop/PROJELER/PROJELER/Java Dosyaları/NetBeansProjects/IndirimiKovala/nbproject/build-impl.xml:1058: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 10 seconds)

0 个答案:

没有答案