JSF 1.2 - values are not retained after page reload - jsf-1.2

Problem - I am a beginer with JSF 1.2. I have an input text box and a command button.
After typing some in the text box and pressing the command button, the page is getting reloaded but the value does not get retained in text box.
web.xml
<managed-bean>
<managed-bean-name>myBean</managed-bean-name>
<managed-bean-class>MyBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
View code :
<h:inputText binding="#{myBean.inputComponent}" value="#{myBean.inputValue}" />
<h:commandButton value="submit" action="#{myBean.action}" />

Related

Doesn't get changed value from hidden field on asp

I have on ASP Web Forms element:
<asp:HiddenField ID="ArrayCoordinateHiddenValue" runat="server" />
In Firebug I search next element:
<input id="ContentPlaceHolder_ArrayCoordinateHiddenValue" type="hidden" value="{}" name="ctl00$ContentPlaceHolder$ArrayCoordinateHiddenValue">
In firebug I try edit value, and after press button, which get value from this hidden value. But I see value: "{}" Not, that I edit on FireBug. So it is possible fix? Or which element can I use on this situation?
P.S. When I change value on Firebug, I try simulate as JS change value. On tags HTML (Firebug) I serch ID and change value on field.

Scraping ASP.NET Page - Next Button Click

I am scraping an ASP.net page with Scrapy which displays a paginated list of items. To navigate through the items, there are next and previous buttons in the following format:
<form name="aspnetForm" method="POST" action="search_active_main.aspx" id="aspnetForm">
<!-- other content here -->
<!-- previous button -->
<input type="image" name="ctl00$gvMain$ctl01$btnPrevious" id="ctl00_gvMain_ctl01_btnPrevious" src="/image/previous.gif" />
<!-- next button -->
<input type="image" name="ctl00$gvMain$ctl01$btnNext" id="ctl00_gvMain_ctl01_btnNext" src="/image/next.gif" />
<!-- other content here -->
</form>
When you click one of the buttons, something like this is sent as part of the POST:
ctl00$gvMain$ctl01$btnNext.x:37
ctl00$gvMain$ctl01$btnNext.y:10
What do these numbers represent / how can I crawl through them without using something like Selenium?
As Obsidian Phoenix suggests, the numbers represent the coordinates of the button that is clicked. To crawl the page, you just have to POST the following as formdata in FormRequest to simulate a next button click:
FormRequest.from_response(
response,
formdata={
'ctl00$gvMain$ctl01$btnNext.x':'1'
'ctl00$gvMain$ctl01$btnNext.y':'1'
},
dont_click=True,
dont_filter=True,
callback=self.your_callback_function
)
One thing to investigate is the URL that is present on each page. You may find subsequent pages have /2 /3 etc in their URL but otherwise be identical.
If that's the case, then you can bypass the need to click any buttons and just reload the page with the new page number.

copy and pasting into web input box causes strange behavior?

i have a plain html form on a windows box running windows server 2003. I have come upon something very strange. I input items into an input box and click submit. It safely post to the next page. However if i copy and paste into the box its hit or miss. More miss then hit. WHat i mean is that the input box eventhough has values in it does not seem to post the values to the next aspx page. This is racking my brain.
<form name="sending" method="POST" action="https://xx/Retrieveimg.aspx" target="_self">
<font size="2">invoice :</font><br>
<input name="img" size="50" runat="server">
<input type="submit" value="Send" name="Send">
</form>
has anyone ever seen this behavior before?
I dont see you have an ID for the input which has a runat="server" attribute. Add an ID and try again.

How do I write an HTML entity in button text in ASP.NET?

I need to write out a submit button in ASP.NET so that the button text value is HTML-encoded using the proper HTML entities for the various French characters with accents.
The button is simply declared as
<asp:Button id="button1" runat="server" />
If I do something like
button1.text = "Test é"
then it displays the button text correctly as Test é in the web page, but the HTML source is also Test é, which is not what I need -- I need either é or é.
If I do something like
button1.text = server.htmlencode("Test é")
then it displays Test é in the button text, i.e. Test &#233; in the HTML source.
How do i solve this problem?
You should be able to set the text without encoding anything. You can try to set globalization setting in web.config inside system.web as follows(Not sure if ISO-8859-1 is the correct encoding for french):
<globalization uiCulture="fr-FR" culture="fr-FR" enableClientBasedCulture="true" responseEncoding="ISO-8859-1" fileEncoding="ISO-8859-1" />

Refresh page in asp.net

I have a webpage, in that page I have a button. How can I refresh the page when clicking on that button?
<input type="button" value="Reload" onclick="window.location.reload(true);" />
However, if the page is created from a postback, you would need to use an asp:Button control instead, and let another postback refresh the page. You also have to make sure that the correct code is executed in the code behind to recreate the correct result.
are you using an
<asp:button />
tag?
If so the page should refresh when the button is clicked by default.
<form>
<input TYPE="submit" VALUE="Submit Information Now" />
</form>
SUBMIT is a TYPE attribute value to the INPUT element for FORMs. It specifies a button that, when activated, submits the information entered to a processing script. If there are multiple SUBMIT buttons in a form, only the one activated should be sent to the form processing script.
When you press button your page must refresh, only not refresh that controls which are in AJAX Update Panel

Resources