Accessing Bean Properties
If a bean has a property accessor like:
public int getID();
, it can be accessed using the action:
<jsp:getProperty name="Bean" property="id"/>.
What happens if the bean accessor takes a parameter? e.g:
public int getID(int toGet);
How do you use the action property accessor to specify the parameter?
From : http://java.sun.com/products/jsp/tags/11/syntaxref1111.html#8820
"You cannot use <jsp:getProperty> to retrieve the values of an indexed property"
An ndexed property is one that requires a parameter in the get method.
So your only real option is to create a setter method for the parameter, then create a no-arg get method:
private int _toGet = -1;
public void setIDToGet(int toGet) { _toGet = toGet; }
public int getID()
if (_toGet == -1) throw new IllegalStateException ("The ID to get must be set before you can get the ID");
int id = //get the id based on _toGet;
_toGet = -1; //reset _toGet so we need to set it again later ...
return id;
}
Similar Messages
-
Accessing bean properties in a jsp
Hi,
I am trying to access a bean in my jsp page like this,
<c:out value="${clientSession.customerName}"/>
I validate and then set the bean in my action class, I am using struts 1.1,
package com.neo.five.ereports;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpSession;
import com.neo.five.cookies.SessionCookieValidator;
import com.neo.five.beans.CustomerSessionBean;
public final class EreportAction extends Action{
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response){
//get the session object
HttpSession session = request.getSession(false);
//validate the session cookie if session object dows not exist
Cookie[] cookies = request.getCookies();
SessionCookieValidator scv = new SessionCookieValidator(cookies);
scv.checkCookie();
//forward to appropriate destination
//if there is a cookie continue
if(scv.hasSessionCookie()){
//check for session object
if (session != null) {
//if session does not exist put bean into session that holds the cookie
//values
if(session.getAttribute("cookieSession")==null){
CustomerSessionBean sb = new CustomerSessionBean(scv.getCustomerid(),scv.getCustomerName(),scv.getCfid(),scv.getCftoken());
session.setAttribute("cookieSession", sb);
request.setAttribute("clientSession",sb);
return (mapping.findForward("success"));
}else{
return (mapping.findForward("failure"));
}else{
return (mapping.findForward("failure"));
}this is my SessionBean
package com.neo.five.beans;
public class CustomerSessionBean {
private int customerid;
private String customerName;
private int cfid;
private int cftoken;
public CustomerSessionBean(int customerid,String customerName,int cfid,int cftoken){
this.customerid=customerid;
this.customerName=customerName;
this.cfid=cfid;
this.cftoken=cftoken;
public int getCustomerid(){
return customerid;
private String getCustomerName(){
return customerName;
private int getCfid(){
return cfid;
private int getCftoken(){
return cftoken;
}however I am getting this error,
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An error occurred while evaluating custom action attribute "value" with value "${clientSession.customerName}": Unable to find a value for "customerName" in object of class "com.neo.five.beans.CustomerSessionBean" using operator "." (null)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:536)
root cause
javax.servlet.ServletException: An error occurred while evaluating custom action attribute "value" with value "${clientSession.customerName}": Unable to find a value for "customerName" in object of class "com.neo.five.beans.CustomerSessionBean" using operator "." (null)
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
at org.apache.jsp.eReportDeskTopRoot_jsp._jspService(eReportDeskTopRoot_jsp.java:145)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:536)
Apache Tomcat/4.1.30
thanks for any help.how?.... mmmm ... did ... (head scratch) ...I miss that.
Thanks a million for spotting that, I really did appreciate that.
jp. -
Accessing bean properties in value attrib of jsf tags
I am new to Alfresco and an example upon which i am working uses the following and similar code in a jsp many times. I knw it is calling getName() of DocumentDeatilsBean class but I can not figure out where is it actually configured .. I hope you understand what I am saying
<h:outputText value="#{DocumentDetailsBean.name}" />In the faces-config.xml there will be a managed-bean section that associates that name with a class and a scope.
-
Accessing add() methods through bean properties ?!
I hope this question is trivial...
Is there a defined way of using add(*) methods through bean properties ?
Seems a little odd that Swing components can't be added to a container in a simple "bean-like" way....is there a set*(*) method I've missed ? I'm aware of the getComponents() method on Container...but there's no setComponents(Component []) method.
Thanks,
Michael.Thank you for the repsonse....but..
Wouldn't that mean that I'd have to sub-class all the Components I wanted to use....just to add the set*(*) method....isn't there a tidier way ?
I really find this strange...(I can think of many examples where accessing the add*(*) methods through introspection (possibly by providing set*(*) methods) would be extremely useful....but, staying in a Swing context....)
If you wanted to create an application that can load, edit and save GUI forms (as many already have). Having all Swing components stick to the javaBeans spec. is very useful. The application can use introspection to grab all the properties of a component, without having any hard-coded logic on dealing with specific classes. Users can then provide their own extensions to the components palette, and by sticking to the javaBeans convention, have the GUI editor expose those properties.
But....to compose components together (a fundamental concept) the editor must be provided with "hard-coded" logic that knows how to deal specifically with Components (in that they have an add(*) method).
This must also be a problem with the XMLDecoder class ?!
When encoding a Swing component, the XMLEncoder can use all the get*() methods (including getComponents()) to persist the Container, its properties, and any sub-components....fine.
But, when decoding this information, all the properties can be set through the usual bean mechanism (using the corresponding setPropertyName(*) method) except the sub-components....there is no setComponents(*) method.
How does the XMLDecoder get around this problem ?
Does it "know" that when it gets to the "components" property of a Swing component, it must call the add(*) method instead...?
Thanks,
Michael -
How to update bean properties when using an immediate link
Hello,
I have a page with a find link next to an input text field. The input text field requires a valid code to be entered. If the user doesn't know the code they need to press the find link to go to a search page and select the code. The input text code field needs to have a value entered so it has its required attribute set because the validator I have and attached to the input text field does not get called unless something is entered in the field. If I don't set the link to immediate the required constraint prevents the search page from being invoked but if I do set it to immediate the values typed on the page are not updated to the bean properties they are bound to.
I have read many posts but I fail to see a way to resolve this. The update model phase is apparently skipped because of the immediate attribute and so the values typed in by the user are lost.
Please help.
Thanks,
RandallA UIInput holds the submitted value.
When updating models it is cleared to null but when some error occurs it keeps to hold the submitted value.
The TextRenderer uses the submitted value if the value is null.
Therefore, you can see the submitted value is redrawn when some error occurs.
Unfortunately, this mechanizm does not work beyond requests
because the default application action listener always create a new viewroot based on the navigation rules.
An general solution of your problem is not so easy.
I think it may be to customize the action listener or the lifecycle.
A temporal solution may be that the link action copys the submitted value to the managed-beans. -
How to access System properties in xml file
hi,
i want to read system properties in my xml file using ${} .
I tried it but did not find any way.But when i use log4j if i set some variable in
System properties that properties is read by the log4j.properties .
I am writing a simple program that read a xml properties file file
try {
props = new Properties();
fis = new FileInputStream(xmlFile);
props.loadFromXML(fis);
}before reading this file i set some properties and accessing this properties from that xml .but i cant.
Thankssabre150 wrote:
fun_with_java wrote:
can you give some example?Not really - I would have to write the code for you and I'm not getting paid for writing your code.Thanks for your kindness.
I dont ask you to write the code.Need some help to start it .Actually i dont have knowledge that
whether xml file automatically read it or i have prase the system property manually. Now i got the way to
access system property in xml..
Ok thanks again..
Thanks & Regards -
How can I access the properties of Microsoft files (excel, ppt, and word)
Hi,
How can I access the properties of common Microsoft file formats (Excel, Word, and Powerpoint) from a Java program. You can access/modify the properties of each document type using File->Properties in each MS application. The properties are essentially name/value pairs.
Basically, I need to write a java program that scans a directory and accesses the properties in each of the MS files in the directory.
thanks,
-johnBy api. That is only way to establish a contract with the MS programs you want to interface with, unless you write an api yourself! I've used POI and it was an awesome way to use Excel in java. I created an excel spreadsheet from the results of a sql query from a batch program and then it was automatically emailed using javamail to my client. I had a lot of VBA experience with Excel, Word, and Outlook and it didn't take me long to get used to using Jakarta-POI.
Now I see there is Jakarta-POI-HWPF which works with MS Word documents. Go to: http://jakarta.apache.org/poi/ -
Portal runtime error: Cannot access bean property
Dear all,
Does anybody have a clue what problem might couse the <b>Portal Runtime Error</b> described below?
It does seem to occur when a second user wants to access the <b>Component</b>.
<b>Portal Runtime Error</b>
An exception occurred while processing a request for :
iView : pcd:portal_content/com.xxxxx.luminaires/com.xxxx.iviews/Quotations/EasyQuote
<b>Component</b> Name : EasyQuoteDemo.EasyQuoteComponent
Tag tableView attribute model: Cannot access bean property quotationHeader.CurrentTableModel in page context.
Exception id: 04:50_21/09/04_0070
See the details for the exception ID in the log file
Thxs in advance
JoostHi Dominik,
Having a closer look at the problem, we found it is not the number of users.
It seems our JAVA components keeps the conenctions with SAP open and reopens a new one every time we start the component.
If we finished solving the problem, I will publish the solution.
Greetings,
Joost -
Not Able to Access the Properties of Workspace and Target
Hello
I have install PB 11.2 Build 9027 on my laptop ( Winows 7 (64 bit))). PowerBuilde is open and able to see the existing code.
But when I am trying to access the properties of Workspace or target for Source code control Setup, Properties will not come and nothing happen, I am not able to view the properties of Workspace and targets.
One more think I notice ,when I was trying to create new application (File > New > Target Tab > Application) then window will not open.
Please provide me some suggestion on this issue.
Thanks
Amit MaheshwariHi,
You might find a much larger audience for technical questions if you open a discussion at the PowerBuilder Developer Center
PowerBuilder Developer Center
Thanks,
Ben -
How to access custom properties in EJB
Hello,
I want to supply some properties (20-30) for my EJB application.
In a non enterprise application I would put these properties into a xml file, read it at startup time by a singleton.
This singleton holds the read information in static variables and provides them to all other classes.
I read that with EJB static variables (and so the singleton) are forbidden.
But what is the best way to provide the properties.
Should they be defined in an own xml file or better put into an existing one (and which should this be)?
And if this is done, how can I access these properties?
I searched at goolge and in several forums, but I don't got a suitable answer.
I hope you can help me.
ThanksThe Java EE spec defines simple name/value pairs for Strings and primitive values called env entries.
You define them in ejb-jar.xml in the same place as ejb-refs and resource-refs. You can then look
them up or inject them into your code. Here's an example :
<env-entry>
<env-entry-name>config1</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>foo</env-entry-value>
</env-entry>
In the code :
@Resource(name="config1)
private String c1;
or
String c1 = (String) new InitialContext().lookup("java:comp/env/config1");
or
@Resource
private SessionContext sessionCtx;
String c1 = (String) sessionCtx.lookup("config1"); -
Cannot reset bean properties bound to UIX elements
In a UIX page there are a messageChoice and two messageTextInput that are boud to three bean properties. Here is the code:
<messageChoice model="${bindings.farmaco}"
selectedValue="${bindings.farmaco}"
prompt="Tipo di scheda (farmaco):">
<contents>
<option value="-1"/>
<dataScope>
<contents childData="${bindings.farmaco.displayData}">
<option model="${uix.current}"/>
</contents>
</dataScope>
</contents>
</messageChoice>
<messageTextInput model="${bindings.anno}"
prompt="Anno di compilazione"/>
<messageTextInput model="${bindings.reparto}"
text="${bindings.reparto}"
prompt="Unità operativa:"/>
<submitButton text="Cerca" event="cerca"/>
<resetButton text="Reset">
<primaryClientAction>
<fireAction event="reset"/>
</primaryClientAction>
</resetButton>
the onReset method resets the bean properties:
vars bean=(vars)actionContext.getBindingContext().findDataControl("varsDataControl").getDataProvider();
//reset search criteria
bean.setFarmaco(null);
bean.setAnno(null);
bean.setReparto(null);
But somewhere else the value of these bean properties is set again to the value of the UIX page components. I want just the opposite to happen: when I reset the bean properties, I expect to see (the event causes a refresh) the UIX component reset too.
Why does this not happen?I chaneged the code inside UIX page to accomplish what you wrote:
<messageChoice
prompt="Tipo di scheda (farmaco):"> <contents>
<option value="-1"/>
<dataScope>
<contents childData="${bindings.farmaco.displayData}">
<option model="${uix.current}"/>
</contents>
</dataScope>
</contents>
</messageChoice>
<messageTextInput
text="${bindings.anno}"
prompt="Anno di compilazione"/> <messageTextInput text="${bindings.reparto}" prompt="Unità operativa:"/>
<resetButton text="Reset">
</resetButton>
I also deleted the code for the "onReset" method, but the reset doesn't work. Before the changes, I added some prints to setter and getter methods of the bean properties: during the reset they are set to null, but then they are set again to the previous value before loading the page and I cannot understand where it happens. Any ideas? -
Help:accessing beans method
hello
i have made one application in which i have made two beans under different packages. i am trying to access beans through jsp pages. i am able to access beans and their methods but when i add new method in bean and tried to access that method with different new jsp page say page1.jsp. I am not able to access new method though i am able to access old methods of same beans with this new jsp page. then i made new bean and copied that method in this new bean . then i tried to access that method of this new bean with page1.jsp and i am able to access it can any body guide me what is the reason for this. i want to run this method in old beran rather than new bean
my directory structure is:
projectlms---main folder
addstream---old jsp page
page1---new jsp page
web-inf/classes
com-------main packageof beans
ProgramManager----sub package of classes
bean1--------old bean
new bean------new bean just for testing
now the problem is that i want to add one more method to bean1 and want to access it through pag1.jsp
but i am not able to access it and same method when i take to new bean i am able to access that method through page1.jsp
but i am able to access old methods of bean1 through page1.jsp
thanks
regards
vivekCould be a caching issue.
Wipe out the COMPILED jsps and try again. -
Can't access bookmark properties.
I'd like to access bookmark properties. Right clicking a bookmark (which used to allow me to access bookmark properties) opens the bookmark in a new tab.
I stored information in bookmark properties. Where did it go?
This is a show stopper for me - I think I'll need to downgrade to 3.6 or switch to a different browser If I can't access bookmark properties.If you are clicking in the sidebar then make sure that you click to the left of the icon.
Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
* Don't make any changes on the Safe mode start window.
* https://support.mozilla.com/kb/Safe+Mode
* [[Troubleshooting extensions and themes]] -
Accessing button properties in datagrid row?
Hi
I ve a datagrid which has a button in each row called "Select". When the user clicks the button it calls a function which saves the row details in an array. I also want to change the label and icon of the button but don't know how to access it?
I ve tried giving each button a unique ID but I "is not a valid identifier" so I m really not sure how to access each button from my main script, anyone help?
Cheers in advance
ShaunHi
Thanks for replying, I m still unsure of how to access the properties of a button in a row? I currently have the code below and am struggling to access the properties of the 'Add' button so I can change the label and icon?
Cheers
Shaun
<mx:columns>
<mx:DataGridColumn headerText="Group" dataField="groupName" width="130" editable="false" sortable="false" />
<mx:DataGridColumn headerText="Article Number" dataField="articleNumber" width="200" editable="false" sortable="false" />
<mx:DataGridColumn headerText="Article Name" dataField="slideTitle" width="230" editable="false" sortable="false" />
<mx:DataGridColumn headerText="Colourway" dataField="colourway" width="218" editable="false" sortable="false" />
<mx:DataGridColumn editable="false" paddingLeft="5" sortable="false">
<mx:itemRenderer>
<mx:Component>
<mx:VBox>
<mx:Button label="Add" icon="@Embed(source='assets/icons/add.png')">
<mx:click>
<![CDATA[
outerDocument.addItemToCart(data);
]]>
</mx:click>
</mx:Button>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn> -
JSP can't "see" bean properties
I am trying to populate my JSP form inputs using a bean. I know the bean properties are being set, but for some reason they are not being passed to my form inputs. The bean properties are being set by a worker class just prior to hitting the JSP that segment follows. I think I may have a scope problem. Any help/thoughts would be greatly appreciated.
<HTML>
<HEAD>
<TITLE></TITLE>
<jsp:useBean id="codin" class="edu.cod.CodIn" scope="application" />
</HEAD>
<BODY>
<form action='codapp' method='post'>
<input type='hidden' name='postedFrom' value='studentInsert'>
<br>
student id: <input type='text' name='student_id' size='5' maxlength='5' value='<%= codin.getStudent_id() %>'>
<br>
last name: <input type='text' size='18' name='last_name' value="<%= codin.getLast_name() %>">
<br>
first name: <input type='text' size='16' name='first_name' value="<%= codin.getFirst_name() %>">
~
~
~
~
~
<br>
<input type='submit' value='submit'>
</form>
</BODY>
</HTML>Here is a cod segment from my servlet. In it I am instantiating the bean, then setting the bean properties. If the bean is successfully populated, the gotoPage method returns to the studentInsert.jsp page. I would like to carry the name and ID fields back to the JSP so that the user doesn't have to re-key these fields to enter additional hours for the same individual. I am fairly certain the scope would only need to be request, however I'm sure how it's done.
if ( postOperation.equals("studentInsert") )
CodInsert codin = new CodInsert();
codin.setStudent_id(request.getParameter("student_id"));
codin.setFirst_name(request.getParameter("first_name"));
codin.setLast_name(request.getParameter("last_name"));
codin.setAi_code(request.getParameter("ai_code"));
codin.setAi_date(request.getParameter("ai_date"));
boolean successfulInsert = codin.doTheInsert();
if (successfulInsert) {
gotoPage("studentInsert.jsp",request, response);
else {
gotoPage("errorPage.jsp",request, response);
private void gotoPage(String url,
HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher(url);
dispatcher.forward(request,response);
This is my useBean tag from the studentInsert.jsp:
<jsp:useBean id="codin" class="edu.cod.CodInsert" scope="request" />
Maybe you are looking for
-
LOGICAL FILENAME / TCODE FILE
In a selection screen I have put a parameters called p_log type fileintern. I'd like to read this file, is there any function module that would help me to do this or should I use open dataset.... what if the name look like this <system>\hello.txt tha
-
.....
-
WTF? DW Deleted My Testing Server Files!
Just completed a website redesign for my client. He loved it and asked me to recommend a method for moving the site live. Here is what I recommended: Assign the site that I developed (hosted on my personal website) as a Testing Server. 1. Synchronize
-
Change MRU Size for a PPP Dialup Connection
Hello, I need to lower the MRU Size for a modem PPP connection. Do do that, I tried to add a /etc/ppp/options file as descripted in the man pages (man pppd). Unfortunatly Tiger ackn. then received MRU size of 1524 even I adjusted the PPP MRU size to
-
Why revising /etc/DIR_COLORS doesn't work
hello, I have downloaded the coreutil package from sunfreeware and put ls --color in place. I use an alias 'cls' (color ls) = ls -color and it works fine. But, When I try change the default color value for DIR from blue to yellow(I change the color s