【问题标题】:Html tag select onclick call servlethtml标签选择onclick调用servlet
【发布时间】:2014-04-01 12:48:37
【问题描述】:

我想在我的 jsp 页面中创建一个选择菜单。如果单击一个值,则会调用一个 servlet 并将一些参数传递给 servlet。我该如何解决? 我想调用 CercaArticoloServlet 并传递 "ricerca","tiporicerca","numero_pagina","articoli_per_pagina"

       <form method="post" action="CercaArticoloServlet">
            <input type="hidden" name="ricerca" value="categoria_home"/>
            <input type="hidden" name="tipoRicerca" value="<%=tmp%>"/>
            <input type="hidden" name="numero_pagina" value="1"/>
            <input type="hidden" name="articoli_per_pagina" value="3"/>

        </form>

【问题讨论】:

    标签: javascript html jsp jakarta-ee servlets


    【解决方案1】:

    表单动作属性应该指向要绑定的 servlet 的 URL。示例:

    action="${pageContext.request.contextPath}/servlet-url"
    

    contextPath 需要在任何 web 应用程序中工作,不仅在 ROOT.war 中

    【讨论】:

    • 我想创建一个
    • 尝试将
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-18
    • 1970-01-01
    • 2016-07-24
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    相关资源
    最近更新 更多