How to read HTML Form-Fields?

X-Application Version: 3.1.2,
Tamino Version : 3.1.1
Platform : Win2k…
WebContainer : Tomcat 3.3
JDK Version : 1.3.1

I created a search/display page with several input fields. Upon commit the page links to itself.

Beneath the form fields I show the query results. How can I set the search fields to the values they had before the query?(i.e. “selected” for …
and value = … for <input type = "text …>

Thanks again,

Ralf

Hello Ralf,

with the next version 3.1.3 it will be easy to save the values of input parameters within a session context. We will provide a variable context which will solve this problem. Request parameters are automatically stored within the variable context and can be addressed by a tag ?getvar?.

For X-Application 3.1.2, you could manually do these steps.

(1) Before the module tag evaluated the request parameter, store its values within the JSP page object. For example


<BR><%<BR>      String myParamValue = request.getParameter("myParam?); <BR>      page.setAttribute(?myParamValue?, myParamValue != null ? myParamValue : ??);<BR>%><BR></pre><BR><BR>(2)	Use value of the attribute as default for the input tags of the parameter. For example<BR><BR><pre class="ip-ubbcode-code-pre"><BR><input name=?myParam? value=?<% out.print(page.getAttribute(?myParamValue?); %>?><BR>



page, request and out are predefined objects (variables) for JSP pages.

Hope, this helps you.

Bye,
Christian.

Thanks for your suggestions. Maybe you can help me a bit further:

This is what I put before the module tag:

<%
String myParamValue = request.getParameter(“query(/testcase1/Frage,~=)”);
page.setAttribute(“myParamValue”, myParamValue != null ? myParamValue : “”);
%>

The error message sounds like there are some imports missing ??

Did I get the name right? I took what’s in the name attribute : "query(/testcase1/Frage,~=)"

For the text-control it should work after you give me some more hints …, but for the I would have to be able to get into the select-tag and insert “selected” at the right position. Seems impossible, without changing the select-tag??


org.apache.jasper.JasperException: Unable to compile C:\diplomarbeit\ino\jakarta-tomcat-3.3a\work\DEFAULT\simple\CustSearch3_9.java:110: Method setAttribute(java.lang.String, java.lang.String) not found in class java.lang.Object.
page.setAttribute(“myParamValue”, myParamValue != null ? myParamValue : “”);
^
C:\diplomarbeit\ino\jakarta-tomcat-3.3a\work\DEFAULT\simple\CustSearch3_9.java:179: Method getAttribute(java.lang.String) not found in class java.lang.Object.
out.print(page.getAttribute(“myParamValue”));

Thank you, Ralf.

Hello,

excuse me, my mistake. Use pageContext instead of page. For this object, setting attributes is possible.

Bye,
Christian.