小编Ita*_*ham的帖子

从servlet转发到jsp的请求

我有一个小应用程序(HTML表单,servlet作为控制器和jsp文件),我试图弄清楚为什么我不能将请求从servlet转发到jsp文件.

问题是从html提交后,显示"HTTP Status 404"

申请流程:

  1. 从html提交.
  2. 控制器从html获取名称.
  3. 控制器应该将请求移动到jsp文件.

谢谢!

项目层次结构:http: //s23.postimg.org/kgt7r7lwb/Capture.jpg

main.html中:

<html>
<title>Coupons categories</title>
<body>
  <h1 align="center">Coupons categories</h1>
  <form method="GET" action="Controller">
    Select category 
    Type:
    <select name="type" size=1>
      <option value="restaurants">Restaurants</option>
      <option value="electrics">Electrics</option>
      <option value="hotels">Hotels</option>
    </select>
    <br><br>
      <input type="Submit">
   </form>
</body>
<html>
Run Code Online (Sandbox Code Playgroud)

controller.java:

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

        //PrintWriter out = response.getWriter();
        //out.write(request.getPathInfo());

        String path = request.getParameter("type");
        if(path.equals("electrics"))
        {
            request.setAttribute("timestamp", new Date());
            RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/view/electrics.jsp");
            dispatcher.forward(request, response);
        }
        else if(path.equals("hotels"))
        {
            request.setAttribute("timestamp", …
Run Code Online (Sandbox Code Playgroud)

html java model-view-controller jsp servlets

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

如何在 linux 内核上进行 64 位除法?

我希望在 linux 内核(32 位处理器)上执行以下代码:

#define UQ64 long long int
#define UI32 long int

UQ64 qTimeStamp;
UQ64 qSeconds;
UI32 uTimeStampRes;

qTimeStamp = num1;
uTimeStampRes = num2;

// 64 division !
qSeconds = qTimeStamp / uTimeStampRes;
Run Code Online (Sandbox Code Playgroud)

有计算64除法的算法吗?谢谢。

c linux-kernel

2
推荐指数
1
解决办法
2772
查看次数

pci_user_write_config_word在哪里实现的?

正如性能报告分析所示,我的用户应用程序在从 PCI 设备读取数据时与内核进行交互,特别是通过名为 pci_user_write_config_dword 的函数。

我有兴趣探索这个函数以理解它为什么调用 _raw_spin_lock_irq。

我一直无法找到这个函数的实际实现。我只在以下位置的内核源代码中找到了它的定义: https: //elixir.bootlin.com/linux/v5.18.19/source/include/linux/pci.h#L1235

在Linux内核源代码中哪里可以找到pci_user_write_config_dword的实现?

user_ application         [kernel.kallsyms]                        [k] do_syscall_64
            |          
            |--90.82%--do_syscall_64
            |          |          
            |          |--61.22%--__x64_sys_pwrite64
            |          |          |          
            |          |           --61.21%--ksys_pwrite64
            |          |                     |          
            |          |                      --61.05%--vfs_write
            |          |                                |          
            |          |                                 --60.87%--__vfs_write
            |          |                                           |          
            |          |                                            --60.79%--kernfs_fop_write
            |          |                                                      |          
            |          |                                                       --60.19%--sysfs_kf_bin_write
            |          |                                                                 |          
            |          |                                                                  --60.18%--pci_write_config
            |          |                                                                            |          
            |          |                                                                            |--57.62%--pci_user_write_config_dword
            |          |                                                                            |          |          
            |          |                                                                            |          |--35.92%--_raw_spin_lock_irq
            |          |                                                                            |          |          |          
            |          |                                                                            | …
Run Code Online (Sandbox Code Playgroud)

linux linux-kernel spinlock pci

2
推荐指数
1
解决办法
80
查看次数

从基类实例调用派生类方法而不进行强制转换

还有另一种方法可以在不强制转换的情况下从基指针对象调用派生类方法吗?

class Base
{
};

class Derived : public Base
{
    public:
    void set() {printf("bbbbbbbbbbbb"); }

};

int main()
{
  Base* pbBase;

  pbBase = new Derived();

  //pbBase->set(); // Compilation error.
  (Derived*)pbBase->set(); // Working.
}
Run Code Online (Sandbox Code Playgroud)

c++ c++11

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

PCI驱动程序失败:在设备上检测到PCI总线错误

我正在尝试使用ppc64(power pc)计算机上的自定义驱动程序在特定的pci设备上进行重置。

该驱动程序可在另一台ppc64计算机上使用。

这是负责执行此操作的功能。我删除了几行代码以强调重要的流程。

int reset_device(void)
{
    pdev =  g_reset_info.devs[ix];        
    err = pci_enable_device(pdev);

    if (err) {
        return err;
    }
    pci_set_master(pdev);
    err = pci_save_state(pdev);
    if (err) {
            return err;
    }

    pdev =  g_reset_info.devs[ix];

    err = pci_set_pcie_reset_state(pdev, pcie_hot_reset);
    if (err) {
        return err;
    }

    msleep(jiffies_to_msecs(HZ/2));
    msleep(jiffies_to_msecs(HZ/2));

    pdev =  g_reset_info.devs[ix];

    err = pci_set_pcie_reset_state(pdev, pcie_deassert_reset);
        if (err) {
            return err;
        }

    pdev =  g_reset_info.devs[ix];
    pci_restore_state(pdev);

    msleep(jiffies_to_msecs(HZ/2));
    msleep(jiffies_to_msecs(HZ/2));

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

这是来自dmesg的输出:

mst_ppc_pci_reset_driver reset_device 63 Send hot reset to device: 0000:50:00.0 
mst_ppc_pci_reset_driver reset_device 81 Deassert …
Run Code Online (Sandbox Code Playgroud)

powerpc linux-device-driver linux-kernel pci

0
推荐指数
1
解决办法
75
查看次数

如何从变量中存储单个位?

例如:

我有一个输入= 0x5A ( 0101 1010 ).

我想存储前4位或后4位.

c c++ bit-manipulation bitwise-operators

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