Note that there are some explanatory texts on larger screens.

plurals
  1. POjsp useBean is NULL by getAttribute by servlet
    primarykey
    data
    text
    <p>user is null in servlet. Pls let me if doing mistake.</p> <p>i m trying to get all html element in bean rateCode.jsp</p> <pre><code>&lt;%@page import="com.hermes.data.RateCode_" %&gt; &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Rate Code&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;jsp:useBean id="user" class="com.hermes.data.RateCode_" scope="request" &gt; &lt;jsp:setProperty name="user" property="*"/&gt;&lt;/jsp:useBean&gt; &lt;form id="f_rateCode" action="/ratePromoCodes" method="post" &gt; &lt;table align="center" border="1" cellspacing="0"&gt; &lt;tr&gt; &lt;td colspan="2" align="center" class="header"&gt;Rate Code Administrations&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="right" style="border-style: solid;"&gt;Rate Code:&lt;/td&gt; &lt;td align="left" style="border-style: solid;"&gt; &lt;input type="text" id="code" name="code" value="${user.code}" size="10" maxlength="32" style="width: 100px"/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="right" style="border-style: solid;"&gt;Rate Description:&lt;/td&gt; &lt;td align="left" style="border-style: solid;"&gt; &lt;input type="text" id="description" name="description" value="&lt;%=user.getDescription()%&gt;" maxlength="128" size="40"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;input type="submit" value="ok" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>Servlet - ratePromoCodes</p> <pre><code>protected void doPost(HttpServletRequest req, HttpServletResponse resp) { RateCode_ rc = (RateCode_) req.getAttribute("user"); Enumeration an = req.getAttributeNames(); Enumeration pn = req.getParameterNames(); Object o = null; while (an.hasMoreElements()) { o = an.nextElement(); System.out.println(o); } while (pn.hasMoreElements()) { o = pn.nextElement(); System.out.println(o); } } </code></pre> <p>RateCode.java (javaBean)</p> <pre><code>public class RateCode_ { private String code ; private String description; public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload