File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes struts taglib problem! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts taglib problem!" Watch "struts taglib problem!" New topic

struts taglib problem!

swenling wen
Ranch Hand

Joined: Jun 07, 2006
Posts: 32
using <html:hidden> like this, right?? help me
<html:form action="/shop/" method="POST">
<font size="2">num:</font><html:text property="qty" size="2"/><br>
<bean efine id="id" name="products" property="productId" type="java.lang.String"/>
<bean efine id="discount" name="products" property="discount" type="java.lang.String"/>
<bean efine id="productName" name="products" property="productName" type="java.lang.String"/>
<html:hidden property="productId" value="<%=id%>" write="true"/><input type="hidden" name="action" value="addcart">
<html:hidden property="price" value="<%=discount%>"/>
<html:hidden property="productName" value="<%=productName%>"/>
<html:hidden property="userName" value="<%=(String)session.getAttribute("username")%>"/>
<html:submit property="B1" value="addcart"/></html:form>
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
<html:hidden property="price" value="<%=discount%>"/>

Try this

<input type="hidden" value="<%=discount%>" name="price">

struts doesn't allow nesting of quoted one is not possible.
swenling wen
Ranch Hand

Joined: Jun 07, 2006
Posts: 32
thank you very much!!!
I have thinked that struts tags can be nested.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
How do these values relate to your form? If they are properties of your form then you can get rid of the bean:define lines and just use this:

<html:hidden property="price" />

- Brent
swenling wen
Ranch Hand

Joined: Jun 07, 2006
Posts: 32
I want to get a value from bean and then relate to my form.
How to solve it? such as:
<bean efine id="id" name="products" property="productId" type="java.lang.String"/> ---this get a value from a bean
<html:hidden property="productId" value="<%=id%>" write="true"/>
---put this value to my form <html:hidden>
Right???do like this.
I agree. Here's the link:
subject: struts taglib problem!