小编Ken*_*nny的帖子

Servlet RequestDispatcher 未转发

我正在学习 Java Servlets 和 JSP。

我有以下代码:

HelloServlet.jsp

public class HelloServlet extends HttpServlet {
    private static final long serialVersionUID=1;

    protected void doGet(HttpServletRequest request,
       HttpServletResponse response)
       throws ServletException, IOException {

        response.setContentType("text/html");
        response.setCharacterEncoding("utf-8);

        RequestDispatcher aDispatcher = request.getRequestDispatcher("file.jsp");
        aDispatcher.forward(request,response);
   }
}
Run Code Online (Sandbox Code Playgroud)

file.jsp

<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" 
   pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
    <head>
        <title>First JSP</title>
    </head>
    <body>
        Hello!!
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

我的web.xml看起来像这样:

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

    <display-name>Hello</display-name>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <servlet>
        <description></description> …
Run Code Online (Sandbox Code Playgroud)

java eclipse jsp tomcat servlets

5
推荐指数
1
解决办法
1万
查看次数

致命错误:在ini_set之后允许的内存大小为134217728字节(尝试分配3个字节)

起初,我已经看过这个,这个这个.

我收到以下错误:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 220 bytes)

我正php 5.4和我一起工作sql Anywhere 11.

对此的解决方案是根据是放入ini_set('memory_set',-1);我的php-file,但在这之后我得到另一个错误:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 3 bytes)

编辑:我的代码是

<?php
    ini_set('memory_set',-1);
    $connect = sasql_connect("UID=username;PWD=pass");
    echo "Connection succeed";

    $result = sasql_query($connect, "SELECT * FROM table1, table2");

    if(!$result){
    echo "sasql_query failed";
    return 0;
    } else {
    echo "query …
Run Code Online (Sandbox Code Playgroud)

php memory ini sqlanywhere

4
推荐指数
1
解决办法
3万
查看次数

标签 统计

eclipse ×1

ini ×1

java ×1

jsp ×1

memory ×1

php ×1

servlets ×1

sqlanywhere ×1

tomcat ×1