(no subject)
May. 3rd, 2007 03:04 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
I've never coded in Java or JSP, and I'm landed with a conversion task.
Is there any outside chance that anyone out there knows how to write JSP Documents (XML-compliant JSP code), knows how to code form input fields, and wouldn't mind answering what's probably a newbie question?
The issue is, the page has to be XML-compliant. Chevron brackets aren't allowed inside XML attributes. So I have to restructure the code.
BEFORE
<input value="<%= email%>" type="text" name="contactEmail" id="emailcontact" size="20"/>
AFTER
Based on googling, this is my best guess:
<jsp:element name="input">
<jsp:attribute name="name">
<c:out value="contactEmail"/>
</jsp:attribute>
<jsp:attribute name="value">
<c:out value="$email"/>
</jsp:attribute>
<jsp:attribute name="type">
<c:out value="text"/>
</jsp:attribute>
<jsp:attribute name="id">
<c:out value="emailcontact"/>
</jsp:attribute>
<jsp:attribute name="size">
<c:out value="20"/>
</jsp:attribute>
</jsp:element>
But it's not quite right. That code successfuly produces an HTML form text input field, but it has a displayed value of $variable. Whereas I need the actual value, as typed in by the user, to be assigned to the JSP variable on submission.
Meep?
[EDITED: solved! the answer is, replace <c:out value="$email"/> with <jsp:expression>email</jsp:expression>
Is there any outside chance that anyone out there knows how to write JSP Documents (XML-compliant JSP code), knows how to code form input fields, and wouldn't mind answering what's probably a newbie question?
The issue is, the page has to be XML-compliant. Chevron brackets aren't allowed inside XML attributes. So I have to restructure the code.
BEFORE
<input value="<%= email%>" type="text" name="contactEmail" id="emailcontact" size="20"/>
AFTER
Based on googling, this is my best guess:
<jsp:element name="input">
<jsp:attribute name="name">
<c:out value="contactEmail"/>
</jsp:attribute>
<jsp:attribute name="value">
<c:out value="$email"/>
</jsp:attribute>
<jsp:attribute name="type">
<c:out value="text"/>
</jsp:attribute>
<jsp:attribute name="id">
<c:out value="emailcontact"/>
</jsp:attribute>
<jsp:attribute name="size">
<c:out value="20"/>
</jsp:attribute>
</jsp:element>
But it's not quite right. That code successfuly produces an HTML form text input field, but it has a displayed value of $variable. Whereas I need the actual value, as typed in by the user, to be assigned to the JSP variable on submission.
Meep?
[EDITED: solved! the answer is, replace <c:out value="$email"/> with <jsp:expression>email</jsp:expression>
no subject
Date: 2007-05-03 02:12 pm (UTC)indoctrinatingworking with a user atm.no subject
Date: 2007-05-03 02:17 pm (UTC)no subject
Date: 2007-05-03 02:36 pm (UTC)no subject
Date: 2007-05-03 02:22 pm (UTC)no subject
Date: 2007-05-03 02:36 pm (UTC)There was/is? a Feature whereby paramater substitution for JSTL wasn't enabled by default!!!
Also, (depending on exact environment" should it be "$ { variable } " ?
Am just dashing out, hope fixed by next Tues when back!
no subject
Date: 2007-05-03 02:37 pm (UTC)(see above for solution)