kamweshi
kamweshi

Reputation: 385

How to covert java code in JSP

How can i convert the following code into JSP. I tried "${}" and <%= on the last line to get the customer Id but no success.

        out.println("<td>");
        out.println("<form action=\"week05_portfolio_servlet\" method=\"post\">");
        out.println("<input type=\"submit\" value=\"View\">");
        out.println("<input type=\"hidden\" name=\"command\" value=\"viewVehicles\">");
        out.println("<input type=\"hidden\" name=\"customerId\" value=\"" + cust.getId()  + "\">");

Upvotes: 1

Views: 382

Answers (1)

IcedDante
IcedDante

Reputation: 6832

Wow- you got a long way to go, huh? I'm not sure what part you are having difficulty with but you need to remove the "out.println" statements since JSP will just render this out as basic html. You may also need to make sure that you are declaring the proper header for your JSP file. Once you do that something like:

<input type="hidden" name="customerId" value="<%=cust.getId() %>" />

will work just fine.

Upvotes: 2

Related Questions